10 quadrature encoder inputs, 11 pulse width modulation outputs – Jameco Electronics Rabbit 3000 User Manual

Page 26

Advertising
background image

User’s Manual

17

and stop condition, for example a rising edge could be the start condition and a falling
edge the stop condition. However, optionally, the start and stop condition can be input
from separate pins.

The input capture channels can be used to measure the width of fast pulses. This is done
by starting the counter on the first edge of the pulse and capturing the counter value on the
second edge of the pulse. In this case the maximum error in the measurement is approxi-
mately 2 periods of the clock used to count the counter. If there is sufficient time between
events for an interrupt to take place the unit can be set up to capture the counter value on
either start or stop conditions or both and cause an interrupt each time the count is cap-
tured. In this case the start and stop conditions lose the connection with starting or stop-
ping the counter and simply become capture conditions that may be specified for 2
independent edge detectors. The counter can also be cleared and started under software
control and then have its value captured in response to an input.

If desired the capture counter can synchronized with Timer B outputs used to synchro-
nously load parallel port output registers. This makes it possible to generate an output sig-
nal precisely synchronized with an input signal. Usually it will be desired to synchronize
one of the input capture counters with the Timer B counter. The count offset can be mea-
sured by outputting a pulse at a precise time using Timer B to set the output time and cap-
turing the same pulse. Once the phase relationship is known between the counters it is then
possible to output pulses a precise time delay after an input pulse is captured, provided
that the time delay is great enough for the interrupt routine to processes the capture event
and set up the output pulse synchronized by Timer B. The minimum time delay needed is
probably less than 10 microseconds if the software is done carefully the clock speed is rea-
sonably high.

2.2.10 Quadrature Encoder Inputs

A quadrature encoder is a common electromechanical device used to track the rotation of
a shaft, or in some cases to track the motion of a linear follower. These devices are usually
implemented by the use of a disk or a strip with alternate opaque and transparent bands
that excite dual optical detectors. The output signals are square waves 90 degrees out of
phase also called being in quadrature with each other. By having quadrature signals, the
direction of rotation can be detected by noting which signal leads the other signal.

The Rabbit 3000 has 2 quadrature encoder units. Each unit has 2 inputs, one being the nor-
mal input and the other the 90 degree or quadrature input. An 8 bit up down counter counts
encoder steps in the forward and backward direction. The count can be extended beyond 8
bits by an interrupt that takes place each time the count overflows or underflows. The exter-
nal signals are synchronized with an internal clock provided by the output of Timer A10.

2.2.11 Pulse Width Modulation Outputs

The pulse width modulated output generates a train of pulses periodic on a 1024 pulse
frame with a duty cycle that varies from 1/1024 to 1024/1024. There are 4 independent
PWM units. The units are driven by the output of Timer A9 which may be used to vary the

Advertising
This manual is related to the following products: