Beruflich Dokumente
Kultur Dokumente
3 Users Guide
Page 1 of 24
Page 2 of 24
Thank you for purchasing our AVR development board. Trademarks All brand and product names mentioned herein are trademarks, services marks, registered trademarks, or registered service marks of their respective owners and should be treated as such.
Table of contents
Topic Page No. 1. Introduction to AVR Development Board. 3 2. Introduction to AVR Microcontroller Series. 4 3. Introduction to AVR Tool Chain 8 4. Software Installation....10 5. Getting Started.11 6. LED Interfacing21 7. Precautions24
Page 3 of 24
Section 1
Page 4 of 24
So one can say the AVR development board is the perfect circuit to design, make and test very interesting and innovative projects
Section 2
Page 5 of 24
Power supply
Regulator
BUZZER
Relay Driver RESET Program button Port A Port B LCD Port D Port C Serial connector Motor controller
Microcon troller
4x4 Keyboard
Switch Array
LED Array
Page 6 of 24
The polarity of the RESET line was opposite (AVR's having an active-high RESET, while the AVR has an active-low RESET), but other than that, the pinout was identical. The AVR is a modified Harvard architecture machine where program and data is stored in separate physical memory systems that appear in different address spaces, but having the ability to read data items from program memory using special instructions. Basic families AVRs are generally classified into five broad groups:
4256 kB program memory 28100-pin package Extended instruction set (Multiply instructions and instructions for handling larger program memories)
16384 kB program memory 4464100-pin package (A4, A3, A1) Extended performance features, such as DMA, "Event System", and cryptography support.
Page 7 of 24
Application-specific AVR
o
megaAVRs with special features not found on the other members of the AVR family, such as LCD controller, USB controller, advanced PWM, CAN etc.
FPGA 5K to 40K gates SRAM for the AVR program code, unlike all other AVRs AVR core can run at up to 50 MHz
32-bit AVRs
In 2006 Atmel released microcontrollers based on the new, 32-bit, AVR32 architecture. They include SIMD and DSP instructions, along with other audio and video processing features. This 32-bit family of devices is intended to compete with the ARM based processors. The instruction set is similar to other RISC cores, but is not compatible with the original AVR or any of the various ARM cores. All these microcontrollers have EEPROM, SRAM and flash memory and hence removing the need for external memory in most cases. Almost all devices (except the smallest TinyAVR chips) have serial interfaces, which can be used to connect larger serial EEPROMs or flash chips. The data is usually stored in SRAM and the program is stored in the program memory. The program memory is usually indicated in the naming of the device. For e.g. ATMEGA16 has 16K bytes of program memory and similarly ATMEGA32 has 32K bytes. Sometimes if the data is almost constant throughout the program then it can be stored in the flash memory and thus SRAM space can be saved.
Page 8 of 24
Section 3
Getting Started with AVR GCC First open Programmers Notepad and open a makefile. Edit the makefile and make changes in target, FCPU value and source files according to your requirements. After saving the makefile, open a new file and write the C program in the file and save it.
Page 9 of 24
Then click on Tools and select Make All. After that the compiler will run the C file and create .hex file in the same folder as the C file.
This is the .hex file which should be written into the microcontroller.
Installing AVR Programmer First go to AVR folder in the CD which is provider along with this manual. Go to Programmers folder and open AVR ISP Programmer. Click on the setup file and install AVR Programmer. After installation is complete, there will be a file AVR PROG on the desktop.
Getting Started with AVR PROG Double click on AVR Prog icon. A small window opens with options like Program, Read and Verify. Click on Browse and select the hex file which is to be written into the microcontroller. Then click on Program which is present below Flash and not the one which is below EEPROM. After programming close the window and run the program. Bootloaded microcontroller : If you are using a bootloaded microcontroller you can use AVR Prog or else you have to use other softwares to program. Also to put the microcontroller in programming mode, first press and hold PROG switch present on the development board and at the same time press RESET switch once and release it. After that release PROG switch.
Page 10 of 24
Section 4
Installing Softwares
Installing SDCC (Small Device C Compiler): is freeware ANSI C compiler that targets WinAVR and many more. Follow the same steps as guided in the previous section, except locate the below file Development kit/compilers/sdcc/sdcc-2.7.0-setup Installing AVR Prog is a pc tool for programming flash based Microcontroller Follow the same steps as guided in the previous section, except locate the below file Development kit/programmer/ AVRProg.exe
Section 5
Page 11 of 24
Getting started
After installing the software, to compile the program using WinAVR
software follow the below steps, figures will guide you.
Page 12 of 24
3. Write all your program in the textbox appears on the screen and save the file.
Page 13 of 24
4. After completion of the program go to Tools menu select MakeAll option. It appears process exit code: 2 on the below showed output screen.
All programs
Page 14 of 24
6. Select the microcontroller from the list of supported microcontrollers given in the compiler. Go to Makefile MCU type ATmega select your atmega type no.
7. Go to Make file
Output format
ihex
Page 15 of 24
8. Go to Makefile\Debug format\AVR COFF (AVR Studio 3.x, VMLab < 3.10 [obsolete])
Page 16 of 24
11. Select Save as and save the file in the project folder with the name Make file.
Page 17 of 24
12. Open the Make file in the compiler and make some changes as follows.
Page 18 of 24
14. TARGET= LEDinterfacing (your file name) and save the file.
15. Finally compile the program by selecting (WinAVR) Make All in the Tools menu. And it shows the Process Exit Code : 0 (on the output screen).
Page 19 of 24
16. After the compilation process Run the software AVRProg. Go to C:\Program Files\Atmel\AVR Tools\AvrProg
Page 20 of 24
18. Next click on the Flash\Program command button 19. Then press & hold the PROG button in one finger and consequently press & release the RESET button in another finger finally release the PROG button. 20. After the indication of Programming Ok on AVRProg press the RESET button to execute the system.
Page 21 of 24
Page 22 of 24
| is logic OR operator. We know that anything OR operated with 0 will retain the previous value and anything OR operated with 1 will always be 1. So by performing OR operation on DDRB bit PB0, no matter what the previous value is , it becomes 1 , thus making it an output pin. Now that the port or pin is made as output, it is time to write logic HIGH into the port and make it give a logic HIGH i.e. +5V output to glow the LED. This is also done in the same way as DDR, but the only difference is that instead of DDR we will be using PORTB. PORTB = 0xFF ; or PORTB |=_BV( PBO ) ; Thus LED is turned ON by giving logic HIGH to PORT B pin PB0 . Similarly to switch OFF LED , the PORT is still output port but logic LOW should be written into the port . So DDRB will be the same and you need not write it again. Logic LOW is written into Port B pin PB0. PORTB = 0x00 ; or PORTB &=~_BV(PB0) ; By writing 0x00 , the whole port i.e. all 8 pins will go LOW. So the second method is used. & is AND operator. We know that anything AND operated with 1 will retain the previous value and anything AND operated with 0 will always be 0. So by performing AND operation on PORT bit PB0, no matter what the previous value is , it becomes 0 , thus only pin PB0 goes low. So the LED is switched OFF by writing logic LOW into the Port. Now that we learnt how to switch ON and switch OFF a LED, lets put it in a small program such that the LED switches ON for some time an switches OFF for some time. For this we need to use delay function. By giving a certain amount of delay after switching ON the LED , the LED will remain ON for that much amount of time and then it can be switched OFF and with a delay it will remain OFF for than much amount of time. And we will include another parameter where the LED should switch ON and OFF for a certain number of times. We will make a user defined function for that with number of time , On time and OFF time as parameters.
Page 23 of 24
The program for this is given. BlinkingLED.c: Demonstration of interfacing an LED designed for AVR running at 7.3728 MHz Compile the program in WinAVR Compiler. Operation: when loading program through programmer completes, LED blinks continuously at the interval of 500ms. -----------------------------------------------------------------------------*/ //Includes Definition of AVR #include <avr/io.h> #include <util/delay.h> //Define Port/Pins #define LED_DDR #define LED_PORT #define LED_PIN
//Define Macros #define LEDOn() LED_PORT |= _BV(LED_PIN) #define LEDOff() LED_PORT &= ~_BV(LED_PIN) //MAIN Function Begins int main(void) { LED_DDR |= _BV(LED_PIN); //Initialize port direction LED_PORT &= ~_BV(LED_PIN); //Initialize port for (;;) { LEDOn(); _delay_ms(500); LEDOff(); _delay_ms(500); } return 0; } //makes LED on //delay of 1000ms //Makes LED off //delay of 1000ms
Page 24 of 24
Section 10 Precaution
Please note that the AVR Development Board come without any case/box and all components are exposed for finger touches and therefore extra attention must be paid to ESD (electrostatic discharge) precaution. Make it a habit always to first touch the metal surface of one of the USB or Ethernet connectors for a few seconds with both hands before touching any other parts of the boards. That way, you will have the same potential as the board and therefore minimize the risk for ESD. Never touch directly on the AVR Development Board. The push-buttons on the AVR Development Board have grounded shields to minimize the effect of ESD.