SlideShare a Scribd company logo
Sepehr Naimi
BIHE University
4/14/2015
Using Arduino Boards in Atmel Studio
Contents
Introduction............................................................................................................................ 3
Installing Atmel Studio and Making the First Project.................................................................... 3
Downloading Avrdude.............................................................................................................. 3
Checking COM Port.................................................................................................................. 4
Opening the Atmel Studio and using avrdude ............................................................................. 5
Making a Project ..................................................................................................................... 7
Programming the Arduino Board............................................................................................... 9
The IC pins.............................................................................................................................10
References ............................................................................................................................10
Introduction
There are varieties of hardware tools to program Atmel microcontrollers. But if the chips have
bootloaders, they can be programmed using serial ports without needing to use any hardware tools.
Bootloader is small software which gets the program through the serial port and programs the IC
chip.
The microcontrollers of Arduino boards have boot loaders. As a result you can connect them to the
PC and use them as an AVR trainer board. The document teaches you to use Arduino Trainer boards
in Atmel Studio.
You can also burn the boot loader on a new chip and make your own trainer board. But to program
the boot loader onto the new chip you need a programmer.
Installing Atmel Studio and Making the First Project
To install Atmel Studio and make the first project, read one of the following documents:
Assembly Programming in Atmel Studio 6.2 (Step by step tutorial)
C Programming in Atmel Studio 6.2 (Step by step tutorial)
Downloading Avrdude
1. To program Arduino boards you need Avrdude. Download Avrdude from the following
website:
http://mirror.rackdc.com/savannah//avrdude/avrdude-5.11-Patch7610-win32.zip
2. Unzip the downloaded file, rename the directory to avrdude, and copy it into your C drive.
Note
If you already have the Arduino IDE on your PC, the avrdude.exe file is located in
C:Program Files (x86)Arduinohardwaretoolsavrbinavrdude.exe
and avrdude.conf is in
C:Program Files (x86)Arduinohardwaretoolsavretcavrdude.conf
Checking COM Port
1. Right click on the Computer icon and choose Manage.
2. Click on Device Manager and then Ports (COM & LPT). Check the COM port.
Opening the Atmel Studio and using avrdude
3. Open the Atmel Studio IDE.
4. Go to the Tools menu and choose External Tools… .
5. In the External Tools dialog:
a. Press the Add button
b. Name it Arduino Programmer.
c. Type the following address next to the Command:
C:avrdudeavrdude.exe
d. Avrdude needs the following arguments: avrdude.conf file, the COM port, the serial
baud rate, the hex file to be programmed and the microcontroller part number. The
following table gives the arguments for different Arduino board. They should be
typed in the Arguments textbox:
Board IC Chip Arguments
Arduino Uno Atmega328p -C "C:avrdudeavrdude.conf" -p atmega328p -c arduino -P COM9 -b 115200 -U
flash:w:"$(ProjectDir)Debug$(ItemFileName).hex":i
Arduino Pro
Mini
Atmega328p -C " C:avrdudeavrdude.conf" -p atmega328p -c arduino -P COM9 -b 57600 -U
flash:w:"$(ProjectDir)Debug$(ItemFileName).hex":i
Arduino
Mega2560
Atmega2560 -C " C:avrdudeavrdude.conf" -p atmega2560 -c wiring -P COM9 -b 115200 -U
flash:w:"$(ProjectDir)Debug$(ItemFileName).hex":i
Note: Change the COM port and the location of avrdude.conf, according to your computer.
e. Tick "Use Output window".
f. Press OK.
6. Go to the Tools menu again. Arduino Programmer should be added to the Tools menu.
Making a Project
7. Go to the File menu. Click on New and then Project.
8. Choose GCC C Executable Project and name the project as toggleProject. Then press OK.
9. Choose ATmega328 from the list and press OK.
10. Type the following program.
/*
* toggleProgram.c
*
* This program toggles ports B, C, and D.
*
* Created: 4/3/2015 4:43:51 PM
* Author: Naimi
*/
#include <avr/io.h>
#define F_CPU 16000000UL
#include "util/delay.h"
int main(void)
{
DDRB = 0xFF;
DDRC = 0xFF;
while(1) //loop forever
{
PORTB ^= 0xFF; //toggle port B
PORTC ^= 0xFF; //toggle port C
_delay_ms(1000); //wait 1 second
}
}
Programming the Arduino Board
11. Connect your Arduino board to the PC.
12. Go to the Tools menu, and click on Arduino Programmer. The following texts appear in the
Output window and the L LED starts blinking on the board.
The IC pins
The following picture shows the Arduino UNO board together with the Atmega328 pins.
Label Port
A0 PC0(ADC0)
A1 PC1(ADC1)
A2 PC2(ADC2)
A3 PC3(ADC3)
A4 PC4(ADC4)
A5 PC5(ADC5)
Label Port
SCL PC5(ADC5/SCL)
SDA PC4(ADC4/SDA)
AREF AREF
GND GND
13 PB5(SCK)
12 PB4(MISO)
11 PB3(MOSI)
10 PB2(OC1B)
9 PB1(OC1A)
8 PB0
7 PD7
6 PD6
5 PD5
4 PD4
3 PD3(INT1)
2 PD2(INT0)
1 PD1(TXD)
0 PD0(RXD)
References
http://www.atmel.com/
http://www.nongnu.org/avrdude/
http://www.jayconsystems.com/tutorial/atmerpt1/

