
AN-895
Rev. 0 | Page 16 of 16
IMPLEMENTATION OF THE SERIAL EEPROM
PROTOCOL
This section covers the implementation of the five commands
supported by the serial EEPROM specifications in the case of a
single I
2
C address:
• Current address read
• Random read
• Random write
• Sequential read
• Sequential write
In the interrupt service routine, the status register must be read
once and its value saved. The flowchart of the interrupt service
routine is shown in
Figure 22.
0
6
5
4
9
-
0
1
9
FALSE
TRUE
BIT 2 SET
READ
BIT 3 SET
WRITE
BIT 10 SET
STOP
STATUS
FIRST
I2C0STX=
DAT[++BYTE ADDR]
FIRST = TRUE
FIRST = FALSE
BYTE_ADDR=
I2C0SRX
FLUSH T
X
FIFO
I2C0STX=
DAT[BYTE_ADDR]
I2C0STX=
DAT[++BYTE_ADDR]
FLUSH T
X
FIFO
GET DATA
RETURN
Figure 22. Slave Interrupt Service Routine
See AN-895 Companion Code.zip for companion codes.
Command Codes
I
2
C Configuration
I2CCFG = 0x4001; // Enable slave, enable STOP detect
I2C0ID0 = 0xA0; // Slave ID
I2C0STX = dat[0]; // Set initial data
Variable Initialization
Byte_addr = 0
First = 1
Enable I
2
C Slave Interrupt
IRQEN = 0x200; // I2C0 Slave Interrupt
while (1) // Wait for interrupt
Purchase of licensed I
2
C components of Analog Devices or one of its sublicensed Associated Companies conveys a license for the purchaser under the Philips I
2
C Patent
Rights to use these components in an I
2
C system, provided that the system conforms to the I
2
C Standard Specification as defined by Philips.
©2007 Analog Devices, Inc. All rights reserved. Trademarks and
registered trademarks are the property of their respective owners.
AN06549-0-1/07(0)
Kommentare zu diesen Handbüchern