Licenses Contact


20th Anniversary

20th Anniversary of the
(2001 - 2021)

AVR Simulator IDE
External Modules Manual

Table Of Contents:

General info

Functions and procedures

External client/servers

• General info
AVR 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 AVR Simulator IDE server services by creating an ActiveX object using avrsimulatoride.server class.

• Functions and procedures
Here is the list of functions and procedures available for external client applications:
- getavr
getavr() function with no arguments will return the selected AVR 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.
- 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 data memory registers (composed by general purpose working registers, I/O registers and internal data SRAM) specified by 'address' argument [0-(max available)].
- setreg
setreg(address,value) procedure will set the new register value, 'address' argument [0-(max available)], 'value' argument [0-255].
- setregbit
setregbit(address,bit,value) procedure will set the new value for the specified register bit, 'address' argument [0-(max available)], 'bit' argument [0-7], 'value' argument [0-1].
- getportstate
getportstate(address) function will return the real logic levels on the port 'address' argument [5(PORTA)-15(PORTL)].
- setpinstate
setpinstate(port,pin,state) procedure will set the logic level on the addressed pin, 'port' argument [5(PORTA)-15(PORTL)], '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 AVR 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 AVR Simulator IDE. External client/server applications will be started and terminated automatically with AVR Simulator IDE.