Interpreting CW/CCW Pulse Train Output (PTO) Signals


In my previous post, I discussed power protection with the comparator subsystems (CMPSS) and crossbars (X-BARs). Now, let’s step back and examine another common design situation in the industrial automation space: interpreting a pulse train output (PTO) for motor control. If your system contains programmable logic controllers (PLCs) or input/output (I/O) modules, it will likely also contain PTO modules. PTO modules output impulses, or steps, which are then used to rotate the shaft of a motor to a specific position. The signal output from a PLC indicates the desired speed and direction of a motor’s rotation.

A common type of PTO signal is clockwise/counterclockwise (CW/CCW). CW/CCW provides a position reference to the motor by indicating positive increments through the CW signal and negative increments through the CCW signal. Figure 1 shows active-high CW/CCW signals, but an active-low setup is also possible.

Figure 1: Active-high CW/CCW signals. CW going high indicates a positive increment, while CCW going high indicates a negative increment

The design challenge of interest is receiving the CW/CCW signals as inputs and then converting them into information that can drive the motor to a certain position. One option is to design an external circuit dedicated to counting the CW/CCW pulses. Although this is feasible, it does add a layer of complexity and cost to your system design. Another possibility is tying the CW/CCW signals to general-purpose I/O (GPIO) pins on a microcontroller (MCU) or microprocessor (MPU) to count pulses. However, if the CW/CCW pulse edges are not completely synchronized with the MCU or MPU’s clock, or if the device is in the middle of a critical interrupt, this could lead to missed pulses. Missed pulses mean that the motor will not make it to the intended position.

To minimize design time and cost, C2000™ Piccolo™ F28004x MCUs provide CW/CCW support through the enhanced quadrature encoder pulse (eQEP) modules. You can tie CW/CCW signals directly to the enhanced quadrature encoder pulse (eQEP) A and B  channels on the eQEP module; logic circuitry on-chip converts them to direction and clock signals, which are then used to produce pulse-width modulation (PWM) signals from the F28004x to drive a motor to the desired position. Figure 2 below shows clock and direction signals generated from the CW/CCW pulses in the previous figure.

The F28004x has two eQEP modules on-chip, meaning that even if one module is dedicated to receiving CW/CCW signals from a PLC, you can still use the other for encoder feedback to monitor the position of the motor. 

Figure 2: Direction and clock signals obtained from the CW/CCW pulses in Figure 1

While the F28004x is optimized for handling CW/CCW signals on a single eQEP module, other devices like the Delfino™ F2837x (three eQEP modules) and Piccolo™ F2803x (one eQEP module) can handle receiving, counting and converting pulses as well. On the Delfino™ F2837x, you will need two separate eQEP modules by dedicating one eQEP module to the CW signal and an input on a second eQEP module to the CCW signal. The logic level of the CW/CCW signals must be scaled down to 3.3V in order to feed them to the eQEP modules.

You may want to restrict CW/CCW interfacing to only one eQEP module, which would be the case anyway with the Piccolo™ F2803x because it contains only one eQEP module. In such situations, you can add an external logic circuit to convert the CW/CCW signals into direction and clock signals for routing into a single eQEP module.

With the eQEP modules on Piccolo™ F28004x devices, receiving CW/CCW signals from a PLC and converting them into PWM outputs to actuate your system’s motors has never been easier.

In the following post, I will look into support for qualification of a noisy input signal on C2000™ devices.

Additional resources