PIC18 Simulator IDE External Modules
 
 

PIC18 Simulator IDE is an automation (ActiveX) server/client application. This feature enables communication with external simulation modules that can be developed by home developers and third parties using various Development Systems for Windows.

External client application can access PIC18 Simulator IDE server services by creating an ActiveX object using pic18simulatoride.server class.
 
Available functions and procedures:
- getpic() function with no arguments will return the selected PIC microcontroller model [string].
- getpath() function with no arguments will return the path of loaded HEX file [string].
- getflash(address) function will return the value in the flash memory location specified by 'address' argument [0-MaxAvailable].
- geteeprom(address) function will return the value in the eeprom memory location specified by 'address' argument [0-MaxAvailable].
- getpc() function will return the value in PC register.
- getwreg() function will return the value in WREG register.
- getreg(address) function will return the value in one of the special function or general purpose registers specified by 'address' argument [0-4095].
- setreg(address,value) procedure will set the new register value, 'address' argument [0-4095], 'value' argument [0-255].
- setregbit(address,bit,value) procedure will set the new value for the specified register bit, 'address' argument [0-4095], 'bit' argument [0-7], 'value' argument [0-1].
- getstack(level) function will return the value stored in one of the stack levels [1-31].
- getcrystal() function with no arguments will return the clock frequency parameter.
- getclockcycles() function with no arguments will return the number of clock cycles passed after the start of the simulation. The last two functions will enable the external client application to develop a real time behavior if needed.
- getinst() function with no arguments will return the mnemonics of last executed instruction [string].
- getportstate(address) function will return the real logic levels on the port 'address' argument [3968(PORTA)-3976(PORTJ)].
- setpinstate(port,pin,state) procedure will set the logic level on the addressed pin, 'port' argument [3968(PORTA)-3976(PORTJ)], 'pin' argument [0-7], 'state' argument [0-1].
- getanalog(an) function will return the analog value on the analog input specified by 'an' argument [0-15].
- setanalog(an,value) procedure will set the analog value on the addressed analog input, 'an' argument [0-15], 'value' argument [0-1023].
- extsimstart() procedure will start the simulation.
- extsimstop() procedure will stop the simulation.
- extsimstep() procedure will execute one simulation step if in Step By Step mode.
- extsimrate(rate) procedure will change the simulation rate, 'rate' argument [1(Step By Step)-6(Ultimate)].
 
Full support and full synchronization is available for external applications with client/server capabilities. External server module should provide the following procedures:
- objectinit() procedure will be called at the beginning of the simulation in PIC18 Simulator IDE. With this procedure external module should be initialized to a known initial state.
- objectrefresh() procedure will be called after every simulated instruction.
- objectterm() procedure needs to contain the code to terminate external module application (typically End statement).
The class name should be set using External Modules interface available from Tools menu of PIC18 Simulator IDE. External client/server applications will be started and terminated automatically with PIC18 Simulator IDE.
 

External Module Template - DOWNLOAD
 
The archive contains the Microsoft Visual Basic 6.0 project files that can be used as a template for developing custom external modules for PIC18 Simulator IDE.