More Related Content

PDF
Start with arduino
PDF
introductiontoarduino-111120102058-phpapp02.pdf
DOCX
notes about Arduino
PPTX
Introduction to the Arduino
PPS
What is Arduino ?
PDF
Intro to arduino
PPT
Arduino Platform with C programming.
PPTX
Micro_Controllers_lab1_Intro_to_Arduino.pptx
Start with arduino
introductiontoarduino-111120102058-phpapp02.pdf
notes about Arduino
Introduction to the Arduino
What is Arduino ?
Intro to arduino
Arduino Platform with C programming.
Micro_Controllers_lab1_Intro_to_Arduino.pptx

Similar to Microcontroladores: Uso de placas Arduino en Atmel Studio (20)

PPSX
Arduino by yogesh t s'
PDF
Getting Started With Arduino_Tutorial
PPTX
By Asst.Prof.D.R.Bhise Electrical Engineering Department Matoshri College of...
PDF
Arduino Labs Introduction
PDF
Arduino guide
PDF
Mechanical engineering jntuk r-23inernet
PPTX
ARDUINO OVERVIEW HARDWARE SOFTWARE AND INSTALLATION.pptx
PDF
Indroduction arduino
PDF
Indroduction the arduino
PPT
Arduino_Code.ppt
DOCX
Arduino Full Tutorial
PDF
ARDUINO OVERVIEW HARDWARE SOFTWARE AND INSTALLATION.pdf
PPTX
An Introduction To Arduino.pptx
PPTX
Lecture 7
PDF
aurduino-200107075953.pdf
PPTX
Arduino: On-board components description, IDE and Programming
PPTX
arduino and its introduction deep dive ppt.pptx
PPTX
Arduino
PPT
arudino introction and types of boards main aruduni uno
Arduino by yogesh t s'
Getting Started With Arduino_Tutorial
By Asst.Prof.D.R.Bhise Electrical Engineering Department Matoshri College of...
Arduino Labs Introduction
Arduino guide
Mechanical engineering jntuk r-23inernet
ARDUINO OVERVIEW HARDWARE SOFTWARE AND INSTALLATION.pptx
Indroduction arduino
Indroduction the arduino
Arduino_Code.ppt
Arduino Full Tutorial
ARDUINO OVERVIEW HARDWARE SOFTWARE AND INSTALLATION.pdf
An Introduction To Arduino.pptx
Lecture 7
aurduino-200107075953.pdf
Arduino: On-board components description, IDE and Programming
arduino and its introduction deep dive ppt.pptx
Arduino
arudino introction and types of boards main aruduni uno
Ad

More from SANTIAGO PABLO ALBERTO (20)

