User`s manual
ROBOT . HEAD to TOE
Product User’s Manual – SD02B
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved
35
c. To get higher 8 bits, rotate/shift the 16 bits value 8 times to the right.
1 1 0 1 0 1 1 0
0 1 1 1 0 1 1 0
0
1 1 0 1 0 1 1 0
0 1 1 1 0 1 1
shift 1
st
times
1 0
1 1 0 1 0 1 1 0
0 1 1 1 0 1
shift 2
nd
times
1 1 0
1 1 0 1 0 1 1 0
0 1 1 1 0
shift 3
rd
times
0 1 1 0
1 1 0 1 0 1 1 0
0 1 1 1
shift 4
th
times
1 0 1 1 0
1 1 0 1 0 1 1 0
0 1 1
shift 5
th
times
1 1 0 1 1 0
1 1 0 1 0 1 1 0
0 1
shift 6
th
times
1 1 1 0 1 1 0
1 1 0 1 0 1 1 0
0
shift 7
th
times
0 1 1 1 0 1 1 0
1 1 0 1 0 1 1 0
shift 8
th
times
d. After rotated/shifted 8 times, AND the value with 0x00FF and save it into an 8 bits
variable.
0111011011010110
2
AND 0000000011111111
2
= 0000000011010110
2
= 11010110 (higher 8 bits)
d. To get lower 8 bits, AND the same 16 bits encoder value with 0x00FF and save it into
another 8 bits variable.
1101011001110110
2
AND 0000000011111111
2
= 0000000001110110
2
= 01110110
2
(lower 8 bits)
e. Send ‘T’ to SD02B first. Then send the higher 8 bits, followed by the lower 8 bits.