Microcontroller Simulators and emulators

Sometimes you haven’t the ability to flash a microcontroller to test program functionality in the development phase. For this, there may be many reasons, like you don’t have a prototype ready or you need to test parts of code, and so on. For this, there are software simulators used that simulates microcontroller work without microcontroller itself. Simulators usually don’t have a connection to the real-world all operations are simulated in software. A microcontroller simulator is a program model that imitates its work. Modern simulators now simulate arithmetic operations and I/O operations and even peripherals like timers, ADC, USART, I2C, and so on. In many cases, it is possible to prepare the whole project using the simulator and then burn compiled code to a real microcontroller.

Simulators usually allow:

  • debugging at source code level;
  • follow operation time in slow motion but with real-world values;
  • connect stimulus signals like they are real-world signals.

The simulator can be expressed as several blocks interconnected with each other:

microcontroller simulator diagram

This is a basic illustration because many modern simulators may have much more blocks.

  • Memory block imitates the work of real memory. The microcontroller program has to be loaded to this memory. O course, this memory can be split into several modules like Flash, RAM, EEPROM, or even External memory;
  • Processor model imitates all operations of real processor like accessing memory contents, doing arithmetic operations, storing results back to memory;
  • I/O model usually reads signals from the file where prepared real-world signals are stored, or it is connected to an external circuit model that generates required signals.

The processor model is the core of the simulator because it controls all operations, including interrupts. Working with a simulator gives many benefits because you can see all parameters just in one window. You can stop the processor and change memory contents at any time just by clicking on the screen. But one disadvantage is that simulator is totally isolated from the real world. So another option is to use Emulator.

microcontroller emulator

The emulator is much closer to real-world conditions because the software is emulated in real hardware while results are seen in special emulator software. To emulate the target microcontroller, a special adapter is needed that interacts between the host computer and target board. Usually, the Jtag interface is used to emulate. As a result of using an emulator, you can precisely emulate microcontroller work; even more, you don’t need to take care of input signals from sensors as they come from real circuits.

One Comment:

Leave a Reply