miSim DE Back Index Next

Chapter 3 - User Guide Continued

The Plugin Window

Plugins can simulate different hardware connected to the processor. They are also able to provide tools that monitor or control the behaviour of the processor - such as memory displays, or register monitors. Plugins can be grouped into a 'circuit' which can represent a set of Plugins with a specific configuration needed for a particular job. The Plugin window allows plugins and circuits to be created, connected to the processor and displayed.

Plugin Window

The left half of the Plugin window shows the current circuit and the list of Plugins defined in that circuit. Click on the circuit drop-down to view and select from all defined circuits. Selecting a different circuit will remove the current Plugins and the list will display the Plugins for the new circuit. You can create a new circuit by clicking the 'Add' button, and remove the current circuit by clicking the 'Remove' button.

Plugins can be added or removed from a circuit so that only the plugins appropriate to your current project are shown. Use the 'Add New', 'Remove' and 'Rename' buttons below the Plugin list to manage the current circuit's Plugins.

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.

You can add the same Plugin as many times as you wish, with the same or different configurations - for instance you might want to connect a number of LEDs to different Port pins on the microcontroller. Selecting a plugin in the list will display information on that plugin on the right hand side of the window. Clicking 'Show All' and 'Hide All' will show or hide all of the plugins defined in the current circuit.

When a Plugin is selected from the list, its information is shown on the right hand side of the plugin window. Clicking 'Show' will display just 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.

Configuring Plugins

Some plugins are configurable - the precise hardware that they simulate or the port pins that they are connected to may be changed. Examples of these might be a switch or an LED, each of which could be connected to any Port pin. If a plugin is configurable, its settings may be controlled through the information shown on the right hand side of the plugin window. When a configurable plugin is selected the right half of the Plugin window will display the necessary components to edit that configuration.

Most Plugins are controlled by a 'Configuration String' which is shown in a '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. Some Plugins have specific controls for editing their configuration, in which case they will be shown on the Plugin Window, and the configuration can be changed by clicking the 'Update' or 'Cancel' buttons that will also be displayed.

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.


The Edit Window

Files can be opened by clicking File -> Open.. or created by clicking File -> New. The editor provides syntax aware highlighting, multiple levels of undo and redo, automatic capitalisation of keywords, search and navigation facilities. The edit menu controls many of the functions of the currently displayed edit window. In addition the following keys can be used:

The editor recognises keywords specified by the current processor, and will capitalise and colour those words it recognises. It will also colour comments, numbers and other syntax elements. The capitalisation is only a display property - when the file is saved, the text is stored exactly as it was typed. If a file is opened that is intended for a different processor from the current device, some words may not be recognised by the editor. However, when the file is assembled and the assembler identifies a processor directive (either the PROCESSOR command, or the LIST p= command), the appropriate parser will be chosen for the file and the display updated.

When a text file is selected in the tabbed windows, it can be assembled by clicking File -> Assemble, or pressing Ctrl-A. Errors and warnings encountered during assembly are reported on the status bar and in the Log View. If no errors occured, miSim DE will switch to the Processor Window ready to simulate the program. If the file could not be assembled, then the view will remain on the text file, and the cursor will go to the first line that caused an error. Errors are marked with red indicators at the start of the line. Orange indicators show warnings. When the cursor reaches a line that contains an error, the error message will be displayed in the status bar. Typing Ctrl-N will move to the next error, Ctrl-P will move to the previous error.


Setting Preferences

The Preferences dialog selects the current processor, controls the way that the simulation is run and allows other general preferences to be edited. 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.

Processor Preferences

Processor Preferences

The currently simulated processor is selected when the preferences dialog is opened. Selecting a different processor will replace the current device. The new processor will not contain any program. When a new processor has been selected, subsequent text files that are opened will use syntax highlighting appropriate to the new processor.

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 a 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.

General Preferences

General Preferences

The General Preferences tab includes settings for the device programmer interface, setting of a proxy server for the Web Update feature and browser control when running miSim DE in a Unix environment

To set up the device programmer, enter the command that you would usually use to write a hex file to the device. Replace the binary (.hex) file name with '%h' - this will be substituted with the actual hex file written by miSim when the programmer is invoked. The string '%d' will be replaced by the device name (e.g. '16f84') currently being simulated. The timeout value is the time in seconds before miSim will abort the command - this may need to be set to a reasonable period, particularly when programming larger devices.

If your computer is behind a firewall, the Web Update facility may not be able to access the feertech.com update server. If this is the case, you may enter the host name of your http proxy (check your web browser's proxy settings) and the port number. Note that if no host name is given, then no proxy is used. The proxy port defaults to 80 if not specified.

miSim DE can display links in your browser for some functions. This facility works automatically in Windows, starting your default browser as appropriate. However, if you are running in a Unix environment you may need to specify the command that starts your browser. If no command is specified, miSim DE attempts to use 'netscape' and assumes that it is on your PATH. If this is not the case, then you can provide the command that you usually use to start your browser (including the full path if necessary) here.


Breakpoints

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 green indicator 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 comments or macro commands.

Breakpoint Manager

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.

Index Next