Microchip Technology ATmega4809 Xplained Pro Getting Started page 13

Hide thumbs Also See for ATmega4809 Xplained Pro:
Table of Contents

Advertisement

Figure 4-4. Device Selection Wizard
A new project with a main.c file associated with it, will be generated in Atmel Studio.
6.
Replace the main loop in the main.c file with the following code snippet:
int main (void)
{
/* Configure SW0 as input */
PORTB.DIRCLR = PIN2_bm;
/* Configure LED0 pin as output */
PORTB.DIRSET = PIN5_bm;
while (1)
{
/* Check the status of SW0 */
/* 0: Pressed */
if (!(PORTB.IN & (PIN2_bm)))
{
/* LED0
on */
PORTB.OUTSET = PIN5_bm;
}
/* 1: Released */
else
{
/* LED0 off */
PORTB.OUTCLR = PIN5_bm;
}
}
}
In the code editor, the code should appear as shown in the figure below.
©
2018 Microchip Technology Inc.
Atmel Studio Users Getting Started
Application Note
AN2653
DS00002653A-page 13

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ATmega4809 Xplained Pro and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Megaavr 0 series

Table of Contents