Working with Microcontrollers

SimulIDE supports Pic, Avr and Arduino simulation.

The microcontroller itself is simulated by external simulators:
- AVR simulation provide by simavr:
- PIC simulation provided by GpSim:

Basic Use:

To do a microcontroller simulation just pick the microcontroller yo want and drop in the circuit, then build the circuit yo need to test your fimware.
When you have your circuit ready Right-Click on the microcontroller and select "Load firmware".
Select an .hex file to load to the  microcontroller.
If no error message is shown means that firmware was properly loaded.

To set the microcontroller clock speed:

- Select it.
- Open "Properties" tab in left panel.
- Set "Mhz" property at the desired speed in MegaHerz.

By default clock speed is set to 20 Mhz for Pic and 16 Mhz for Avr and Arduino.

Now you are ready to power the circuit and see the simulation.




Watching Registers and Variables:

While running firmware you can watch Registers and variables:

- Open RamTable tab in left panel.
- Type (uppercase) one register name or address in the left box (Reg.)

You will see register value in decimal and binary in "Dec." and "Binary" boxes.
If you type register name, address will appear in the left read-only box as a decimal value.

It is possible to save the list of registers you are watching, so you can open it again in other session instead of typing everything again:

- Right-Click on any part of the RamTable view ( Reg. | Dec. | Binary ).
- Select Load os Save variable set ( .vst extension is used )
- Load or Save dialog will appear.
- Choose the varset you want to load or type varset file name to save.

Serial comunications:

-Monitoring uart:

You can monitor first microcontroler uart.
Right-Click on the microcontrlloler and select "Open Serial Monitor", a new widget will appear in the bottom panel.

The serial monitor is splitted in two parts:

- Left side shows the data sent by the microcontroller.
- Right side shows the data received by the microcontroller.

You can choose to print de decimal value of the data sent/received or it's related ascii value.

There is a "Send Text" input to send ascii characters to the microcontroller and "Send Value" input to send 0-255 values to the microcontroller:

-Connecting to Serial Port:

It is also possible connecting the microcontroller to a serial port on your computer:

- Right-Click on the microcontrlloler.
- Select "Open Serial Port".
- A new widget will appear in the bottom panel.

This is a tipical serial port connection panel, where you can configure, connect and disconect to any serial port you want, being real hardware or virtual ones.

You can still use the serial monitor to see the serial comunication:

In this video you can see it working (from 00:45): Using Serial Port and Monitor.