Hi guys,
What of these follow bytes (description bellow) I need to send over IIC readwrite command?
I try the follow “\xD0\x22\x00\x12\x34” but no success. I found some examples using only the address but I think it is not the case.
Thanks in advance.
Daniel
Description:
Space temperature can be read from memory locations 0x12 (hi byte) and 0x13 (low
byte).
To do this a sequence of two I2C frames has to be sent to the sensor: first send a I2C
write frame containing the sensor address, command number and how many bytes to
read, RAM address to read from, and a checksum. Then send a I2C read frame to read
the status, data and checksum. See chapter 2 for details.
In this case 2 bytes starting from address 0x12 should be read. This will give data from
address 0x12 and 0x13, which contains current space temperature. The sensor address
is 0x68 (default factory setting, configurable in EEPROM).
So, the first frame should look like:
Start | 0xD0 | 0x22 | 0x00 | 0x12 | 0x34 | Stop
g. 0xD0 is Sensor address and read/write bit. 0x68 shifted one bit to left and R/W bit is 0 (Write).
h. 0x22 is command number 2 (ReadRAM), and 2 bytes to read
i. Checksum 0x34 is calculated as sum of byte 2, 3 and 4.
The next frame will read the actual data:
Start | 0xD1 | <4 bytes read from sensor> | Stop
j. The 1:st byte from the sensor will contain operation status, where bit 0
tells us if the read command was successfully executed.
k. The 2:nd and 3:rd byte will contain space temp value hi byte and space
temp value low byte.
l. The 4:th byte contains checksum