|
|
|
|
5.7 MPSIM Simulator
Simulator is part of MPLAB environment which provides a better insight into the workings of a microcontroller.
Trough a simulator, we can monitor current variable values, register values and status of port pins. Truthfully, simulator does not have the same value in all programs. If a program is simple (like the one given here as an example), simulation is not of great importance because setting port B pins to logic one is not a difficult task. However, simulator can be of great help with more complicated programs which include timers, different conditions where something happens and other similar requirements (especially with mathematical operations). Simulation, as the name indicates "simulates the work of a microcontroller". As microcontroller executes instructions one by one, simulator is conceived - programmer moves through a program step-by-step (line-by-line) and follows what goes on with data within a microcontroller. When writing is completed, it is a good trait
to, programmer's first check his program in a simulator, and then runs it out in a real situation. Unfortunately, as with many other good habits, man
overflows this one too, more or less. Reasons for this are partly personality, and partly lack of good simulators.
Beginning of program simulation, resetting a microcontroller
One of the main characteristics of a simulator is the ability to view register status within a microcontroller. These registers are also called special function registers, or SFR registers. Simulator with open windows for SFR registers, file registers and variables.
The next command in a simulator is DEBUG>RUN>STEP which starts our steping
through the program. The same command could have been assigned from a keyboard with <F7> key (generally speaking, all significant commands have keys assigned on the keyboard).
|
|
|
|
|
© Copyright 1999. mikroElektronika. All Rights Reserved. For any comments contact webmaster.
|