Debugging and simulation
Students and participantsInstructors and assistants
Running a program on the simulated processor, stepping, breakpoints and conditions, watchpoints, registers and memory, peripherals, the serial terminal, the logic analyzer, the live circuit and looking back in it, the AI assistant (coming later) and uploading to a board (beta).
Embedarium runs your program on a simulated processor instruction by instruction and counts how many machine cycles each instruction takes. You see what the code does, what changes in the registers and memory, and how long it all takes. The simulation runs in your browser.
Running a program#
- Run (F5): builds first if needed, loads the program and runs it. The LEDs in the circuit, the serial terminal and the other panels update live.
- Debug: loads a successful build and stops at the first instruction, so you can follow it step by step. The button becomes available after you build the project.
Once the program is loaded, the run buttons appear on the toolbar:
| Button | Shortcut | What it does |
|---|---|---|
| Breakpoint | F9 | Sets or removes a breakpoint on the cursor line |
| Step | F10 | Advances one instruction, stepping over a subroutine call |
| — | F11 | Advances one instruction, stepping into the subroutine |
| To Cursor | — | Runs up to the cursor line |
| Run | F5 | Continues to the next breakpoint |
| Pause | — | Stops the running program where it is |
| Reset | — | Resets the processor; the program starts from the beginning |
| Stop | Shift+F5 | Ends debugging |
The debugging view#

In the editor, the line of the next instruction is highlighted with a ▸ marker on its left. Next to each line you see how many machine cycles (MC), clock cycles (CLK) and microseconds the line took the last time it ran; turn this on and off with the MC/CLK button at the top right.
- Run buttons: the buttons in the table above.
- Registers: the program counter (PC), the accumulator and other registers, the status flags and the active register bank. Values that changed in the last step are highlighted. The display button in the header (for example Hexadecimal) changes the number format.
- Memory and disassembly: from the menu on the left, choose the disassembly, program and data memory or the special function registers (SFRs); hold Ctrl and click to open several sections together. While the program is paused you can change RAM, SFR and (if the target has it) EEPROM values.
- Debugger tabs: Memory, Peripherals, Serial, Analyzer, Stack, MCU and Diff (details below).
- Stop points: breakpoints by address, variable watches and watchpoints (below).
- Status bar: the duration of the last step and of the whole run (machine cycles, clock cycles, seconds).
Breakpoints#
A breakpoint stops the program when it reaches that line. There are three ways to set one:
- put the cursor on the line and select Breakpoint or press F9;
- click a line in the disassembly list;
- type the address (hexadecimal) in the Breakpoint field of the stop points panel and select Add.
A line with a breakpoint has a red dot on its left. Run (F5) continues until the program reaches a breakpoint.
Conditional breakpoints#
Right-click a line in the disassembly list (Shift+F10 on the keyboard). The Breakpoint condition strip opens under the list:
- Condition expression: a single comparison of the form
<left> <comparison> <right>. Examples:A == 5,[30H] != 0,R3 >= 10H. Either side can be a register (A, B, R0–R7, SP, PC, DPTR, PSW), a flag (CY, AC, OV, P), an SFR name, internal RAM as[30H], external RAM asX[100H], or a number. A name the selected processor doesn't have (or a C variable) is refused with the reason when you select Apply; write a hexadecimal number that starts with a letter with a leading 0 (0FH, notFH). - Break on which match: if you type 3, for example, the program stops the third time the condition holds.
Leave both empty for an unconditional breakpoint. Save with Apply.

Variable watches and watchpoints#
- Watch · Variables: in C projects, after a build, choose global variables by name and watch them. With Break on change ticked, the program stops when the variable changes. A function's local variables are chosen as
function.name, and their value is read only while the program is inside that function. - Watchpoint: stops the program when a memory address (for example a cell in internal RAM) is read, written or changed. Choose the memory type and address, then select Add.
Watching the peripherals#
The Peripherals tab shows the processor's peripherals live: every bit of the ports, each timer's mode and count, the UART registers and baud rate, and the state of the interrupt controller. Choose which cards appear from the list on the left.

