BL4S200 User’s Manual
96
setPWM_H
int setPWM_H(int channel, float frequency, float duty,
char mode, char bind);
FUNCTION DESCRIPTION
Sets up a PWM output on the selected high-current output channel with the specified
frequency and duty cycle. The PWM output can be set to any of its three states during
either phase of the PWM signal. The PWM channel duty cycle can be bound to a PWM/
PPM on another channel on the same RIO chip block so that they share an edge.
PARAMETERS
channel
high-current output channel being set up for PWM, 0–7
(HOUT0–HOUT7)
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%)
mode
sets the normal or begin state and the pulsed state of the PWM out-
put using these macros:
HCPWM_TRI_LOW
— normally tristated and pulsed to sinking
HCPWM_TRI_HIGH
— normally tristated and pulsed to sourcing
HCPWM_LOW_HIGH
— normally sinking and pulsed to sourcing
HCPWM_HIGH_LOW
— normally sourcing and pulsed to sinking
HCPWM_LOW_TRI
— normally sinking and pulsed to tristate
HCPWM_HIGH_TRI
— normally sourcing and pulsed to tristate
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