This option displays the Simulator window in which you can simulate a compiled program. When the source code is saved without compiling, you will be warned that the debug file differs from the source code. You have the option to compile it before you simulate or continue without recompiling.
The simulator window is divided in a few sections.
|Toolbar with speed buttons
|Variable watch/modify window
|Source code window
|Terminal (input/output) window
On the left side a margin is visible. This margin can display the following icons:
a yellow dot, indicating that the line holds executable code
a read dot, indicating that a break line is set. You can only set a breakpoint on a line that has a
a yellow arrow. This arrow shows the line currently executing.
The register window
On the right side the register window is visible. You can change the value of a register by entering a new value.
The variable watch section
The section below the toolbar is the variable watch section.
You can add a variable by entering one in an empty cell. You can also add a new variable by selecting it from the source window, and pressing return.
You can insert a new variable watch line by pressing the INS-key.
You can delete a variable watch line by pressing the CTRL+DEL keys.
You can change the value of a variable by setting the focus to the cell with the variables value and then by entering the new value.
The variable names are saved and loaded after each simulation session.
The terminal section
The blue window emulates the serial port. So serial output (the PRINT statement for example), is displayed in this window.
When serial input is required, you must set the focus to the serial window, before you enter text. The INPUT statement for example, requires serial input.
The source code window
The source code windows shows the source file being simulated.
You can start a simulation by pressing F5 or by clicking the run button .
When your program runs, you can pause it by clicking the pause button .
You can stop the simulation by clicking the stop button.
You can also step through the code line by line, by pressing F8, or by clicking the step button .
By pressing SHIFT+F8 , you can step over code, like GOSUB and CALL.
To pause execution at a certain line, you can set a breakpoint. Just set the cursor on that line and press F9. By pressing F9 again, you can remove the breakpoint.
Note that a breakpoint can only be set on a line that contains executable code.
This is visible by the yellow dot. Statements like $romstart don't contain executable code and won't have a corresponding yellow dot.
You can also run to a specified line by clicking the run to button .
The status bar
The status bar is also divided into a few sections. These sections from left to right display the following information:
|The value of a variable in the source code window. You can select a variable by moving the mouse cursor over the variable name.
|The status of the simulator (stopped, running or paused)
|The number of clock cycles and the execution time of the executed code. You can reset the value by clicking on this section.
|The stack depth of the program. The stack depth is the deepest level the stack has reached during execution. If it exceeds the available internal memory (128 or 256 bytes), the program will not run correctly in the chip.
The interrupt buttons
The INT0, INT1, T0, T1 and SER buttons can be clicked to generate an interrupt.
Because this is a software emulator, no hardware interrupts can be generated. You have to do this yourself by clicking these buttons. TIMER 0 and TIMER 1 are simulated by software. Therefore, they will generate an interrupt automatically if the software enables this. The external gate however isn't simulated so for this occasion you must click the corresponding button.
Depending on the chip used, other interrupt buttons can be visible. They have the same purpose as the default interrupt buttons.
Hardware simulator button
By clicking the hardware simulator button a special window will become visible. This window has a LCD simulator, which can simulate custom characters, LED simulation for port 0-3, and a 7-digit LED display simulation.
The LCD type can be selected from the menu. Note that the display isn't as fast as it could be, but to assign/display all the dots costs a lot of processor time. The advantage however is that custom characters can be displayed too.
The LED's can be switched on or off by clicking on it.
The LED type can be set with the CG checkboxes. To select common ground you must set the marker. This will have the effect that all common cathodes are connected to ground and so the LED will be on when the port value will be high.
The 7-digit display can be connected to individual port pins.
To change the setting you must press the right mouse button to bring up the digit properties window.
Each segment is named with a letter. To change a port pin, select the segment from the list and press the spacebar. Now you can enter the desired port pin.
After you are done with assigning/changing, press the Ok button.
Real hardware simulation
Press the real hardware simulation button to enable the hardware simulation.
You need additional hardware to use this feature. You can use the MCS flash programmer to simulate one port.
An application note can be downloaded that describes the needed hardware.
The hardware simulator can simulate port 1 and 3.
This way you can test your program in circuit without programming the device.
Now only the status reading and setting of the ports is supported.
This means that interrupts are not yet supported in hardware simulation.
The displaying of the variables and the arrow costs a lot of processor time. To simulate faster, you can disable the update of these items. Click the button to enable/disable the update.
Display memory window
To display the memory of the internal RAM, you can click the button. By clicking again, you can hide the window.
Normally, variables are only refreshed in step mode (F8), because depending on the used statements, the value would be hard to watch. You can also choose to display the value during program execution. The default is on.
The sections can be made larger or smaller by using the splitters.
When you press the right mouse button, a popup menu will be visible.
Depending on the place the mouse cursor was at the time you pressed the right-mouse button, different options will be showed.
Extra options that will be come available are:
|Hide register window
|Hide watch window
To end a session close the windows or just set the focus to an editor window.