4.2 Example
The following code snippet shows an example on how to configure the Round-robin Scheduling scheme.
Round-robin Interrupt Scheduling configuration
// io.h includes the device header file with register and vector defines #include <avr/io.h> // interrupt.h contains the ISR related content #include <avr/interrupt.h> void round_robin_interrupt_scheduling_example(void) { // Set the Round-robin Scheduling Enable bit. CPUINT.CTRLA |= CPUINT_LVL0RR_bm; // Example on how to shift the initial interrupt priority. CPUINT.LVL0PRI = PORTA_PORT_vect_num; // Enable global interrupts sei(); } ISR(PORTA_PORT_vect){ // This interrupt will initially have lowest priority, however // that will change since the LVL0PRI will be updated by the interrupt // controller each time an interrupt is executed. }
Atmel | START example
A use case example for Round-robin Interrupt Scheduling using Atmel | START is also available. For more information, see the Get Source Code from Atmel | START chapter.