PIC10 Simulator IDE
External Modules Manual


Table Of Contents:

General info
pic10simulatoride.server,

Functions and procedures
getpic, getpath, getinst, getcrystal, getclockcycles, getpc, getw, getflash, geteeprom, getreg, setreg, setregbit, getstack, getportstate, setpinstate, getanalog, setanalog, extsimstart, extsimstop, extsimstep, extsimrate,

External client/servers
objectinit, objectrefresh, objectterm, External modules interface,


General info
PIC10 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.

pic10simulatoride.server
External client application can access PIC10 Simulator IDE server services by creating an ActiveX object using pic10simulatoride.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-127].
- setreg
setreg(address,value) procedure will set the new register value, 'address' argument [0-127], 'value' argument [0-255].
- setregbit
setregbit(address,bit,value) procedure will set the new value for the specified register bit, 'address' argument [0-127], 'bit' argument [0-7], 'value' argument [0-1].
- getstack
getstack(level) function will return the value stored in one of the stack levels [1-2].
- getportstate
getportstate(address) function will return the real logic levels on the port 'address' argument [5(PORTA)-9(PORTE)].
- setpinstate
setpinstate(port,pin,state) procedure will set the logic level on the addressed pin, 'port' argument [5(PORTA)-9(PORTE)], '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-7].
- setanalog
setanalog(an,value) procedure will set the analog value on the addressed analog input, 'an' argument [0-7], 'value' argument [0-255].
- 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 PIC10 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 PIC10 Simulator IDE. External client/server applications will be started and terminated automatically with PIC10 Simulator IDE.