BL4S100 User’s Manual
39
•
INTERRUPTS.C
—Demonstrates the use of the Rabbit RIO interrupt service capabilities.
Set up the Demonstration Board as shown in Figure 14 with IN0 connected to SW1.
The sample program sets up two interrupt sources, an external interrupt tied to pushbutton
switch SW1, and a rollover interrupt tied to a timer that is producing a PWM output.
The Dynamic C
STDIO
window will show a count of rollovers that have occurred since
the PWM signal was started. The window will also display
Button Pressed
each time
the pushbutton switch is pressed. Each time the button is pressed, the timeout timer that
removes the message is reset, so you can keep the message on the screen indefinitely by
pressing the button repeatedly.
•
PPM.C
—Demonstrates the use of up to eight PPM channels on the digital output pins
on headers J3 and J4. The PPM signals are set for a frequency of 200 Hz, with the duty
cycle adjustable from 0 to 100% and an offset adjustable from 0 to 100% by the user.
These pins can be connected to an oscilloscope to view the waveform being generated.
The overall frequency can be adjusted in the
#define PPM_FREQ
line. Follow these
instructions when running this sample program.
1. The digital outputs on the BL4S100 do not have an internal pull-up resistor and will not register on
the oscilloscope without a pull-up resistor. The Demonstration Board has pull-up resistors—
connect OUT0–OUT3 on the BL4S100 to SW1–SW4 on header J1 of the Demonstration Board.
2. Connect the oscilloscope probe to digital output pins OUT0–OUT3 on headers J3 or J4. Remember
to connect the oscilloscope ground to GND on header J4.
Once you compile and run the sample program, change the duty cycle and offsets for a
given PPM channel via the Dynamic C
STDIO
window and watch the change in wave-
forms on the oscilloscope. Signals on OUT0 and OUT1 will all be synchronized with
each other as they share the same overall counter block that sets the cycle frequency.
The same is true for PPM signals on OUT2 and OUT3 (and the remaining digital outputs
when you connect them to J1 on the Demonstration Board instead of those already
connected). The two blocks may have a phase shift from each other, but will run at the
same frequency.
•
PULSE_CAPTURE.C
—Demonstrates the use of two input capture inputs tied to PPM
channels on the digital I/O pins on header J3. The input capture feature allows the begin
and end positions of a pulse to be measured in a given time window. We take advantage
of the counter synchronization feature of the underlying Rabbit RIO chip to create cap-
ture windows and pulse modulation windows that are synchronized. This guarantees
that we always catch the begin edge first on a quickly repeating waveform. This was
done to create an interactive element to this sample program, but capturing real-world
repetitive signals will usually not have this advantage. Follow the instructions below
when running this sample program.
1. Connect I/O pins IN0 and OUT0 together.
2. Connect I/O pins IN3 and OUT2 together.
3. Connect the oscilloscope ground to GND on header J3.
4. Use the oscilloscope probes on the IN0 and the OUT0 pair or the
IN3 and OUT2 pair to view the PPM signals.
J3
Oscilloscope
GND
OUT2 OUT1 OUT0 IN3 IN2 IN1 IN0 +K GND