Using ISIS with Swordfish

Version 2.1.0.0 or higher of the Swordfish compiler now enables you to single step high level code and view variables in Labcenter Electronics ISIS. What's more, you can also integrate the simulator into the IDE using the Virtual Hardware Board (VHB) Plugin. This will allow you to easily simulate your circuit design.

When you have downloaded and installed the above, you need to ensure that Virtual Hardware Board (VHB) explorer is pointing to the installed version of ISIS. To do this, select "PLUGIN...LABCENTER ELECTRONICS PROTEUS VSM" from the IDE main menu to invoke the VHB Explorer. Press the "ISIS Location" button on the VHB Explorer main toolbar and point to your "isis.exe" file. For example,

 filename=C:\Program Files\Labcenter Electronics\Proteus 7 Demonstration\BIN\isis.exe

You now need to make sure that the output of the compile and program process is re-directed to the ISIS simulator. Normally, pressing build (or F10) will compile, assemble and create a *.hex file which is then sent to your chosen device programmer. However, we want the output *.cof file to be sent to the ISIS simulator and not a device programmer. To do this, press the small down arrow to the right of the build toolbar. If you have correctly installed the plugin, you will see an entry for "Labcenter Electronics PROTEUS VSM". Make sure this entry is checked.

Here is a small test program which you can use to check your setup. Copy and paste into the Swordfish IDE and save as "ISISTest.bas"

Sample Code

Device = 18F452
Clock = 20

// PIC Dem
#define ISIS_USED
#option LCD_DATA = PORTD.0
#option LCD_EN = PORTA.1
#option LCD_RW = PORTA.2
#option LCD_RS = PORTA.3

// import LCD library...
Include "LCD.bas" 
Include "utils.bas"
Include "convert.bas"

Dim Index As Word

// program start...
Index = 0
LCD.Cls
While true
   LCD.WriteAt(1,1,DecToStr(Index,5,"0"))
   Inc(Index)
Wend  

Now select the build icon or press F10. This will then start the Virtual Hardware Board (VHB) Explorer, as shown below

Virtual Hardware Board (VHB) Explorer

VHB Explorer is the IDE plugin that co-ordinates activity between the IDE and the simulator. Its primary purpose is to bind a Virtual Hardware Board to your program. To run the simulation for this program, just double click on the "PICDEM2+ with 18F452.vhb" hardware board item. This will invoke the ISIS simulator which will then automatically start executing your program using the selected board.

You can now load you program into the simulation environment with the Virtual Hardware Board (VHB) Explorer. However, one thing you might have noticed is that each time you press compile and program the VHB Explorer is always displayed. If you are using the same simulation board over and over again, manually having to select the board using VHB Explorer can become a little tiresome.

Virtual Hardware Board Favorites

The good news is that every time you select a board using VHB Explorer, it is saved as a VHB Explorer favorite. You can access VHB Explorer favorites from within the Swordfish IDE by right clicking on the main editor window and selecting the Virtual Hardware Boards option. If we check this favorite and then press compile and program, the VHB Explorer is not displayed. Instead, you project is loaded immediately into the ISIS simulation environment. You can have more than one board bound to your project, allowing you to quickly switch between target simulation boards during project development.

To add additional boards to your project, manually start VHB Explorer by selecting the plugin icon and clicking on the "Labcenter Electronics PROTEUS VSM" option. When VHB Explorer starts, just double click on the board you want to be bound to your current project. Your new board selection will be displayed next time you right click on the main editor window and select Virtual Hardware Boards. You can delete a favorite board by manually starting VHB Explorer and pressing the Favorites toolbar icon. Choose the Manage Favorites option to remove the virtual hardware board from the favorites list.

Additional Notes

The debug files generated by Swordfish are a standard COFF file format. However, I was having problems displaying floating point values in the VSM. It turns out that in ISIS, you need to specify the floating point format for standard COFF files (Labcenter Forum Discussion). This is how you can fix:

  • Double click on the MCU in the ISIS workspace. This brings up the edit component window.
  • In the "other properties" edit box, add
    DT_FLOAT=MICROCHIP_BIGENDIAN

which should fix the problem.