RoboteQ AX2550/2850 ユーザーズマニュアル

ページ / 180
Installing, Connecting and Using the Encoder Mod-
142
AX2500/2850 Motor Controller User’s Manual
 Version 1.7. February 1, 2005
Details on software updating is given in section Figure , “Updating the Encoder Software,” 
on page 152
.
RS232 Encoder Command Set
The Encoder module responds to a dedicated set of commands and queries.
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 87.
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 is 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 it is read so that the next read query returns the 
new number of counts since the last time the counter was read.
Additionally, in a couple 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