Working with Microcontrollers

(Updated to 0.4.15)

SimulIDE supports Pic, Avr and Arduino simulation.

Microcontrollers are simulated by external simulators embedded  into SimulIDE:
- AVR simulation provide by simavr:
- PIC simulation provided by GpSim:

Basic Use:

To do a Microcontroller simulation just pick the Microcontroller yo want from the left panel and drop in the circuit, then build the circuit you need to test your firmware.
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, it means that firmware was properly loaded.

To set the Microcontroller clock speed:
- Right-click on the Microcontroller and select "Properties".
- Set "Mhz" property at the desired speed in Megahertz.

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 watch the simulation.

Context Menu:

- Load firmware: load an hex file to the Microcontroller.
- Reload firmware: reload last used hex file.
- Load EEPROM data: load data from file to Microcontroller EEPROM (binary or .data).
- Save EEPROM data: save Microcontroller EEPROM to file (binary or .data).
- Open Mcu Monitor: open a monitor to watch RAM, ROM, Flash and other info (see below).
- Open Serial Monitor: open a monitor to watch Serial communications (see below).
- Open Serial Port: open an interface to connect to a Serial Port in your PC (see below)

Mcu Monitor:

This widget shows information about the Microcontroller:

- Program Counter.

- Status Register.

- RAM, ROM and Flash tables.

- Watch Registers and variables.


To watch Registers or variables select "Variables" tab and add values to watch using any of 2 methods:

1- Type register name or address in Reg. column

2- Select a place in Reg. column and then double-click in a register in the list at the right.

If you save the circuit after adding values to watch, these values will remain next time you open the circuit.

It is also possible to save the list of registers you are watching to a file, so you can open it again in other session:

- Right-Click on any part of the RamTable view.
- 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 any Microcontroler Uart.
Right-Click on the Microcontrlloler and select "Open Serial Monitor": a new widget will appear.

By default Serial Monitor will use the first Uart of the Microcontroller, but you can change it in the "Uart" box at the upper right side.

The serial monitor is divided into two sections:

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

There are "Clear" buttons for each side.

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 any Microcontroller Uart to a serial port on your computer (real hardware or virtual ones):

- Right-Click on the Microcontroller.
- Select "Open Serial Port".
- A new Component will appear.

First set the Microcontroller Uart, Port Name, and configure it in the Properties widget (double-click or context menu).

To connect to the port use the "Open" button. Once it is connected the led will blink when there is data transfer.

You can still use the serial monitor to watch the serial communication.