Home
Downloads
Licenses Contact

OshonSoft

20th Anniversary

20th Anniversary of the
OSHONSOFT PROJECT
(2001 - 2021)

PIC Simulator IDE
External Modules Manual


Table Of Contents:

General info


Functions and procedures


External client/servers


• General info
PIC 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.

picsimulatoride.server
External client application can access PIC Simulator IDE server services by creating an ActiveX object using picsimulatoride.server class.

• Functions and procedures
Here is the list of functions and procedures available for external client applications:
- getpic
getpic() function with no arguments will return the selected PIC microcontroller model [string].
- getpath
getpath() function with no arguments will return the path of loaded HEX file [string].
- getinst
getinst() function with no arguments will return the mnemonics of last executed instruction [string].
- getcrystal
getcrystal() function with no arguments will return the clock frequency parameter [string].
- getclockcycles
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.
- getpc
getpc() function will return the value in PC register.
- getw
getw() function will return the value in W register.
- getflash
getflash(address) function will return the value in the flash memory location specified by 'address' argument [0-(max available)]. Value -1 is returned if argument is out of range. This note is valid for all the other functions, also.
- geteeprom
geteeprom(address) function will return the value in the eeprom memory location specified by 'address' argument [0-(max available)].
- getreg
getreg(address) function will return the value in one of the special function or general purpose registers specified by 'address' argument [0-511].
- setreg
setreg(address,value) procedure will set the new register value, 'address' argument [0-511], 'value' argument [0-255].
- setregbit
setregbit(address,bit,value) procedure will set the new value for the specified register bit, 'address' argument [0-511], 'bit' argument [0-7], 'value' argument [0-1].
- getstack
getstack(level) function will return the value stored in one of the stack levels [1-8].
- getportstate
getportstate(address) function will return the real logic levels on the port 'address' argument [5(PORTA)-11(PORTG)].
- setpinstate
setpinstate(port,pin,state) procedure will set the logic level on the addressed pin, 'port' argument [5(PORTA)-11(PORTG)], 'pin' argument [0-7], 'state' argument [0-1].
- getanalog
getanalog(an) function will return the analog value on the analog input specified by 'an' argument [0-15].
- setanalog
setanalog(an,value) procedure will set the analog value on the addressed analog input, 'an' argument [0-15], 'value' argument [0-1023].
- extsimstart
extsimstart() procedure will start the simulation.
- extsimstop
extsimstop() procedure will stop the simulation.
- extsimstep
extsimstep() procedure will execute one simulation step if in Step By Step mode.
- extsimrate
extsimrate(rate) procedure will change the simulation rate, 'rate' argument [1(Step By Step)-6(Ultimate)].

• External client/servers
Full support and full synchronization is available for external applications with client/server capabilities. External server module should provide the following procedures:

- objectinit
objectinit() procedure will be called at the beginning of the simulation in PIC Simulator IDE. With this procedure external module should be initialized to a known initial state.
- objectrefresh
objectrefresh() procedure will be called after every simulated instruction.
- objectterm
objectterm() procedure needs to contain the code to terminate external module application (typically End statement).

External modules interface
The class name should be set using External Modules interface available from Tools menu of PIC Simulator IDE. External client/server applications will be started and terminated automatically with PIC Simulator IDE.