Hello World Project


This article assumes that you've already created a project for the ATtiny817 Xplained Pro. If you haven't yet done so, please go through the steps in the Creating a Project in Atmel Studio 7 page.

In this lab, you will write code to make LED0 change state when button SW0 is pressed, compile it, and verify the setup.

Figure 1


Hardware Tools

Software Tools

Tool About Installers
Windows Linux Mac OSX
Atmel® Studio
Integrated Development Environment


The LED and button are connected to the pins as per Table 1, as outlined in the "ATtiny817 Xplained Pro User Guide".

Silkscreen Text ATtiny817 GPIO pin
Table 1


Open main.c

Update main() with the following code:

Warning: Be sure to keep the #include <avr/io.h> line at the top of main.c. This header file will include the correct register map for the selected device. Without this statement, the compiler will not recognize any of the macros referenced in the code above.


Atmel Studio buttons for programming

Locate the key buttons for programming devices and launching debug sessions in Atmel Studio. They are highlighted in Figure 2. Their associated functionality, as well as corresponding keyboard shortcuts, are outlined in Table 2. All options are also available in the 'Debug' menu.

Figure 2

Button Functionality Keyboard Shortcut
Start Debugging and Break Alt + F5
Attach to Target
Start Debugging F5
Break All Ctrl + Alt + Break
Start Without Debugging Ctrl + F5
Table 2


Start Debug Session

Start a debug session by clicking the Start Debugging button or pressing F5.

Starting the debug session will:

  • Compile any changes that have been made to the project since the last compilation
  • Program the resulting binary to the ATtiny817
  • Launch a debug session

Both the title bar and the bottom status bar of Atmel Studio will be updated to reflect the status of the ongoing debug session.

Figure 3

If the build fails due to an error in the code, an error list will be presented. Double-clicking on an entry will open the file containing the problematic code and position the cursor at, or close to the relevant line of code. After the errors have been corrected, the debug session can be started again by clicking the Start Debugging button.


Verify Operation

Push SW0 on the ATtiny 817 Xplained Pro kit and verify that LED0 changes state.


Code has now been written to make the LED change state when the button is pressed, it has been compiled, and the setup has been verified.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.