MicroSim has a tab in its program dedicated to the interfacing of the simulator which the parallel port. This tab is
called the "Hardware" tab, the second tab at the top of MicroSim.
Selecting the parallel port configurationIn the file loading help file we explained that when a file is opened you also have to select the parallel port configuration. There are three options you may select from:
![]() Parallel Port Pin Configuration Dialog Once your preferred configuration has been selected and you do indeed decide to choose to use the hardware mapping feature (Options 2 or 3), then you must map the PIC pins to parallel port pins which is done on the "Hardware" tab. Mapping PIC pins to the parallel portOn the hardware tab you will see a image in the middle of the screen showing the package for the 18-pin PIC16F84A chip. Each pin on the chip is associated with a function or bit:
For each pin on the chip there is information in brightly displayed for user convenience:
![]() To map a pin to parallel port, you click on the drop-down box associated with that pin and select which parallel port pin you want the PIC pin to be mapped to. For instance, if you want Port A Bit 2 (pin 1 on the PIC chip) to be mapped to parallel port pin 11, you would click on the drop-down box next to RA2 and select the number 11. One of the limitations of the hardware interface of MicroSim is the fact that the direction of a port pin (either input/output) must be known before the program simulation starts. This means that, for example, if RA2 was going to be programmed as an input, the only parallel port pin that you can map RA2 to are the parallel port pin numbers that have '(Input)' next them. This is because, depending on the configuration you chose when loading a file, some parallel port pins can only be inputs and some can only be outputs. If the user makes a mistake by assigning an input PIC pin to a parallel port pin, the interfacing will not work and produce incorrect simulation results. Most PIC programmers know before program execeution which PIC pins will be programmed for input and output so this will not be a hige problem. However, any applications that dynamically change port direction registers in code (using TRIS instruction) are run through a check in MicroSim to ensure that the total number of inputs and outputs used does not exceed the allowed number of inputs and outputs selected when the file was loaded. If a violation has occured, execution stops, an error dialog pops up and the simulation is reset. Saving and loading your mapping configurationsWhen MicroSim quits or loads a new PIC program, the mapping for each pin must be done again. Having to re-map pins when you already know the configuration can be tedious. The MicroSim program allows for the saving and loading of mapping files. Once you have decided upon a configuration, you may choose to save it by clicking on the 'Save Mapping File' button at the bottom right hand corner of the screen. This opens a save dialog where you can specify the name of the file. Mapping files are saved with an extension '.msm' (MicroSimMapping file). Mapping files can be loaded by clicking on the 'Load Mapping File' button. A load dialog comes up and you can select the mapping file to load.Choosing The Parallel Port AddressMost systems use LPT1 as the parallel port but some configurations may have it set at LPT0 or LPT2. There are radio buttons that allow the user to choose the parallel port address. This may also be useful if a system is using LPT1 but has an additionaly hardware card with a parallel port.Selecting The Operating FrequencyThis allows the user to select the operating frequency via a drop down combo box. The available frequencies are 32.768 kHz, 1 Mhz, 4 Mhz, 10 Mhz and 20 Mhz. The operating frequency can also be changed during execution. |