Professional Documents
Culture Documents
Workshop Manual
Workshop Manual
Atmel currently provides AVR microcontrollers in many shapes and sizes, ranging from small 8-pin tinys to
100-pin xmegas. Flash memory sizes for program code range from 1 kilobyte to 256 kilobytes. You can find
more information and a list of devices on the Atmel Website
For this basic tutorial on how to get started with AVR-microcontrollers we are using an ATmega16 (full
datasheet can be found on Atmel Website), which has 16 kilobytes of flash and lots of general input/output-
pins. Every pin can be programmed individually as an input (digital or analog) or output (digital only) pin. We
will go step by step on what hardware and software do you need and after that some example programs.
The hardware part will include using any ATmeg16 Development board and the programming cable, which is
needed to get the compiled program from the computer to the chip. The software part then guides you
what you need in order to make your program code and to transfer the ready compiled binary code to your
board.
You will need some basic knowledge about electronics (how to connect leds etc) and it is good to read some
basic Electronics tutorials if all of this is new to you. There are example programs written in C later in the
article so some knowledge in programming isn't bad either.
o WinAVR - A software package that includes avr-gcc that makes it possible to write the programs in C
language and compile them for the AVR.
o Atmel's AVR Studio - Integrated Development Environment (IDE) for AVR microcontrollers helps you
to manage your projects etc. Downloading requires FREE registration.
o PonyProg - Simple yet powerful programmer that we need to get the compiled program to the AVR
chip through the parallel/serial programming cable as there isn't straight support for it in the AVR
Studio.
Installation
First one is WinAVR, the installation is quite straight forward, just read what it says and click next. The best
option is to leave everything to their defaults. Next install AVR Studio, again leave everything to their
defaults and everything should go well. Nothing special with PonyProg either, just unzip the package and run
setup.exe and follow the instructions.
You now have all the necessary programs installed and you'll find them from your program menu. Continue
to the next step.
Coding and Compiling
After you've installed all the programs successfully, start AVR Studio and you should see a welcome screen.
There is a button "New Project", click it. New project can be started from the Project menu too.
In the following pages on this article you'll find some example codes that you can use to test your circuit.
Let's copy & paste the first example code into the middle window.
Remember to save your project now. Navigate to Build menu and click Build (or hit F7 on your keyboard) and
if all goes well, no errors should be there and you'll see a text like this in the message window.
PonyProg
Select File -> Open device file (or click the yellow folder icon). Navigate to your project directory and there
you'll find a directory named "default". From there choose the "project_name.hex", in this case
"test_project.hex". This file contains the compiled program in a form the chip understands.
Click on the yellow arrow on the second line of icons, this will start the programming cycle. Let the program
do its work and if you've done everything right you should get the following message that the programming
has succeeded and the led should be flashing happily on the board. If there are some errors, check and
double check all your connections!
/****************
#include <stdio.h>
int main(void)
{
printf(“Hello world!\n”);
return 0;
}
/****************
This is a very basic C program, but it contains all necessary elements of it. Let’s examine a little bit what we
have written here...
#include <stdio.h> - is a preprocessor command. All preprocessor commands are identified by # sign at the
beginning of the line. #include command tells preprocessor to open file stdio.h and from it necessary stored
parts while compiling program. The file name is surrounded by brackets “<>”. Bracket marks“<>” tels the
preprocessor to search for the file in the region defined by Operating System variables (for instance “path”
variabel in Environment variables). If double quotes are used instead of bracket marks then file searching is
done only in default directory of project.
Next line is int main(void). It is always necessary to define the type of function return type and of course
function has arguments. The type int is showing that main function returns an integer and no arguments to
the function is needed.
Opening brace “{” indicates the beginning of the block of sentences. One of those sentences is printf(). This
function is taken from stdio.h library and writes a message to computer terminal (this case screen).
Return 0 is returning parameter to the function. And every function should end with closing brace “}”.
“/*” is commenting the line. This means that line marked with “/*”is not included in compilation.
Block Diagram of CC2500 Module
Before we start you have to remember that this module will give you RS output and not TTL output.
The RF module contains on board TTL to RS Level converter so that you can easily interface your module to
your PC through serial port.
Here is a block diagram of module
As you can see from block diagram RF module has 1 micro controller, which is actually working of the heart
of module. This micro controller will read the user settings and transmit or receive data according to
settings.
RF module has on board EEPROM which actually stores user settings that is channel number, device ID and
baud rate etc.
CC2500 Module is wireless transceiver with antenna.
Mode selectional module is combination of jumpers and LED, which helps users to set the mode of module.
And last but not least,
RS to TTL and TTL to RS level converter which will allow your module to directly interfaced with PC.
Remember 1 thing this module gives you RS output
Nexus
Nexus is the first step to enter the World Challenge. With a win in this competition, you get a direct entry to
the Indian Leg finals of the Mars Manoeuvre. Here, the best of India will compete to become the National
Champions who will then fight with the International winners for the glory of being crowned as "World
Champions: The Ultimate Conquerors" in iNexus.
This year Nexus will be held at five strategic centres, spanning throughout the country's length and breadth.
Central Zone: Medi-Caps Institute of Technology and Management, Indore (26th September, 2010)
South Zone: Model Engineering College, Kochi (26th September, 2010)
North Zone: Thapar University, Patiala (3rd October, 2010)
East Zone: Kalinga Institute of Industrial Technology, Bhubaneswar (3rd October, 2010)
West Zone: Indian Institute of Technology Bombay, Mumbai (10th October, 2010)
Mars Manoeuvre