UI Robot Technology Co. Ltd.
M4220170607EN
Page 53
Miniature Integrated Stepper Motor Controller(
Closed-loop
)
9.0
ENCODER AND CLOSED-LOOP
CONTROL
Quadrature Encoder (also known as Incremental Encoder or Optical Encoder) is used for
tracking the angular position and velocity of rotary motion. It can be applied for closed-loop
control of various motors. A typical quadrature encoder consists of a slotted wheel for motor
shaft and a transmitter/detection module for detection of the slot on the wheel. Usually
there are 3 channels - channels A, B and Z (INDEX). Information from the three channels
can be read and decoded to provide motion status of shaft, including position and velocity.
The relationship between channel A (QEA) and channel B (QEB) is as simple as which
phase leads. When phase A leads B, then the shaft is rotating in the clockwise direction.
When phase B leads A, then the shaft is rotating in the counter-clockwise direction.
Channel Z is called index pulse which is generated per revolution as a reference for
tracking of absolute position.
The quadrature signals from encoder can be decoded into four types of messages, the
order of which reverse when rotation direction is reversed. The phase signals and index
pulses are detected by encoder and further decoded to produce a count up pulse (for one
direction of shaft rotation) or a countdown pulse (for the other direction of shaft rotation).
UIM2842 controller has a built-in quadrature encoder (hereinafter referred to as encoder)
interface circuit, which is capable of decoding encoder signals of less than 200KHz input.
Another option is user can connect external encoder of their own choice to UIM2842
controller, using S1 and S2 ports for channel A and B. In this case, however, INDEX
decoding function is not available. S1/S2 supports 0-5V TTL input. The input range for S1
and S2 ports of UIM2842 controller is -0.3V ~ 5.3V. Any input beyond this range can result
in permanent damage. Also, for this case, encoder power supply is to be provided by user.
For UIROBOT UIM2842 controller with internal encoder, the S1 and S2 ports are not
occupied and therefore are available for sensors. Whether the encoder is built-in or
external, the controlling mode and the instructions are the same.
Instructions relative to encoder control function are listed below:
Instruction Function
Example
1
MCF
enable encoder function
MCF 1792;
2
QEC
encoder-based position control
QEC - 200000;
3
STP
encoder-based displacement control
STP 500;
4
QER
set encoder resolution
QER 500;
5
SQT
Set tolerance of blocked alarm
SQT 150;
9.1 Enable/ Disable Encoder and Closed-loop Module (MCFG)
Enable Encoder Interface
The Encoder Decoding Module is enabled / disabled through configuring the QEI bit of
MCFG (MCFG<13>). When MCFG<QEI>=0, the encoder decoding module is disabled;
when MCFG< QEI>=1, the encoder decoding module is enabled. If external encoder is
used, S1 and S2 ports must be used for channel A and channel B respectively. If user
chooses UIROBOT internal encoder, S1 and S2 ports are available for sensors. Please