;**** A P P L I C A T I O N N O T E A V R 3 0 2 ************************
;*
;* Title : I2C Slave Implementation
;* Version : 1.2
;* Last updated : 97.07.17
;* Target : AT90Sxxxx (All AVR Device)
;* Fast Mode: AT90S1200 only
;*
;* Support email : avr@atmel.com
;*
;* Code Size : 160 words
;* Low Register Usage : 0
;* High Register Usage : 5
;* Interrupt Usage : External Interrupt0,
;* Timer/Counter0 overflow interrupt
;*
;* DESCRIPTION
;* This application note shows how to implement an AVR AT90S1200 device
;* as an I2C slave peripheral. For use with other AT90S AVR devices, other
;* I/O pins might have to be used, and the stack pointer might have to be
;* initialized.
;* Received data is stored in r0 and r0 is transmitted during a master
;* read transfer. This simple protocol is implemented for demonstration
;* purposes only.
;*
;* Some features :
;* * Interrupt based (using INT0 and TIM0).
;* * The device can be given any 7-bit address. (Expandable to 10bit).
;* * Supports normal and fast mode.
;* * Easy insertion of "wait states".
;* * Size and speed optimized.
;* * Supports wake-up from idle mode.
;*
;* Refers to the application note AVR302 documentation for more
;* detailed description.
;*
;* USAGE
;* Insert user code in the two locations marked "insert user code here".
;*
;* NOTES
;* Minimum one instruction will be executed between each interrupt.
;*
;* STATISTICS
;* Code Size : 160
;* Register Usage : 5 High, 0 Low
;* Interrupt Usage : EXT_INT0 and TIM0_OVF
;* Port Usage : PD4(T0) and PD2(INT0)
;* XTAL : - I2C Fast Mode : min 16.0MHz
;* - I2C Standard Mode : min 3.0MHz
;*
;***************************************************************************
;**** Includes ****
.include "1200def.inc"
;**** Global I2C Constants ****
.equ devadr = 0x50 ; Slave device address
.equ devadrm = 0x7F ; Slave multi address mask
.equ pinmask = 0x14 ; <=> (1<