Note: For detailed information about the kit such as headers and connections, refer to ATmega324PB
Xplained Pro User Guide.
1.4. Atmel Studio
1.4.1. Atmel Studio Webpage
The Atmel Studio installer (free IDE) is available at:
http://www.atmel.com/tools/ATMELSTUDIO.aspx
1.4.2. Atmel Studio Microsite
To learn more about Atmel Studio, refer to the following microsite:
http://www.atmel.com/microsite/atmel-studio/
Figure 1-3. Atmel Studio Microsite Webpage
In the Videos tab the getting started videos such as creating a new C (GCC) project, debugging AVR
applications, debugging ARM® applications, etc. are available.
2. Creating an Example Application in Atmel Studio
1.After connecting the board, to create a new project in Atmel Studio, go to File > New > Project.
Figure 2-1. Creating New Project in Atmel Studio
2.In the New Project wizard displayed, select the GCC C executable Project template, name the
project, and click OK to get the Device Selection wizard.
Figure 2-2. New Project Wizard
3.The Device Selection wizard appears as shown in the following image. Select the ATmega324PB
device from megaAVR® device family and click OK.
Figure 2-3. Device Selection Wizard
4.The new project and the main.c file will be created as follows.
Atmel AT06621: Getting Started with Atmel ATmega324PB [APPLICATION NOTE]
5.Add the following code snippet (LED control using push button) in the main.c file.
int main(void)
{
/* enable the pull-up function */
MCUCR &= ~(1<<PUD);
/* enable pull-up for button */
PORTC |= 1<<PORTC6;
/* configure LED pin as output */
DDRC |= 1<<DDRC7;
while(1)
{
/* check the button status (press - 0 , release - 1 ) */if(!(PINC & (1<<PINC6)))
{
/*switch on the LED until button is pressed */
PORTC &= ~(1<<PORTC7);
}
else
{
/* switch off the LED if button is released*/
PORTC |= 1<<PORTC7;
}
}
}
6.Code explanation:
–Each PORT has three registers DDRx, PORTx, and PINx
–The DDRx register is used to configure the port pin direction. 1 - Output; 0 - Input
–ATmega324PB Xplained Pro kit does not have pull-ups connected and hence internal pull-up
have to be for the button. Set the MCUCR > PUD bit as logic zero to enable pull-up.
–When a pin is configured as input and the respective bit in PORTx is written logic one, the
respective pin is internally pulled up
–The PINx register is used to return the logic level available on the port pin
Atmel AT06621: Getting Started with Atmel ATmega324PB [APPLICATION NOTE]
Atmel®, Atmel logo and combinations thereof, Enabling Unlimited Possibilities®, AVR®, AVR Freaks®, megaAVR®, QTouch®, and others are registered trademarks or
trademarks of Atmel Corporation in U.S. and other countries. ARM® is a registered trademark of ARM Ltd. Windows®is a registered trademark of Microsoft
Corporation in U.S. and or other countries. Other terms and product names may be trademarks of others.
DISCLAIMER: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any
intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND
CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED
OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS
INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED
OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this
document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to
update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive
applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.
SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with any
applications where the failure of such products would reasonably be expected to result in significant personal injury or death (“Safety-Critical Applications”) without
an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the
operation of nuclear facilities and weapons systems. Atmel products are not designed nor intended for use in military or aerospace applications or environments
unless specifically designated by Atmel as military-grade. Atmel products are not designed nor intended for use in automotive applications unless specifically
designated by Atmel as automotive-grade.
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.