Rpbasic-52 programming guide, Warning – Remote Processing BASIC 52 User Manual

Page 110

Advertising
background image

RPBASIC-52 PROGRAMMING GUIDE

2-91

PWM

Syntax:

P W M line, ltime,htime[,cycles]
Where:

line = 0 to 8 or 100 to 12 3. This is card depe ndent. 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 pu lse width m odulated outpu t.

Mode:

Comm and, Run

Use:

PWM 8,3,B,5000

Cards:

All

D E S C R IP T I ON

Any digital I/O lines may o utput a Pulse W idth Modu lated signal. Pulses c an run indefinitely or for a specific
number of times. PWM m ay be used to control the brightness of a display or send a number of pulses to a
motion co ntroller.

WARNING:

PWM continues to run in the command mode.

Low and high tim es are referenced from unbuffered outputs. Outputs from high current lines are inverted, so
high and low times are reversed.

cycles refer to the num ber of low to high transitions from an unbuffered outpu t. When a P WM output is
finished counting, that line goes and remains high.

A PW M output is sh utoff 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

C O N F I G L IN E

ERRORS

B A D S Y N T A X

If any param eters left out.

B A D A R G U M E N T 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

Advertising