VMLAB is one of the well-known simulators. This is a software simulator of AVR and ST62 microcontrollers. The simulation is far away from real-time, but All timings are tied to real-world values.
VMLAB is designed to work as a project. This is a special language (script like), where the circuit is described – where are connections between hardware and microcontroller defined. You may find few prebuilt examples 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, Pulsed voltage source, Sine wave voltage source, Slider dependent voltage source (interactive), Non-return-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 a 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 makefile generation.
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 main.c file window opened with some example code.
Let’s simulate two blinking LEDs on Atmega128. LEDs are connected to pins PD0 and PD7 through current limiting 620Ohm resistors:
First, we should set up the circuit in the project file. Also, we will define signals we will view in scope.
Connect diodes and resistors by adding 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:
Then build the code. If there are errors then correct them. If everything is all right you should get the 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 your code), temperature, and clock speed. And also, there is a 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 the 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 the simulation results, you may burn the code into a real chip.
Good luck!
I’m new in VMLab, so I’m not sure, but in the scheme
diodes are connected to the ground, it means there
should be:
D1 VSS D1_NODE ?
Diodes can be connected only to VDD. this means that anode has to be connected to VDD like D1 VDD PD1
Visit http://www.oscilloscope-lib.com
Regards
hey im new in VMLAB and i have a problem..i have 4 shitches as my entries but i dont know how to configurate them so they can work.. if i dont do that im not gonna be able to even start de simulation..so. how can i do that ? thanks
various humanity understand what theyre doing