![]() |
|
| << Previous | Next >> | |
| | |
int pwm_set( int channel, int duty_cycle, int options );
Description
- Sets a duty cycle for one of the pulse width modulation (PWM) channels. The duty cycle can be a value from 0 to 1024, where 0 is logic low the whole time, and 1024 is logic high the whole time. Option flags are used to enable features on an individual PWM channel. Bit masks for these are:
PWM_SPREAD- sets pulse spreading. The duty cycle is spread over four separate pulses to increase the pulse frequency.
PWM_OPENDRAIN- sets the PWM output pin to be open-drain instead of a normal push-pull logic output.
- This function is intended for use with the Rabbit 3000 and Rabbit 4000.
Parameters
- channel
- channel(0 to 3)
- duty_cycle
- value from 0 to 1024
- options
- combination of optional flags (see above)
Return Value
0: Success.
-1: Error, an invalid channel number is used.
-2: Error, requestedduty_cycleis invalid.Library
- PWM.LIB (was in R3000.LIB prior to DC 10)
| Dynamic C Functions | << Previous | Next >> | rabbit.com |