Running within a browser however introduces a number of limitations - the main one being that files cannot be saved from miSim DE. Running the Simulator as a standalone application allows edited and assembled files to be saved and provides much more helpful file dialogs.
To run the Simulator as an application, you will need at least Sun's Java Runtime Environment (JRE), version 1.1 or higher. JRE 1.3 is recommended - it makes a significant improvement in the simulation speed, and as the software is largely developed using Java 1.3 SDK, it is the most thoroughly tested environment. You can download the JRE from Sun's Site: Sun's JRE 1.3 For Windows, or Sun's Java Homepage for other platforms and versions.
With the JRE or full Java release installed (you will need the SDK if you wish to compile your own Java software or miSim DE Plugins) you can then install and run miSim DE.
misim.bat
' which is a simple
script to start miSim DE.
You need only double click on this file in Explorer
to invoke Java and start miSim DE.
Alternatively, you can start up a command prompt (Start -> Programs -> MS-DOS Prompt) and change to the directory that contains the release files. You can run the simulator under Windows 9x or NT simply by typing:
java -classpath $CLASSPATH$;misimdeXXX.jar misim.MiSimDE
(Remember to change the 'XXX' into the relevant version number for the release of miSim DE that you have downloaded.)
This tells java to use your existing classpath (if any), and add the .jar file to it to find the classes that make up the simulator. It then calls up the main class (picem.PicEmulator) which starts up the software and displays the user interface.
. start_misim |
That is '<dot><space>start_misim', if you have a bash shell or |
source start_misim |
If you have a tcsh shell |
java -classpath $CLASSPATH:misimdeXXX.jar misim.MiSimDE
(Remember to change the 'XXX' into the relevant version number for the release of miSim DE that you have downloaded.)
This tells java to use your existing classpath (if any), and add the .jar file to it to find the classes that make up the simulator. It then calls up the main class (misim.MiSimDE) which starts up the software and displays the user interface.
At the moment the simulator must be run from the directory that contains the additional files. In future, it should be possible to use an environment variable to define the home for the simulator, so it can be run more conveniently from any location.
The miSim DE window is divided into three areas. Along the top there are menu buttons and buttons which control simulation. In the middle there are a series of tabbed windows. Along the bottom of the window is the status bar which reports the current state of miSim DE.
The File menu has the following options:
The Edit menu has only one option, Preferences, which allows the simulation preferences to be set. These are discussed later.
The Debug menu has these options:
The Simulation controls include the following buttons:
For both Step and Over, the number of machine cycles simulated are shown in the status bar at the bottom of the miSim DE window. Note that if the 'fast loop simulation' is selected (in the Preferences dialog), Step will execute any empty DECSNZ/GOTO delay loops as a single operation and report the number of machine cycles that the delay loop took.
In addition, Edit Windows can be opened to edit or view text or source files.
The Log Window shows a scrollable list of actions that have been carried out by the simulator. This includes loading files, assembling and assembly errors and running the simulator itself. The log view cannot be edited or saved.
The View window shows the contents of the processor memory and relates them to the assembly listing that generated them, if one was used to create the software.
The main part of the View window shows an assembly listing of the program loaded into the simulated processor. A typical assembly listing looks something like this:
The listing essentially shows eight columns. The first column indicates
where breakpoints have been set with star ('*
') symbols. The second
column is optional and shows the line number (in hexadecimal) of the listing that
was assembled into this code. This column is only included if the processor was
loaded by assembling a file and is not shown if the 'Load Binary' file menu option
was used.
The next two columns show the address and data for each instruction, in hexadecimal. The following column shows any labels. The next columns show the machine instruction and parameters. The final column may show comments if any were included in the assembled code.
Along the bottom of the View window is information about the processor's current state. The program counter (PC) is shown and the contents of the W and Status register. The values shown for PC and W are in hexadecimal. The status register is shown as a binary number, and additionally the three letters 'z', 'd' and 'c'. The letters correspond to the lowest three bits of the status register, which are used as the Zero, Decimal overflow and Carry flags. If the bit is '0', the letter is shown in lower case - the flag is not set. If the bit is '1', the flag is set, and the letter is shown in uppercase.
Individual registers can be examined by entering the register address in the Register box and pressing
the '->
' button or single stepping the simulator, at which point the
content of that register is shown. A new value may be entered in the field
and the register set to that value by clicking the 'Set' button. Both register number and
contents are displayed in Hexadecimal.
Plugins can simulate different hardware connected to the processor. The Plugin window allows plugins to be created, connected to the processor and displayed.
When miSim DE starts, it reads the settings file, which specifies which Plugins are available, and which of these are ready to display (current). Available plugins can be added or removed from the current list so that only the plugins appropriate to your current project are shown. You may make as many copies of a single plugin current as you wish, and display them all - for instance you might want to connect a number of LEDs to different Port pins on the microcontroller. Selecting a current plugin will display information on that plugin on the right hand side of the window.
To Remove a current plugin, simply select it and click the 'Remove' button below the list. Similarly, current plugins can be renamed by clicking the 'Rename' button so that you can easily identify particular devices plugged into the microcontroller. To add a new plugin from the list of those available, click the 'Add New' button.
Clicking 'Add New' displays a dialog with a drop-down list of available plugins. Select the type of plugin you wish to add, and click OK. The plugin will be added to the current list with its default name. If the current list already has a plugin with that name, a number is added to the name to make it unique.
Once a current plugin is selected, its information is shown on the right hand side of the plugin window. Clicking 'Show' will display that plugin and connect it to the processor. Closing the plugin window will disconnect it from the processor. Note that plugins can slow down the simulation, depending on what they do. In general, plugins that respond to processor output and display graphical information will slow the simulation more than 'silent' plugins like switches or logging plugins. It is therefore sensible to only activate the plugins that are appropriate for your current project.
The exact configuration of the plugin is controlled by a 'Configuration String' which is shown in the 'Config' text box. This config may be edited and the plugin updated by clicking 'Set'. For information on the format of the configuration string for a particular plugin, click the 'Help' button. More information on each of the Plugins that are available with miSim DE is given in the Plugins Chapter of this manual, which also explains how new Plugins can be written.
Files can be opened by clicking File -> Open.. or created by clicking File -> New. The editor is simple, but includes the following additions:
The Preferences dialog provides settings that control the way that the simulation is run. To view the dialog, click the 'Edit' button on the main miSim DE window, and select 'Preferences' from the menu. Prefences may be changed in this dialog, but will not be applied to the simulator until the 'OK' button is clicked. Clicking 'Cancel' will leave the preferences unchanged.
The Simulate option allows a choice to be made between Fast, Controlled and Accurate simulation. Fast simulation (shown as 'Fast as Possible') involves simulating the processor without speed control or interrupt simulation. This option is useful if pure code or only output is performed by the software being simulated. Controlled simulation (shown as 'To given clock rate') runs the processor at as close to a given clock speed as it can, but still without interrupts being simulated. This option reduces the top speed that the simulation can be run at due to the additional checks that have to be run as the processor instructions are executed. Accurate simulation (shown as 'Accurately') simulates the processor with interrupts and at the given clock speed. Again, the overhead of accurate simulation reduces the simulator top speed even more than Controlled simulation. Note that some plugins will only work correctly under Accurate simulation, as they rely on the timing information provided by interrupt handling.
When an simulation option is chosen that involves running the processor at a specific clock rate, the Clock Rate field is enabled. The clock rate (a real number, in Mhz) can be entered here. If an invalid number is entered, the field will turn red when the 'OK' button is clicked, and the cursor will return to the field so that the value can be corrected.
A further check box allows simulation of interrupts to be enabled when the Step and Over functions are used. Normally, this is enabled when the simulation option is Accurate and is disabled otherwise. This means that if Fast or Controlled simulation is chosen, interrupts are not normally enabled for any of the Run, Step or Over functions. If Accurate simulation is chosen then Step and Over will also invoke interrupts if they occur when an instruction is being handled. Interrupts are synchronised to the clock of the simulated processor - so that from the point of view of the simulated software, the processor appears to be running at normal speed. No interrupts can therefore occur without 'Step', 'Over' or 'Run' being performed.
The Fast Loop Simulation check box enables and disables fast simulation of delay loops. This examines the code for empty DJNZ/GOTO delay loops and simulates the effect of the loop completing, without simulating each individual instruction. In timing intensive software, this can result in a dramatic increase in simulation speed. However, fast loop simulation will result in inaccurate simulation of interrupt effects, as any interrupts that occur during a delay loop will not be acted on until the loop has completed.
A breakpoint forces simulation to stop when the Program counter reaches a set address. Breakpoints can be set throughout the code to detect when particular routines are entered or specific code is exectuted. When a breakpoint is encountered, the simulator reports the address reached, and the number of clock cycles that have been simulated.
Breakpoints can be set in the View Window, by selecting a line of code and
clicking the 'Debug->Add Breakpoint' or 'Debug->Remove Breakpoint' menu items.
A breakpoint will be added to or removed from the address of the currently selected line in
the View Window as appropriate. The View Window shows breakpoints by putting a Star ('*
')
symbol at the start of any line that has a breakpoint set. Note that the
breakpoint is shown against the line that displays the actual instruction, rather
than (for instance) previous lines which might contain Macro commands which were
expanded to generate the instruction.
Alternatively to edit breakpoints the Breakpoint Manager dialog can be used. The Manager is displayed by clicking 'Debug->Edit Breakpoints'. The Breakpoint Manager lists all of the current breakpoints - their addresses and the machine instruction at that address in the processor. Note that the machine instruction shown is a disassembly of the instruction at the breakpoint - not the source code that produced that instruction. The Breakpoint Manager has a number of buttons that act as follows:
Note that processing breakpoints will noticably slow down the simulator, as breakpoints must be evaluated after each instruction. If there are no breakpoints, then the breakpoint manager will remove itself from the simulated microcontroller, and simulation will run at maximum speed. Otherwise breakpoint processing takes a constant time regardless of how many breakpoints are defined.
![]() |
![]() |