Quadrature

The Quadrature instruction is used to measure the output from an incremental encoder.

Syntax

Quadrature ( Dest, Port, Option, Mult )

Remarks

The Quadrature instruction is used with single ended type (A and B) quadrature encoders. A digital port pair is used to monitor the two control tracks of the encoder. The instruction calculates the displacement and direction of the encoder.

Parameters

Dest (Destination)

The variable array in which to store the results of the measurement. Dest must be dimensioned to four to hold the following values:

Type: Variable Array

Port

Specifies which digital port pair to use for monitoring sensor channels A and B, respectively. Valid ports are:

Code Description
C1 Control Ports 1 and 2
C3 Control Ports 3 and 4
U1 Universal Ports 1 and 2
U3 Universal Ports 3 and 4
U5 Universal Ports 5 and 6
U7 Universal Ports 7 and 8
U9 Universal Ports 9 and 10
U11 Universal Ports 11 and 12

Type: Constant

Option

Determines how each channel is counted.

Code Description
0 X1 - Counts will increase on rising edge of Channel A when Channel A leads Channel B. Counts will decrease on falling edge of Channel A when Channel B leads Channel A.
1 X2 - Counts will increase at each rising and falling edge of Channel A when Channel A leads Channel B. Counts will decrease at each rising and falling edge of Channel A when Channel A leads Channel B.
2 X4 - Counts will increase at each rising and falling edge of both channels when Channel A leads Channel B. Counts will decrease at each rising and falling edge of both channels when Channel B leads Channel A.

Type: Constant

Mult (Multiplier)

Constant, variable, array, or expression by which to scale the results of the measurement.