0% found this document useful (0 votes)
601 views

Programming Arduino Using Atmel Studio 6

This document discusses programming Arduinos using Atmel Studio 6 instead of the Arduino IDE. Atmel Studio 6 provides better performance than the Arduino IDE. The document outlines how to set up Atmel Studio 6 with a USBASP programmer to program an Arduino Uno. It provides an example blink code and instructions to compile and upload the code to the Arduino using Atmel Studio 6 and the USBASP programmer.

Uploaded by

Carlos Ferraris
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
601 views

Programming Arduino Using Atmel Studio 6

This document discusses programming Arduinos using Atmel Studio 6 instead of the Arduino IDE. Atmel Studio 6 provides better performance than the Arduino IDE. The document outlines how to set up Atmel Studio 6 with a USBASP programmer to program an Arduino Uno. It provides an example blink code and instructions to compile and upload the code to the Arduino using Atmel Studio 6 and the USBASP programmer.

Uploaded by

Carlos Ferraris
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

waihung.

ne t

http://waihung.net/pro gramming-arduino -using-atmel-studio -6/

Programming Arduino using Atmel Studio 6


Arduinos are based on Atmel microcontrollers, and they can be programmed using Atmels native IDE Atmel Studio 6. T he main reason to use Atmel Studio 6 instead of Arduino IDE is because it provides better perf ormance, Arduino IDE might be easy to use but it is slow because of inef f icient compilation. It takes more cycles to execute an instruction written in Arduino IDE. In this article, Ill be using a USBASP programmer, a custom low cost programmer made to program Atmels microcontrollers.

With it, youll need a command line tool called AVRDUDE which can be downloaded here.

Next, download Atmel Studio 6 here and install it.

Bef ore starting, youll need to add the USBASP programmer into Atmel Studio. Go to Tools > External Tools

Add a new tool and name it USBasp. Follow the conf iguration shown.

Arguments : -c usbasp -p m328p -F -U f lash:w:$(ProjectDir)Debug\$(ItemFileName).hex:i

m328p ref ers to AT mega328P, if youre programming another MCU, change it accordingly. Lets create a new project to test it out. Select GCC C Executable Project and give the project a name.

Next, select your MCU. Since Im using an Arduino Uno, itll be AT mega328P.

A project will be generated and you can use the code below in the main c f ile.

// Example Blink code // by Siew Wai Hung // ht t p://waihung.net # dene F_CPU 16000000L // Specify MCU speed so t hat delay is correct #include <avr/io.h>; #include <ut il/delay.h>; int main(void) { DDRB = 0b00100000; // set bit 5 high t o set PORTB,5 as out put // PORTB,5 is Digit al Pin 13 on t he Arduino while(1) { PORTB = 0b00100000; // set bit 5 high t o t urn on pin _delay_ms(500); PORTB = 0b00000000; // set bit 5 low t o t urn o pin _delay_ms(500); } } //

Click on Build > Build Solution to compile. Upon successf ul compilation, proceed to upload the code by going to Tools > USBasp

T he LED on the Arduino should blink if everything goes as planned.

You might also like