5.
Interrupt on VDDIO2 Status
When the state of the VDDIO2 Status bit changes, the VDDIO2 interrupt flag will be raised. To be able to catch this
interrupt immediately, it is necessary to enable both the VDDIO2 interrupt and global interrupts in general.
Figure 5-1. MVIO.INTCTRL - Enable the VDDIO2 Interrupt
Bit
7
6
5
4
3
2
1
0
Access
R/W
Reset
0
Bit 0 – VDDIO2IE
VDDIO2 Interrupt Enable
This bit controls whether the interrupt for a VDDIO2 state change is enabled or not.
Value
Description
0
The VDDIO2 interrupt is disabled
VDDIO2IE
The VDDIO2 interrupt is enabled
1
/*Enable the VDDIO2 interrupt*/
MVIO.INTCTRL |= MVIO_VDDIO2IE_bm;
/*Enable Global interrupts*/
sei();
The MVIO vector will be called when the interrupt is triggered. Before returning from the Interrupt Service Routine
(ISR), the VDDIO2 (VDDIO2IF) interrupt flag in the MVIO Interrupt Flags (MVIO.INTFLAGS) register must be cleared.
This is done by writing a ‘
1
’ to the flag.
Figure 5-2. MVIO.INTFLAGS - Clear VDDIO2 Interrupt Flag
Bit
7
6
5
4
3
2
1
0
Access
R/W
Reset
0
Bit 0 – VDDIO2IF
VDDIO2 Interrupt Flag
This flag is cleared by writing a ‘
1
’ to it.
This flag is set when the VDDIO2 Status (VDDIO2S) bit in MVIO.STATUS changes value.
Writing a ‘
0
’ to this bit has no effect.
Writing a ‘
1
’ to this bit will clear the VDDIO2 Interrupt Flag.
VDDIO2IF
ISR(MVIO_MVIO_vect)
{
/* The VDDIO2 interrupt has been triggered */
LED0_toggle();
/* Clear the CFD interrupt flag */
MVIO.INTFLAGS |= MVIO_VDDIO2IF_bm;
}
TB3287
Interrupt on VDDIO2 Status
©
2020 Microchip Technology Inc.
Technical Brief
DS90003287A-page 10