Hi ich bekomme immer 0x80 zurückgeschickt.
weiss nicht mehr weiter hier mein code.
DankeCode:unsigned char read_pcf8591(unsigned char adc) { unsigned char ret; unsigned char byte = 0; ret = i2c_start(pcf8591_address+I2C_WRITE); // Sende Start Condition if(ret!=0) { i2c_stop(); uart_puts("Io1f"); return 0; } ret = i2c_write(0); // Senden des Control Bytes startet die A/D Wandlung i2c_stop(); // Sende Stop Condition, Bus freigeben*/ delay_ms(1); // Warten bis A/D Wandlung benedet (mind. 90µs) ret = i2c_start(pcf8591_address+I2C_READ); // Sende Start Condition // Mehrmaliges Lesen um alte A/D Werte zu ignorieren byte = i2c_readAck(); // Lese Byte + no acknowledge*/ byte = i2c_readNak(); // Lese Byte + no acknowledge*/ i2c_stop(); // Sende Stop Condition, Bus freigeben return byte; }![]()







Zitieren

Lesezeichen