!q or !Qn

While resetting is a single step command, setting the counters to a non-zero value requires two steps: 1- load a 4 byte buffer (32-bit) with the desired value. 2- Transfer the buffer’s content to the counter(s). Loading the buffer can be done using the commands described in “Read / Modify Encoder Module Registers and Parameters” on page 162. The buffer will also be altered after a Counter Read command, in which case it will contain the last read counter value.

Syntax:

!q or !Qn

Where n=

0: Reset Encoder 1 counter

 

1: Reset Encoder 2 counter

 

2: Reset both Encoder counters

 

4: Set Encoder 1 counter with value in buffer

 

5: Set Encoder 2 counter with value in buffer

 

6: Set both Encoder both counters with value in buffer

 

7: Set Encoder 1 destination register with value in buffer

 

8: Set Encoder 2 destination register with value in buffer

Reply:

+ if command was properly received and executed

 

- if an error occurred

Examples:

 

!Q2

Reset both counters

!Q5

Load value contained in buffer into counter 2

?Q0, followed by

 

!Q1

Read counter 1 and copy its value into counter 2

Read Speed

Description:

This query will cause the controller to return the speed computed by the Encoder module. The values are signed Hexadecimal numbers ranging from -127 to +127. The -127 value rep- resents the maximum RPM in the reverse direction. +127 represents the maximum RPM in the forward direction. The relation of this relative number and the actual, absolute RPM value depends on the encoder’s resolution and a user programmable Time Base. See “Using the Encoder to Measure Speed” on page 84 for a detailed discussion.

Syntax:

?z or ?Z

Reply:nn mm

Where:nn = speed 1 value

mm= speed 2 value

Notes:

The command returns a signed hexadecimal number where 0 to +127 is represented by 00 to 7F, and -1 to -127 is represented by FF to 80 respectively. The hexadecimal format is intended to be deciphered by a microcontroller. When exercising the controller manually, you may use the Decimal to Hexadecimal conversion table on page 171.

160

AX3500 Motor Controller User’s Manual

Version 1.9b. June 1, 2007

Page 160
Image 160
RoboteQ user manual Read Speed, q or !Q n, Syntax, AX3500 Motor Controller User’s Manual