User manual

Copyright © Dr Robot Inc. 2005
41
Return value: short ival;
Return data interpretation:
The return data is the raw value of the analog to digital converter indicating the motor
current. The data range is between 0 and 4095. The real current can be calculated with the
following formula:
Motor Current (A) = (ival * 3 *375 / 200 /4095) = ival / 728
III.1.10 Encoder
58 short GetEncoderDir1();
59 short GetEncoderDir2();
60 short GetEncoderPulse1();
61 short GetEncoderPulse2();
62 short GetEncoderSpeed1();
63 short GetEncoderSpeed2();
Description:
GetEncoderDirX returns +1, 0 or -1 to indicate the direction of rotation.
GetEncoderPulseX returns the current pulse counter to indicate the position of rotation.
GetEncoderSpeedX returns the current speed of rotation.
Syntax: ival = GetEncoderDir1(); // direction of channel #1
ival = GetEncoderDir2(); // direction of channel #2
ival = GetEncoderPulse1(); // pulse counter of channel #1
ival = GetEncoderPulse2(); // pulse counter of channel #2
ival = GetEncoderSpeed1(); // speed of channel #1
ival = GetEncoderSpeed2(); // speed of channel #2
Parameter: void
Return value: short ival;
Return data interpretation:
(1) GetEncoderDirX returns -1, 0 or 1. 1 stands for positive direction, -1 stands for negative
direction, and 0 stands for no movement.
(2) GetEncoderPulseX returns pulse counter. It is an integral value to rotation with range
of 0 ~ 32767 in cycles.
(3) GetEncoderSpeedX returns the rotation speed. The unit is defined as pulse change
within 1 second. And it is the absolute value.
See also: SetDcMotorSensorUsage().