Path: Home => english => Assembler intro => tools

Tools for AVR assembly programing

This page introduces the first steps for programming in assembler using the STK500 board and the ATMEL-Studio 3 (version 3.52). This version of the studio includes all necessary steps for writing and programming software for the AVR devices. The following steps are shown:
  1. editing a source file,
  2. assemble the source file, and
  3. the simulator.
The necessary software tools are distributed on ATMEL's webpage. Tools are © ATMEL.Different versions of the studio might look different to the ones shown here. This is not a handbook, it is just a short introduction for the start. Installation of the studio software is not shown here. After starting Studio you should see the following picture:
Studio 352 of ATMEL



To the top of this page

The editor

An assembler program is a simple text file. In order to include different informations other than source informations the studio defines a project. We start with creating a new project. We have to define a name for the project, its location and the assembler we would like to assemble our source code with.
Defining a new project

This opens a new project view.
New projekt view

By clicking the right button of the mouse while we are over the assembler files section we can select to create a new source file.
New assembler file

Within the editor window we type in our source code. This one just turns lamps on port B on and off.
Entering source code

Note that the studio recognizes commands (like LDI) only if you type them in small letters (who invented that?). Labels and defined constants are not recognized, even if defined properly (Tan's editor is still better than ATMEL's). Also note that the position of the include-files has been changed in this version.

To the top of this page

Assembling the source files

After typing in we assemble the program. In the project window we click on the right mouse button ans select assemble. The result is that a new message window opens.
Result of assembling

If you get error messages here you have to debug the source code.

The program is ready now for download into the AVR chip, which is not described here further.

To the top of this page

Simulating program execution

If serious bugs have to be found or more complex routines have to be tested you can simulate program execution.
In that case we select build and run. In the source code a yellow marker points to the next line of code to be executed next.
Simulation start

The key F11 steps through the source code and executes the next command. In order to see what is going on in the register section we first open a register view window. The LDI instruction loads hex-FF to the register R16.
Register view after first command

The next command writes to the data direction register of port B. We can open a view window of the ports to see what is going on. The following is happening when we execute the OUT command to DDRB.
Port view

After execution of the second OUT command (hex-AA to port B) we see the change in the port's data register.
Port view

Studio has a lot more opportunities build in for other purposes that can't be discussed here in detail. So try out the other ones.

To the top of this page

©2002 by http://www.avr-asm-tutorial.net