Figure 7-2. LED Circuit Schematics
VDDIO2
I/O Powered by VDDIO2
GND
MVIO
VDD
On-board
voltage
regulator
External
voltage
Supply
1.8V
3.3V
R1
D1
VDD
VDDIO2
PC0
MVIO
D1
/*Blinking a 3V LED with VDD at 1.8V*/
/*Set LED pin to output*/
void LED_PC0_init(void)
{
PORTC.DIRSET = PIN0_bm;
}
/*Toggle LED pin*/
void LED_PC0_toggle(void)
{
PORTC.OUTTGL=PIN0_bm;
}
int main(void)
{
LED_PC0_init();
while (1)
{
/*Check if VDDIO2 is within acceptable range*/
if(MVIO.STATUS & MVIO_VDDIO2S_bm)
{
/*Blink LED at PC0 forever*/
while (1)
{
LED_PC0_toggle();
_delay_ms(250);
}
}
}
}
The code for this example is available in the
blinking-a-3v0-led-with-vdd-at-1v8
folder in these github repositories
TB3287
Blinking a 3V LED with VDD at 1.8V
©
2020 Microchip Technology Inc.
Technical Brief
DS90003287A-page 16