SimulIDE Knowledge Base
– MCUs –

MCUs are Modular Components, defined in a Definition file representing different modules inside the MCU as: cpu, memories, I/O ports, timers, etc.

Microcontrollers supported:

AVR
PIC
I51
Arduino

Relevant topics:

Monitor
Serial Monitor
MCU Fuses


Basic Use:

To do a Microcontroller simulation just pick a Microcontroller from the left panel and drop in the circuit, then build the circuit you need to test your firmware.
When your circuit is 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.

Microcontrollers in the simulation don’t need a clock connected. The clock signal is always generated by the simulation.
To set the Microcontroller clock speed:
1. Right-click on the Microcontroller and select “Properties”.
2. Set “Frequency” property at the desired speed.

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 an hex file loaded previously.
  • Load EEPROM data from file: load data from file to Microcontroller’s EEPROM.
  • Save EEPROM data to file: save Microcontroller’s EEPROM to file.
  • Open Monitor: open a monitor to watch RAM, ROM, Flash and other info.
  • Open Serial Monitor: open a monitor to watch Serial communications.
  • Properties opens properties dialog.

Properties:

This is the Microcontroller’s Properties dialog.

Main tab:

  • Frequency: set the frequency.
  • Firmware: shows the path to the hex file loaded.
  • Reload hex at Simulation Start: automatically reloads hex file at simulation start.

mcu_props1.png

Config tab:

These setting are equivalent to configuration bits (MCU Fuses).

  • Enable Reset Pin: use reset pin if multiplexed with I/O pin. Pin can’t be used as I/O pin.
  • External Oscillator: disables oscillator pins if multiplexed with I/O pins. Pins can’t be used as I/O pins.
  • Enable WatchDog: Enable/disable watchdog. Enabling in configuration registers might be needed.

mcu_props2.png


MCU Fuses:

PIC:

fuses based on PGM Address.

Fuses are contained in the hex file at special addresses.
These are detected by the loadHex algorythm.
Adress+value sent to PicConfigWord::setCfgWord which does the configuration:

  • Oscillator type: Freq and Pins (McuIntOsc).
  • Watchdog.
  • Mclr Pin.
  • Clock Out.

AVR:

fuses programmed directly.

Configuration is done in Component properties->Config.


Resources:

Videos:

MCU dev


#hub