BL4S200 User’s Manual
84
setPWM
int setPWM(int channel, float frequency, float duty,
char invert, char bind);
FUNCTION DESCRIPTION
Sets up a PWM output on the selected configurable I/O channel with the specified fre-
quency 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.
NOTE:
Configurable I/O channels DIO30 and DIO31 do not support PWM/PPM
functionality, and cannot be used with this function call.
PARAMETERS
channel
configurable I/O channel being set up for PWM, 0–29
(DIO0–DIO29)
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 (a duty cycle
above 100.0% will be set to 100.0%)
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
to enable binding for the
leading edge of the PWM output on this channel to another PWM
or PPM output on a channel hosted by same RIO chip and block.
Bindings allow PWM and PPM outputs to align their leading and
trailing edges.
electronic components distributor