diff --git a/pic/MDR/I2C.c b/pic/MDR/I2C.c index 3da593e..54b2056 100644 --- a/pic/MDR/I2C.c +++ b/pic/MDR/I2C.c @@ -120,12 +120,12 @@ uint8_t read_byte(uint8_t ack) for (bit=0; bit<8; bit++) { delay(); /* wait for SDA to change */ release_SCL(); /* SDA should be valid when clock is high */ + byte <<= 1; /* make place to save the next bit */ if (PORTB&SDA) { /* read bit */ byte += 1; } else { byte += 0; } - byte <<= 1; hold_SCL(); /* set clock to low for SDA to change */ } if (ack) {