The units shown depend on the target processor — for example PWM and ADC on the MS51, the dual DAC on the ADuC841, TWI (I²C) on the ATmega328P, and the MSSP and comparators on the PIC16F877A.
The serial terminal#
When your program writes to the serial port (UART), the text appears on the Serial tab. Type in the field at the bottom and select Send to send text to the program; choose the line ending (for example CRLF) from the list next to it.
- Hex: shows incoming bytes in hexadecimal instead of text.
- Echo: also shows the line you sent (turn it off if the program echoes it itself).
- Clear: clears the screen only.

The logic analyzer#
The Analyzer tab draws the level of the pins you choose over time:
- Pick a pin from the Add pin list and select Add. Only the pins you choose are recorded.
- Run the program; the waveforms appear.
- Zoom the time axis in and out with the magnifier buttons.
Under each pin you see its number of edges, its frequency and its duty cycle. Export downloads the recording as VCD (for waveform viewers) or CSV; if your plan doesn't include it, the button is shown locked.

MCU, call stack and comparison#
- MCU: the selected processor's pinout; each pin's function and alternate functions; key facts such as the core, memories and peripherals, and a link to the manufacturer's datasheet.
- Stack: the call stack — which subroutines and interrupts are nested. A wrong return instruction (for example returning from an interrupt with
RET) shows up here as a warning. - Diff: select Capture snapshot to record the current register, SFR and RAM state; after you advance the program, the tab lists what has changed since then.

Code and circuit together#
If the project has a circuit, the circuit is live while the program runs: LEDs light, displays and LCDs show text, and you give the program input by clicking input parts such as buttons.
- The Simulation view shows the code and the live circuit side by side; the line being executed is marked in the code.
- The Circuit view opens the whole schematic; you edit the circuit here.

Fast switching (PWM). A part that the program switches on and off faster than the eye can follow — a PWM output, for example — is drawn by how long it is on: an LED glows dimmer, a DC motor turns more slowly and a buzzer stays on instead of flickering. A part that switches slowly, like a blinking LED, is drawn on and off as it switches.
Looking back. In the Circuit view, while the program is paused, a Look back slider appears at the bottom of the circuit. Drag it to see the circuit as it was earlier: the time next to it shows how far back you are (for example 2.5 ms earlier), and Back to now returns to the present. The slider covers the stretch the recording still holds; the recording follows the processor pins wired to the circuit (up to 16).

For drawing schematics and analyzing circuits: Circuit design and analysis.
Note
The simulation works at instruction level and counts the cycles of every instruction; pins and the circuit are updated at the end of each instruction. The simulators are tested against reference tools (uCsim, simavr, QEMU, gpsim); even so, no target has been verified on real hardware yet.
The AI assistant#
Note
The AI assistant isn't available yet; it is planned as a later feature. The Assistant tab of the output panel is already there and says "AI assistance is not configured on this server."
When it arrives, the assistant will explain the latest build error and suggest a fix that you decide whether to apply, and explain what the code in the open file does. Using it will need your organization's license and setting (see AI assistance) and your one-time consent.
Uploading a program to a real board (beta)#
On some targets you can write the built program to a real board over a USB–serial connection. This feature is in beta: the protocols were tested against a virtual board and independent programmers, but not yet on real boards.
| Target | Method |
|---|---|
| ATmega328P (Arduino Uno etc.) | Optiboot / STK500v1 bootloader, 115200 baud |
| Analog Devices ADuC841 | Serial download kernel (UART) |
| Nuvoton MS51 | UART ISP (partial) |
There is no board upload for the PIC16F877A, the Cortex-M0+ or the Generic 8051/8052. Web Serial is required, so use a Chromium-based browser such as Chrome, Edge or Opera.
- Build the project.
- Select Upload to board on the toolbar.
- With Serial port (Web Serial) selected, select Choose port and upload and pick your board's port from the list the browser opens.

The file to write and the serial connection stay in your browser; nothing is sent to the server. If you don't have the board with you, try the same flow against a simulated bootloader with Virtual board — simulated bootloader.
Last updated:
Could not find what you need? Write to support — tell us the screen and what you expected to happen.