Position: Index > Unclassified >

Using VMLAB as virtual oscilloscope

2017-12-23 21:18  
Declaration:We aim to transmit more information by carrying articles . We will delete it soon, if we are involved in the problems of article content ,copyright or other problems.

VMLAB is one of well known simulators. This is software simulator of AVR and ST62 microcontrollers. You may download free version of it from http://www.amctools.com. The simulation is far away from real time, but All timings are tied to real world values.

VMLAB is designed to work as project. This is a special language (script like), where circuit is described – where are connections between hardware and microcontroller defined. Few prebuilt examples you may find in folders C:\VMLAB\AVR_demo and C:\VMLAB\ WinAVRdemo (If your installation is in C:\VMLAB\ folder).

VMLAB is rich in its hardware support: Resistor, Grounded capacitor, Interactive switch / key, LED diode, 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 4×4 Multiprocess-dedicated: External Input, External Output. So you can do wide range of simulations. VMLAB also has a powerful scope where you can watch voltages on pins or even some internal microcontroller resistor values like ACO, TIMOVF signals.

Let’s make simple project using VMLAB tool.

Start VMLAB And create new project by selecting Project-New.


Select project properties like project location, c file name, microcontroller type, software toolchain (WINAVR) and make file generation.

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

.MICRO “ATmega128″




.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 main.c file window opened with some example code.

Lets simulate two blinking LEDs on Atmega128. Leds are connected to pins PD0 and PD7 through current limiting 620Ohm resistors:


Firs we should set up the circuit in project file. Also we will define signals we will view in scope.

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


R1 D1_NODE PD0 0.62K


R2 D2_NODE PD7 0.62K

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


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


Then build the code. If there are errors then correct them. If everything is all right you should get message:


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


There you see the main peripherals. Diodes D1..8, three sliders (potentiometers), keypad and microcontroller settings: speed (you may slow down you code), temperature and clock speed. And also there is simulated current source requirement of MCU.

In our project we need only diodes D1 and D2.

Also open a scope window from View-Scope menu.

Simulation can be controlled using 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:


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


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

Good luck!

Reprinted Url Of This Article: