B5WC Built- In Color Sensor User's Manual ( E612- E1- 01) 20
(3) Checksum
The calculated checksum is output as the final byte of the transmitted data using the following
calculation method.
[Calculation Method]
Initial value: 0xFF Formula: XOR of all Read data
[Example calculations]
An example of reading 6 bytes of RGB values is shown below.
Read data:
data
address
0x02
RGB value :R
(LSB)
0x03
RGB value :R
(MSB)
0x04
RGB value :G
(LSB)
0x05
RGB value :G
(MSB)
0x06
RGB value :B
(LSB)
0x07
RGB value :B
(MSB)
value 0xAD 0x01 0x23 0x02 0xDE 0x03
Checksum:
Checksum = 0xFF(Initial value) XOR 0xAD XOR 0x01 XOR 0x23 XOR 0x02 XOR 0xDE XOR 0x03
= 0xAF