Example program provided by Embedded Systems Academy, Copyright 2000 Visit www.esacademy.com/faq/progs for more examples This example: I2CEEPROM - name of application: main.c ==================================================== Demonstration of talking to an EEPROM on the I2C bus. Hardware requirements ===================== Phytec RDK 591 with Philips 591 Software requirements ===================== Phytec Flash Tools (part of RDK 591) www.phytec.com Raisonance 8051 compiler system - EVAL version sufficient www.raisonance.com or Keil 8051 Compiler System - EVAL version sufficient www.keil.com Optional: Development Assistant-C by RistanCASE www.ristancase.ch Tested using ============ Raisonance 51 Toolset version 6.1.1 Keil C51 Toolset version 6.00 Application description ============================================= Raisonance specific files have their names prefixed with 'r'. Keil specific files have their names prefixed with 'k'. The same source files are used for both compilers. This program stores a byte in the serial EEPROM then reads it back complete with error checking and timeout recovery The program results are output through the UART. Connect using: 9600 baud, 8-N-1, no flow control. This program does not demonstrate writing whole pages to the EEPROM. The Serial EEPROM is 4kb in size, therefore valid addresses are 000H - FFFH eeprom_write_byte and eeprom_read_byte do not return until there is either an error or a successful storage. Both functions wait up to 22ms for the EEPROM to be ready using a polling method. The status may be read in the variable i2c_status and will be I2C_OK or I2C_ERROR