Get_Encoder_Dir(1)
This function retrieves the current direction (CW or CCW) of the encoder. Note that this
function is not required to get the current direction as it is continuously updated in the
ENC#_Dir variable. However, at low velocity, the direction indicated may not be accurate in the
ENC#_DIR variable. You must check the ENC#_VEL variable to verify if there is no velocity.
Data Values
ENC#_Dir Variable that is updated with the direction of the encoder
# can be 1 or 2
Parameters
ENC# Identifies which Encoder channel is to be read
• can be ENC1 or ENC2
Returns
Encoder direction (0 = stopped, -1 = reverse, 1 = forward)
Error Codes
Bad_ID = an incorrect ENC ID was used.
Examples
User1 = Get_Encoder_Dir(ENC1)
or
User1 = ENC1_Dir
Get_Encoder_Error(1)
This function retrieves the current error status of the encoder. Note that this function is not
required to get the current status as it is continuously updated in the ENC#_Error variable.
Data Values
ENC#_Vel Variable that is updated with the value of the ADC
channel. # can be 1 or 2
Parameters
ENC# Identifies which Encoder channel is to be read
• can be ENC1 or ENC2
Returns
Status (0 = OK, 1 = Channel A error or 2 = Channel B error)
Error Codes
Bad_ID = an incorrect ENC ID was used.
Examples
User1 = Get_Encoder_Error(ENC1)
or
User1 = ENC1_Error
1310 Vehicle Control System Users Manual Release Rev B Page 36 of 51