
DIGITAL AND OPTO PORTS SECTION 6
Page 6-5 RPC-320
100 CONFIG LIN E 100,13,1,1, 1
200 D = LINE #(125)
210 F = LINE (1)
220 LINE 105, 1
230 LINE #110,1 :REM Turn on LED
240 LINE #110,0 :REM Turn off LED
Line 100 configured the 82C55 so ports A and C are
inputs while B is the output.
Note that the LINE statement is used to control both opto
modules and individual lines.
Lines can also be read or controlled in the immediate
mode.
PRINT LINE#(125)
returns the status at J3-25. Notice that even when a line
is configured as an output, its status can be read back.
Execute the following to control L7.
LINE 7,OFF
sets L7 low. Executing
LINE 7,ON
sets the line high.
LINEB is used to read and write a byte at a time.
LINEB 3,1,128
sets port B, bit 7 high and bits 0-6 are low.
Pulse Width Modulation (PWM)
Any line accessible by the LINE com mand may be pulse
width modulated. PW M command parameters determ ine
high and low time (to 5 ms resolution) and, optionally,
number of pulses.
Use PWM to control the brightness of a display (via line
8), control the speed of a motor, or output a number of
pulses to a stepper controller. Brightness control using
LED's is best achieved when htime or ltime are less than
5 (25 ms). One of the parameters should be 1.
Noticeable flicker occurs when htime and ltime sum to
more than 6 (30 ms).
See the PWM command in the Software Supplement for
more information. Use Table 6-1 to use an output
directly from J3.