
RPBASIC-52 PROGRAMMING GUIDE
2-91
PWM
Syntax: PWM line, ltime,htime[,cycles]
Where: line = 0 to 8 or 100 to 123. This is card dependent. Refer to yo ur hardware m anual.
ltime = 0 to 255, number of 5 ms periods line is low
htime = 0 to 255, number of 5 ms periods line is high
cycles = 0 to 65535, optional number of pulse cycles
Function: Produces pulse width m odulated output.
Mode: Command, Run
Use: PWM 8,3,B,5000
Cards: All
DESCRIPTION
Any digital I/O lines may output a Pulse W idth Modu lated signal. Pulses c an run indefinitely or for a specific
number of times. PWM may be used to control the brightness of a display or send a number of pulses to a
motion controller.
WARNING: PWM continues to run in the command mode.
Low and high times are referenced from unbuffered outputs. Outputs from high current lines are inverted, so
high and low times are reversed.
cycles refer to the number of low to high transitions from an unbuffered outpu t. When a PWM output is
finished counting, that line goes and remains high.
A PW M output is shutoff the quickest by specifying 1 for htime, ltime, and cycles. This can be done as part of
a program or in the immediate mode.
RELATED
CONFIG LINE
ERRORS
BAD SYNTAX If any parameters left out.
BAD ARGUMENT When any parameters are out of range.
EXAMPLE
The following example sets outputs a PWM signal to line 7. Line 7 is configured for an output on power-up.
PWM 7,2,1
Commenti su questo manuale