BL4S100 User’s Manual
42
•
PPM_QUADRATURE_DECODER.C
—Demonstrates the use of two PWM and two PPM
output channels connected back to four digital inputs to simulate two Quadrature
Decoders feeding signals into the BL4S100. The PWM and PPM outputs are adjusted
through a menu system to simulate the movement of a Quadrature Decoder. The results
of the Quadrature Decoder inputs are displayed continuously to show the effects of the
PWM and PPM outputs.
The high-speed Quadrature Decoder counts the number of
rollovers that occur (one per 1000 counts). The low-speed
Quadrature Decoder displays the current count in the
register.
Once the connections are made as shown, and you compile
and run this sample program, change the frequency/
direction for a given Quadrature Decoder via the Dynamic C
STDIO
window and watch the register counts on the low-
speed channel and the register rollovers on the high-speed
channel.
J3
OUT2 OUT1 OUT0 IN3 IN2 IN1 IN0 +K GND
IN11 IN10 IN9 IN8 IN7 IN6 IN5 IN4 GND
+5 V +K2
+K1 GND OUT7
OUT6
OUT5
OUT4
OUT3
J4
J16