Gast
#586974
hallo, ich finde den fehler nicht warum ich mittels i2c das eeprom 24c16 nicht lesen und beschreiben kann. hat jemand eine Idee?? elektrischer anschluss pin 1 bis4 auf masse 7 und 8 auf vcc 6 clock 5 sda. ich benutze das pollin board. mittels i2c kann ich einen PCF8574 einwandfrei ansteuern(externe platine). Ich habe 2 boards > beide gleiche Fehlererscheinung (sind ok) mehrere EEPROMs ausprobiert prozessortakt runtergesetzt als compiler mehme ich codevision avr meine routinen habe ich beigefügt, ich komme nicht dahinter warum das nicht funktionieren will?? Danke schon mal für eure tips! gruß peter // I2C Bus functions #asm .equ __i2c_port=0x15 ;PORTC .equ __sda_bit=1 .equ __scl_bit=0 #endasm #include <i2c.h> #define EEPROM_BUS_ADDRESS 0xa0 /* read a byte from the EEPROM */ unsigned char eeprom_read(unsigned char address) { unsigned char data; i2c_start(); i2c_write(EEPROM_BUS_ADDRESS); i2c_write(address); i2c_start(); i2c_write(EEPROM_BUS_ADDRESS | 1); data=i2c_read(0); i2c_stop(); return data; } /* write a byte to the EEPROM */ void eeprom_write(unsigned char address, unsigned char data) { i2c_start(); i2c_write(EEPROM_BUS_ADDRESS); i2c_write(address); i2c_write(data); i2c_stop(); /* 10ms delay to complete the write operation */ delay_ms(10); }