User`s manual
ROBOT . HEAD to TOE
Product User’s Manual – SD02B
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved
34
d. AND the 16 bits variable with 0xFF00
11010110XXXXXXXX
2
AND 1111111100000000
2
= 1101011000000000
2
e. After received higher 8 bits encoder value, host will receive the lower 8 bits encoder
value from SD02B. Save the lower 8 bits encoder value to another 16 bits variable.
x x x x x x x x 0 1 1 1 0 1 1 0
f. AND the 16 bits variable with 0x00FF
XXXXXXXX01110110
2
AND 0000000011111111
2
= 00000000001110110
2
g. To get 16 bits encoder value, Exclusive-OR the two 16 bits variables and store it to a
16 bits variable.
Encoder value = 1101011000000000
2
XOR 0000000001110110
2
= 1101011001110110
2
= 54902 (16 bits encoder value)
Track encoder value
a. Host needs to send command 3 bytes of commands to SD02B to track encoder value.
When the steps counted are equal to the value sent by host, SD02B will brake the
stepper motor.
i. 1
st
byte: Send command ‘T’ to track encoder and brake motor
ii. 2
nd
byte: Send higher 8 bits encoder value
iii. 3
rd
byte: Send lower 8 bits encoder value
b. 2
nd
byte and 3
rd
byte sent to SD02B are 16 bits encoder value for encoder tracking
(number of steps to go before SD02B brakes the stepper motor). For example, if user
wants stepper motor to brake when encoder value equals to 54902. Host needs to send
this value (1101011001110110
2
) to SD02B. Higher 8 bits is to be sent before the
lower 8 bits encoder value.
1 1 0 1 0 1 1 0 0 1 1 1 0 1 1 0
16 bits encoder value
Higher 8 bits encoder value Lower 8 bits encoder value