User`s manual

BL4S100 Users Manual 65
setPWM
int setPWM(int channel, float frequency, float duty, int invert,
int bind);
FUNCTION DESCRIPTION
Sets up a PWM output on the selected digital output channel with the specified frequency
and duty cycle. The PWM output can be inverted. The PWM channel duty cycle 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 PWM frequency in Hz (should be from 2 Hz to 50 kHz); use -1 to
preserve the existing frequency on the RIO block
duty PWM duty cycle (should be from 0 to 100%); use -1 and
bind
parameter to use bound edge to set the duty cycle
invert whether the PWM output is inverted; the PWM output normally
starts with the output high and inverted starts with the output low.
0 — noninverted
1 — inverted
bind 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 of the PWM output on this channel. Bindings allow
PWM and PPM outputs to align their leading and trailing edges.