HI
Ich habe hier testweise fr IC Master lib von Fleury ein kleines EEprom angeschlossn. Ein PortExpander zum schreiben funktioniert einwandfrei.
Das EEProm auslesen aber leider nicht
Ist grtenteils eigentlich der Beispielcode vom Peter Fleury...Code:int main(void) { unsigned char ret = 0; USART_INIT( MYUBRR); USART_Puts("EEPROM \n \r"); i2c_init(); // init I2C interface /* write 0x75 to eeprom address 0x05 (Byte Write) */ ret = i2c_start(DevAdd_W); // set device address and write mode _delay_ms(5); if ( ret ) { /* failed to issue start condition, possibly no device found */ i2c_stop(); USART_Puts("Start Failed"); }else { /* issuing start condition ok, device accessible */ i2c_write(0x20); // write address = 5 _delay_ms(5); i2c_write(0x75); _delay_ms(5); i2c_stop(); // set stop conditon = release bus i2c_start_wait(DevAdd_W); i2c_write(0x20); _delay_ms(5); i2c_rep_start(DevAdd_R); // set device address and read mode _delay_ms(5); ret = i2c_readNak(); // read one byte i2c_stop(); USART_Puts("Read from EEPROM: "); USART_Puts(ret); USART_Puts("\n\r"); } for(;;); }
Im Hypterterm ist aber folgendes zusehen
Ich bin jetzt schon am timing rumspielen wie ihr seht, aber irgendwie wills ned so rechtEEPROM
Read from EEPROM: †uI˜~!%R8v…EDDU„f‰š0ƒŽ
`"’k
“€0$@.
ˆ
Seht ihr den Fehler..
Mfg Bubi
Achja Pullups hab ich[/highlight]







Zitieren

Lesezeichen