Jan 29, 2007 #1 K Kuzito Newbie level 6 Joined Nov 5, 2006 Messages 14 Helped 2 Reputation 4 Reaction score 2 Trophy points 1,283 Activity points 1,459 atmega 24c16 Hello all, Im beginner and try to connect I2C 8bit serial eeproms 24C02 and 24C16 to ATMEGA16. There is code and work great with 24C02 because this eeprom have addresses from 0x00 to 0xFF. Code: #define EEPROM_BUS_ADDRESS 0xa0 eeprom_read_8bit(unsigned char address) { i2c_start(); i2c_write(EEPROM_BUS_ADDRESS); i2c_write(address); i2c_start(); i2c_write(EEPROM_BUS_ADDRESS | 1); data=i2c_read(0); i2c_stop(); } I need help how to read from 8bit serial eeprom 24C16 if address is over 0xFF - 0x120 in example. For 16bit serial eeproms I send LOW and HIGH address and work with next code: Code: eeprom_read_16bit(unsigned char address_high, unsigned char address_low) { i2c_start(); i2c_write(EEPROM_BUS_ADDRESS); i2c_write(address_high); i2c_write(address_low); i2c_start(); i2c_write(EEPROM_BUS_ADDRESS | 1); data=i2c_read(0); i2c_stop(); } Thanks in advance, Kuzito
atmega 24c16 Hello all, Im beginner and try to connect I2C 8bit serial eeproms 24C02 and 24C16 to ATMEGA16. There is code and work great with 24C02 because this eeprom have addresses from 0x00 to 0xFF. Code: #define EEPROM_BUS_ADDRESS 0xa0 eeprom_read_8bit(unsigned char address) { i2c_start(); i2c_write(EEPROM_BUS_ADDRESS); i2c_write(address); i2c_start(); i2c_write(EEPROM_BUS_ADDRESS | 1); data=i2c_read(0); i2c_stop(); } I need help how to read from 8bit serial eeprom 24C16 if address is over 0xFF - 0x120 in example. For 16bit serial eeproms I send LOW and HIGH address and work with next code: Code: eeprom_read_16bit(unsigned char address_high, unsigned char address_low) { i2c_start(); i2c_write(EEPROM_BUS_ADDRESS); i2c_write(address_high); i2c_write(address_low); i2c_start(); i2c_write(EEPROM_BUS_ADDRESS | 1); data=i2c_read(0); i2c_stop(); } Thanks in advance, Kuzito