RoboteQ AX2550 Manual Do Utilizador

Página de 186
AX1500 Motor Controller User’s Manual
145
RS232 Encoder Command Set
RS232 Encoder Command Set
When present, the Encoder module responds to a dedicated set of commands and que-
ries.
The serial port setting and basic command format is identical to this for all other functions 
of the controller as described in “Serial (RS-232) Controls and Operation” on page 121.
Read Encoder Counter
Description:
Read the value of the Encoder counter(s). The number is a signed 32 bit number that may 
range from -2,147,836,648 to +2,147,836,647. The value is output in Hexadecimal format of 
value 80000000 to 7FFFFFFF respectively. To speed up communication, only the signifi-
cant digits are sent in response to a counter query. For example, if the counter contains the 
value +5 (which is the same number in decimal and hex), the response to the query will be 
5 and not 00000005. The formatting algorithm takes into account the number’s sign. 
Details on the data format are given in section 
Counters’ values can be read as Absolute or Relative. An Absolute counter read will return 
the full counter value after every read query. In a Relative counter read, the counter value is 
immediately cleared immediately after being read so that the next read query returns the 
new number of counts since the last time the counter was read.
Additionally, in a few of the query modes, the Encoder module returns the sum for both 
counters. This is useful for measuring the average travelled distance by the right and left 
wheels of a robotic vehicle.
Syntax:
?q or Qn
Where n=
0: Encoder 1, Absolute
1: Encoder 2, Absolute
2: Sum of Encoders 1 and 2, Absolute
4: Encoder 1, Relative
5: Encoder 2, Relative
6: Sum of Encoders 1 and 2, Relative
Reply:
nnnnnnnn
Where:
nnnnnnnn = counter value using 1 to 8 Hex digits. See “Counter Read 
Examples:
?Q0
Read Encoder 1, Absolute
?Q5
Read Encoder 2, Relative
Set/Reset Encoder Counters and Destination Registers
Description:
Set one or both counters to zero or a user-defined value. The value is a signed 32 bit num-
ber that may range from -2,147,836,648 to +2,147,836,647 (Hexadecimal format of value 
80000000 to 7FFFFFFF respectively.