| cmdMO_ENC32 | Index |
Command Code:
The Packet:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |||||||
| address | 6 | cmdMO_ENC32 | moID | ENC3 | ENC2 | ENC1 | ENC0 |
| moID - | The channel (zero based) whose 32-bit encoder value is to be changed or retrieved. |
| ENC3 - | Byte 3 of the new setting. |
| ENC2 - | Byte 2 of the new setting. |
| ENC1 - | Byte 1 of the new setting. |
| ENC0 - | Byte 0 of the new setting. |
Description:
This command is only available on BrainStem modules with the motion control feature.
The cmdMO_ENC32 command is used to access a 32-bit "odometer". If the four-byte value is missing, the command will return a packet with the current 32-bit reading for the specified channel.
In every PID loop step, the PID routine adds the distance traveled during the last iteration to a 32-bit encoder accumulator. This provides a method for measuring long distances.
When driving stepper motors, each step increments or decrements the 32-bit odometer.
In modes that use analog feedback, the 32-bit encoder value will be meaningless.
Changes introduced in Moto 1.0 Firmware Build 8
The 32-bit odometer value will be meaningless in encoder-based position control mode (ENCPOS).
When the command contains two bytes, the cmdMO_ENC32 code and a moID byte of 2, the reply will be eight bytes. The first 2 bytes echo the cmdMO_ENC32 code and moID byte. The next 3 bytes contain the lower 3 bytes of the 32-bit odometer value for channel 0. The last 3 bytes contain the lower 3 bytes of the 32-bit odometer value for channel 1. In the following example, the channel 0 odometer reading is 8107 (0x001FAB) and the channel 1 reading is 8160 (0x001FE0).
| Console Command | Sample Reply |
| 4 66 2 | 04:42,02,00,1F,AB,00,1F,E0 |