Microchip Technology ATmega4809 Xplained Pro Getting Started page 17

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

Advertisement

Figure 4-9. Device Selection Wizard
A new project with a main.c file associated with it will be generated in Atmel Studio.
5.
Replace the main function in the main.c file with the following code snippet:
int main (void)
{
/* STK600 have eight User Buttons and eight User LEDs which can be connected to any IO
pin using cables */
/* Configure PB0 as input (remember to connect SW0 to PB0 using a cable */
PORTB.DIRCLR = PIN0_bm;
/* Configure PB1 as output (remember to connect LED0 to PB1 using a cable*/
PORTB.DIRSET = PIN1_bm;
while (1)
{
/* Check the status of SW0 */
/* 0: Pressed */
if (!(PORTB.IN & (PIN0_bm)))
{
/* LED0 on */
PORTB.OUTCLR = PIN1_bm;
}
/* 1: Released */
else
{
/* LED0 off */
PORTB.OUTSET = PIN1_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 17

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