BL4S100 User’s Manual
67
setPPM
int setPPM(int channel, float frequency, float offset,
float duty, char invert, int bind_offset, int bind_duty);
FUNCTION DESCRIPTION
Sets up a PPM output on the selected digital output channel with the specified
frequency and duty cycle. The PPM output of the PPM can be inverted. The offset and
duty of the PPM can be bound to a PWM/PPM on another channel on the same RIO
block so that they share an edge.
PARAMETERS
channel
digital output channel being set up for PWM, 0–7 (OUT0–OUT7)
frequency
PPM frequency in Hz (should be from 2 Hz to 50 kHz); use -1 to
preserve the existing frequency on the RIO block
offset
PPM offset (should be from 0 to 100%); use -1 and
bind_offset
parameter to use bound edge to set the offset
NOTE:
A zero offset will produce the smallest offset possible, which is one count. If you
must have a zero offset, use
setPWM()
instead of
setPPM()
.
duty
PPM duty cycle (should be from 0 to 100%); use -1 and
bind_
duty
parameter to use bound edge to set the duty cycle
NOTE:
PPM will not wrap around the PPM period. If
offset
is set to 25%, the 75 to
100% duty cycle will have the same effect as
offset
= 25%,
duty
= 75%. The same
waveform as a wrapped PPM can be created using an inverted PPM
invert
whether the PPM output is inverted; the PPM output normally
starts with the output low, goes high at the offset, and stays high
for the remainder of the duty cycle; inverted will start with the out-
put high, goes low at the offset, and stays low for the duration of
the duty cycle.
0 — noninverted
1 — inverted
bind_offset
use
BL_BIND_LEAD
or
BL_BIND_TRAIL
ORed with another
digital output channel hosted by the same block to enable binding
for the leading edge of the PPM output on this channel. Bindings al-
low PWM and PPM outputs to align their leading and trailing edges.
bind_duty
use
BL_BIND_LEAD
or
BL_BIND_TRAIL
ORed with another
digital output channel hosted by the same block to enable binding
for the trailing edge of the PPM output on this channel. Bindings
allow PWM and PPM outputs to align their leading and trailing
edges
electronic components distributor