PDF
Electroneumatica con circuitos secueciales con logica cableada
PDF
Arduino Blocks: Programacion visual con bloques para arduino 2 Edicion por Ju...
PDF
Principios de electrónica 7 Edicion por Albert Malvino y David J. Bates
PDF
Principios digitales por Roger L. Tokheim
PDF
Solicitud de empleo para el trabajo para
DOCX
secuencia electroneumática parte 1
DOCX
secuencia electroneumática parte 2
PDF
Manual de teoría y practica electroneumática avanzada
PDF
Programacion de PLC basado en Rslogix 500 por Roni Domínguez
PDF
Programación de microcontroladores PIC en C con Fabio Pereira
PDF
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
PDF
Arduino: Arduino de cero a experto
PDF
PDF
Manual básico PLC OMRON
PDF
Programación de autómatas PLC OMRON CJ/CP1
PDF
Manual del sistema del controlador programable S7-200 SMART
PDF
Catálogo de PLC S7-200 SMART
PDF
PLC: Automatismos industriales
PDF
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
Electroneumatica con circuitos secueciales con logica cableada
Arduino Blocks: Programacion visual con bloques para arduino 2 Edicion por Ju...
Principios de electrónica 7 Edicion por Albert Malvino y David J. Bates
Principios digitales por Roger L. Tokheim
Solicitud de empleo para el trabajo para
secuencia electroneumática parte 1
secuencia electroneumática parte 2
Manual de teoría y practica electroneumática avanzada
Programacion de PLC basado en Rslogix 500 por Roni Domínguez
Programación de microcontroladores PIC en C con Fabio Pereira
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
Arduino: Arduino de cero a experto
Manual básico PLC OMRON
Programación de autómatas PLC OMRON CJ/CP1
Manual del sistema del controlador programable S7-200 SMART
Catálogo de PLC S7-200 SMART
PLC: Automatismos industriales
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
Ad

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Current and future trends in Computer Vision.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPT
Project quality management in manufacturing
PDF
Well-logging-methods_new................
PDF
PPT on Performance Review to get promotions
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
web development for engineering and engineering
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Digital Logic Computer Design lecture notes
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPT
introduction to datamining and warehousing
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
R24 SURVEYING LAB MANUAL for civil enggi
Internet of Things (IOT) - A guide to understanding
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Current and future trends in Computer Vision.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Project quality management in manufacturing
Well-logging-methods_new................
PPT on Performance Review to get promotions
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
web development for engineering and engineering
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Digital Logic Computer Design lecture notes
Foundation to blockchain - A guide to Blockchain Tech
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
introduction to datamining and warehousing
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Model Code of Practice - Construction Work - 21102022 .pdf
Operating System & Kernel Study Guide-1 - converted.pdf

