Product Documentation
For example to read the battery voltage, send:
0x00 - sync byte
0x26 - READ VOLTS command
and the MD49 would respond with
0x18 - returned byte (24 decimal) 24v
Speed1
Depending on what mode you are in, this register can affect the speed of one motor or both motors. If
you are in mode 0 or 1 it will set the speed and direction of motor 1. The larger the number written to
this register, the more power is applied to the motor. A mode of 2 or 3 will control the speed and
direction of both motors (subject to effect of turn register).
Speed2/Turn
When in mode 0 or 1 this operates the speed and direction of motor 2. When in mode 2 or 3 Speed2
becomes a Turn value, and is combined with Speed1 to steer the device (see below).
Turn mode
Turn mode looks at the speed1 to decide if the direction is forward or reverse. Then it applies a
subtraction or addition of the turn value on either motor.
so if the direction is forward
motor speed1 = speed1 - turn
motor speed2 = speed1 + turn
else the direction is reverse so
motor speed1 = speed1 + turn
motor speed2 = speed1 - turn
If the either motor is not able to achieve the required speed for the turn (beyond the maximum output),
then the other motor is automatically changed by the program to meet the required difference.
GET ENCODER 1, GET ENCODER 2 or GET ENCODERS
When a read encoder command is issued the MD49 will send out 4 bytes high byte first, which should
be put together to form a 32 bit signed number. For example a GET ENCODER 1 command may return
0x00,0x10,0x56,0x32.
So declare a 32 bit signed variable in your program, for C:
long result;
result = serin() << 24ul; // (0x00 shifted 24 bits left)
result += serin() << 16ul; // (0x10 shifted 16 bits left)
result += serin() << 8ul; // (0x56 shifted 8 bits left)
result += serin(); // (0x32)
result now equals 1070642 decimal or 0x105632 hex. If the highest bit was set then it would be -ve.
read encoders will send encoder count 1 and then encoder count 2 but is put together in exactly the
same way. The registers can be zeroed at any time by writing 0x35 to the MD49.
Battery volts
A reading of the voltage of the connected battery is available. It returns the voltage in volts (24 for
24v).