Main Menu
Home
AVR News
Atmel AVR
AVR Development Tools
Valuable Tools
WinAVR toolset
Makefile for WinAVR
AVR Virtual Simulators
Hardware for prototyping
GCC and AVR-GCC
Short introduction to C
AVR-GCC Tutorial
Example AVR Projects
AVR-GCC articles
WinAVR Site Map
Scienceprog FORUM
ScienceProg BLOG
Disclaimer
WinARM Tutorial
Latest comments
Measuring motor speed and...
Dear Administrator The code above...
More...

Programming AVR ADC module...
hi please send me example usart with...
More...

Measuring motor speed and...
main.c: In function...
More...

Running TX433 and RX433 RF...
(Hopefully this is not a re-post). I am...
More...

Running TX433 and RX433 RF...
I just bnought a pair of the RX/TX 433...
More...

Friendly sites

Recommended sites


VMLAB is free virtual oscilloscope for AVR PDF Print E-mail
Written by Administrator   
Thursday, 05 October 2006
Last Updated ( Thursday, 05 October 2006 )

VMLAB is one of well known free simulators that support AVR microcontrollers. You may get free version of VMLAB tools from amctools. The simulation is done not in real time as computer resources wouldn’t allow this, but all timings of processes viewed in virtual oscilloscope are tied to real world values.

VMLAB is a project workspace where special scripting language describes the initial conditionas and circuit showing to virtual simulator connections between hardware and microcontroller. Few pre-built examples you may find in folders C:\VMLAB\AVR_demo and C:\VMLAB\ WinAVRdemo (for default installation in C:\VMLAB\ folder).

VMLAB quite rich in its hardware support: Resistors, Grounded capacitors, Interactive switches / keys, LED diodes, Pulsed voltage source, Sine wave voltage source, Slider dependent voltage source (interactive), Non-ruturn-to-zero (NRZ) generator (interactive), Operational amplifier, Comparator, 2 inputs NAND gate, 8 bits D to A converter, RS232 based TTY (interactive), LCD module, I2C monitor (interactive), Interactive keypad 4x4 Multiprocess-dedicated: External Input, External Output. Actually you can do a wide range of simulations with your virtual embedded system before taking it to the real world. VMLAB also has a powerful scope feature where you can view voltages on pins or even some internal microcontroller register values like ACO, TIMOVF.

Following example will show how to make simple project using VMLAB tool.

Create new project by selecting Project-New.

Image

 

Select project properties: project location, c file name, microcontroller, software tool-chain (WINAVR) for compiling and make file generation (automatic or define yours).

Press OK and you are transferred to project area, where you will find project file with selected properties:

.MICRO "ATmega128"

.TOOLCHAIN "GCC"

.GCCPATH   "C:\WinAVR"

.GCCMAKE   AUTO

.TARGET    "leds.hex"

.SOURCE    "leds.c"

.TRACE              ; Activate micro trace

.POWER VDD=5 VSS=0  ; Power nodes

.CLOCK 1meg         ; Micro clock

.STORE 250m         ; Trace (micro+signals) storage time

 

Also there is leds.c file window opened with some example code.

Let’s simulate two blinking LED diodes on Atmega128. Connect them to pins PD0 and PD7 using current limiting 620Ohm resistors:

Image

 

Set up the circuit connections in project file by adding script. Also let’s define signals we want to see in scope.

Connect diodes and resistors by writing four lines in project file:

D1 VDD D1_NODE

R1 D1_NODE PD0 0.62K

D2 VDD D2_NODE

R2 D2_NODE PD7 0.62K

After circuit is set up, then we can setup scope:

.PLOT V(PD0) V(PD7)

After project file is set up, then we need to write simple program:

 Image

 

Build the code. If there are errors then correct them according to messages. If everything is all right you should get message:

Image

 

Now it’s time to run simulator. Open control panel

Vmlab control panel

 

There you see the main peripherals. Diodes D1..8, three sliders (potentiometers), keypad and microcontroller settings: speed (you can slow down you code), temperature and clock speed.

In our project we need only diodes D1 and D2.

Open scope windows from View-Scope menu to be able visually see the signals on microcontroller pins.

 

Simulation is controlled using toolbar:

 vmlab toolbar

 

You may run your code continuously, step over, step in and out and animate (slow performance). Press GO/Continue button. In scope window you can see how signals are changing in microcontroller pins:

 vmlab scope

 

And in control panel you can see how Diodes D1 and D2 blink:

Vmlab animation

 

If simulation results are OK you may burn the code in to real chip.

 


   

Users' Comments  
 

Average user rating

 


Add your comment
Only registered users can comment an article. Please login or register.

No comment posted



mXcomment 1.0.6 © 2007-2008 - visualclinic.fr
License Creative Commons - Some rights reserved

© 2008 WinAVR AVR-GCC Tutorial
Joomla! is Free Software released under the GNU/GPL License.