Microcontroladores: Uso de placas Arduino en Atmel Studio

  • 1. Sepehr Naimi BIHE University 4/14/2015 Using Arduino Boards in Atmel Studio
  • 2. Contents Introduction............................................................................................................................ 3 Installing Atmel Studio and Making the First Project.................................................................... 3 Downloading Avrdude.............................................................................................................. 3 Checking COM Port.................................................................................................................. 4 Opening the Atmel Studio and using avrdude ............................................................................. 5 Making a Project ..................................................................................................................... 7 Programming the Arduino Board............................................................................................... 9 The IC pins.............................................................................................................................10 References ............................................................................................................................10
  • 3. Introduction There are varieties of hardware tools to program Atmel microcontrollers. But if the chips have bootloaders, they can be programmed using serial ports without needing to use any hardware tools. Bootloader is small software which gets the program through the serial port and programs the IC chip. The microcontrollers of Arduino boards have boot loaders. As a result you can connect them to the PC and use them as an AVR trainer board. The document teaches you to use Arduino Trainer boards in Atmel Studio. You can also burn the boot loader on a new chip and make your own trainer board. But to program the boot loader onto the new chip you need a programmer. Installing Atmel Studio and Making the First Project To install Atmel Studio and make the first project, read one of the following documents: Assembly Programming in Atmel Studio 6.2 (Step by step tutorial) C Programming in Atmel Studio 6.2 (Step by step tutorial) Downloading Avrdude 1. To program Arduino boards you need Avrdude. Download Avrdude from the following website: http://mirror.rackdc.com/savannah//avrdude/avrdude-5.11-Patch7610-win32.zip 2. Unzip the downloaded file, rename the directory to avrdude, and copy it into your C drive. Note If you already have the Arduino IDE on your PC, the avrdude.exe file is located in C:Program Files (x86)Arduinohardwaretoolsavrbinavrdude.exe and avrdude.conf is in C:Program Files (x86)Arduinohardwaretoolsavretcavrdude.conf
  • 4. Checking COM Port 1. Right click on the Computer icon and choose Manage. 2. Click on Device Manager and then Ports (COM & LPT). Check the COM port.
  • 5. Opening the Atmel Studio and using avrdude 3. Open the Atmel Studio IDE. 4. Go to the Tools menu and choose External Tools… . 5. In the External Tools dialog: a. Press the Add button b. Name it Arduino Programmer. c. Type the following address next to the Command: C:avrdudeavrdude.exe d. Avrdude needs the following arguments: avrdude.conf file, the COM port, the serial baud rate, the hex file to be programmed and the microcontroller part number. The following table gives the arguments for different Arduino board. They should be typed in the Arguments textbox: Board IC Chip Arguments Arduino Uno Atmega328p -C "C:avrdudeavrdude.conf" -p atmega328p -c arduino -P COM9 -b 115200 -U flash:w:"$(ProjectDir)Debug$(ItemFileName).hex":i Arduino Pro Mini Atmega328p -C " C:avrdudeavrdude.conf" -p atmega328p -c arduino -P COM9 -b 57600 -U flash:w:"$(ProjectDir)Debug$(ItemFileName).hex":i Arduino Mega2560 Atmega2560 -C " C:avrdudeavrdude.conf" -p atmega2560 -c wiring -P COM9 -b 115200 -U flash:w:"$(ProjectDir)Debug$(ItemFileName).hex":i Note: Change the COM port and the location of avrdude.conf, according to your computer. e. Tick "Use Output window". f. Press OK.
  • 6. 6. Go to the Tools menu again. Arduino Programmer should be added to the Tools menu.
  • 7. Making a Project 7. Go to the File menu. Click on New and then Project. 8. Choose GCC C Executable Project and name the project as toggleProject. Then press OK.
  • 8. 9. Choose ATmega328 from the list and press OK. 10. Type the following program. /* * toggleProgram.c * * This program toggles ports B, C, and D. * * Created: 4/3/2015 4:43:51 PM * Author: Naimi */ #include <avr/io.h> #define F_CPU 16000000UL #include "util/delay.h" int main(void) { DDRB = 0xFF; DDRC = 0xFF; while(1) //loop forever { PORTB ^= 0xFF; //toggle port B PORTC ^= 0xFF; //toggle port C _delay_ms(1000); //wait 1 second } }
  • 9. Programming the Arduino Board 11. Connect your Arduino board to the PC. 12. Go to the Tools menu, and click on Arduino Programmer. The following texts appear in the Output window and the L LED starts blinking on the board.
  • 10. The IC pins The following picture shows the Arduino UNO board together with the Atmega328 pins. Label Port A0 PC0(ADC0) A1 PC1(ADC1) A2 PC2(ADC2) A3 PC3(ADC3) A4 PC4(ADC4) A5 PC5(ADC5) Label Port SCL PC5(ADC5/SCL) SDA PC4(ADC4/SDA) AREF AREF GND GND 13 PB5(SCK) 12 PB4(MISO) 11 PB3(MOSI) 10 PB2(OC1B) 9 PB1(OC1A) 8 PB0 7 PD7 6 PD6 5 PD5 4 PD4 3 PD3(INT1) 2 PD2(INT0) 1 PD1(TXD) 0 PD0(RXD) References http://www.atmel.com/ http://www.nongnu.org/avrdude/ http://www.jayconsystems.com/tutorial/atmerpt1/