BL4S100 User’s Manual
21
Keep the following guidelines in mind when selecting special uses for the digital input pins.
•
Interrupts, event counters, and input capture are available on any digital input pin.
•
Each Quadrature Decoder channel requires at least two digital input pins associated
with the same counter/timer block; three digital input pins associated with the same
counter/timer block are needed if you need indexing. Quadrature Decoder channels are
configured using the
setDecoder()
function call.
Sample programs in the
DIO
subdirectory in
SAMPLES\BL4S1xx
show how to set up and
use digital inputs for interrupts, pulse capture, and quadrature decoders.
3.2.1.1 Interrupt, Counter, and Event Capture Setup
External interrupts on the BL4S100 digital input pins are configured using the
setEx-
tInterrupt()
function call. The interrupt can be set up to occur on a rising edge, a fall-
ing edge, or either edge.
The counter readings can be obtained via the
getBegin()
or
getEnd()
function calls.
An input channel may be set up to count
events, with the count incrementing or
decrementing, using the rising edge, fall-
ing edge, or either edge as triggers to start/
end the count. This feature is configured
using the
setCounter()
function call.
A more extensive use of the timing abilities
of the BL4S100 inputs can be realized
through the event capture function call,
setCapture()
. Here the count of a par-
ticular clock cycle is noted at the start of the
event and at the end of the event so that the
time between them can be determined. This
can be set up on one or two input channels.
The event counter can be reset with the
resetCounter()
function call.
Channel 0
Begin
Count
End
Count
Channel 1
Start
Event
End
Event