Các bác cho em hỏi tý:
int8 read_I2C(int8 slave_addr)
{
int8 value_re;
i2c_start();
i2c_write(slave_addr + 1);
value_re = i2c_read(0);
i2c_stop();
return value_re;
}
Khi nào thì dùng i2c_read(0),khi nào thì dùng i2c_read(1).
Có phải là(???):i2c_read(1):ra dấu ACK,tiếp tục nhận dữ liệu
i2c_read(0):ra dấu NACK,báo quá trình nhận dữ liệu kết thúc.
Như vậy là code trên nhận đúng 1byte phải không ạ?Em nghĩ thế ko biết đúng hay sai?
|