Emulating AT90S1200 and ATtiny10/11 (Appendix)
Using the Include Files
Always use include files for the I/O registers addresses and for bit definitions in your source code files. This will ease the process of porting code from one microcontroller to another. The files can be found on the CD-ROM which is included in the ICE200 kit. Copy the include file to your project directory, and include it in the top of the programs code as shown below:

(AVR Assembler example)

   .include "1200def.inc"


Then, when writing a value to a I/O register, use the following notation :

(AVR Assembler example)

   ldi     r16, (1<<DDD1) + (1<<DDD4)     ; Set port D pin 1 and 4 as output and the rest as input
   out     DDRD, r16
Note the use the bit definitions. DDD1 and DDD4 are pin definitions in form of bit position, and therefore they must be shifted this number of bits to the left to make a correct mask.

Interrupt vector locations might differ from part to part. This is easily handled by using the vector definitions found in the include files.

(AVR Assembler example)

.include "1200def.inc"
.org   0
       rjmp    RESET_Handler
.org   INT0addr
       rjmp    INT0_Handler
.org   OVF0addr
       rjmp    OVF0_Handler
.org   ACIaddr
       rjmp    ACI_Handler
       ... ( program code starts here )
Using the ATtiny12 Adapter for Emulating the ATtiny10/11
The ATtiny10 and 11 are both subsets of ATtiny12. Therefore it is possible to select the ATtiny12 device when configuring the ICE200 to support either ATtiny10 or ATtiny11. These devices all have the same pinout, but ATtiny10/11 does not have the following features : Also note that the startup times slightly differs between the parts. Please refer to the datasheets for more detailed information.

Using the AT90S2313 Adapter for Emulating the AT90S1200
The AT90S1200 can be defined as a subset of AT90S2313. They have the same pinout, but AT90S1200 does not have the following features :

Avoiding the use of these features and using only half the program and EEPROM memories allows the AT90S2313 to be used when emulating AT90S1200.

IMPORTANT!
Since the AT90S2313 uses a stack pointer, this has to be initialized. The simplest way is include the following lines at the top of the program code :

( AVR Assembler example )

   ldi     r16, 0xDF    ; Set the stack pointer to point at the highest SRAM address
   out     0x3D, r16
Note that this gives more than 3 levels of stack. This means that programs working in emulator using the AT90S2313 might not work in a real AT90S1200 device. Always check that the number of stack locations used does not exceed 6 bytes (equals 3 levels).

The AT90S2313 has no RC oscillator, so this feature found on the AT90S1200 can not be supported.

Use the AT90S2313 include file when emulating AT90S1200 to get the interrupts placed on the right locations.

See Also