MicroSim is able to run PIC programs in a number of different ways to assist
with program development and easy viewing of what is happening during program
execution.
Executing programs using MicroSimOnce a program has been loaded into the simulator (see file loading) we can run the program in a variety of ways.Running/stopping program at full speedThe user can execute the PIC program at full speed (we assume a 4Mhz clock. i.e. 1Mhz instruction rate), that is the speed at which a PIC program would approximately execute on a real PIC chip. This is done by clicking on the 'run' icon found in the toolbar.![]() The user should know that during execution at full speed, graphical components such as the history list, source code browser, register viewer, etc are not updated with current values. This was done so that the program didn't unnecessarily use system resource to constantly update the GUI and so execution of the program was, in fact, done in real time. To stop the execution of the program, click on the 'stop' icon found in the toolbar. ![]() At this point, execeution stops at the instrcution the program is currently on, and all graphical elements are updated to reflect the state of the PIC at this point. The history list shows the most recently executed instructions, the source code browser and opcode viewer show the instruction that program execution has reached, the register and watch viewer is updated to show values of memory at present. Stepping through the programTo aid with debugging, the simulator allows you to step through the instructions, one-by-one, using the 'step' icon found in the toolbar,![]() After each instruction, all graphical elements are updated to reflect the state of the PIC chip. In the source code browser and in the opcode viewer, you can see that stepping through a program highlights the current instruction. ![]() Another feature of program execution to assist with the debugging of PIC applications is the step over function. Whilst stepping through a program, you can decide to not execute a particular instrcution when you reach it. Viewing the source code browser or the opcode viewer you can see which instruction you have reached and when the instruction you wish to step over is highlighted, you press the step over icon on the toolbar and the instruction is skipped. ![]() BreakpointsAnother feature added to assist users with viewing program execution on the PIC chip is the ability to add breakpoints to programs. Breakpoints are used when you want execution to continue as per normal but want execution to stop when a particular event happens. There are two different types of breakpoints that can be added to loaded PIC application in MicroSim:
|