Remote Processing RPC-330 User Manual
Page 26

DIGITAL I/O
SECTION 6
Page 6-5 RPC -330
Maxim um continuous cur rent is 2 amper es at 60 volts @
25 C. ON resistance is 0.5 ohm s. Cur rent capability of
this FET is higher. However, if you draw more than 2
amperes, consider attaching a heat sink to Q2.
This port is accessed using the LINE #8 comm and. Line
100 turns on the FET w hile line 200 turns it off.
100 LINE#8,1
200 LINE#8,0
Use the circuit in figure 6-2 when switching inductive
loads.
Digital I/ O prog ramm ing exam ple
The follow ing exam ple read s a switch at po rt A, bit 3
(J3-25) (program line 200), r eads L1 at P6 (program line
210) and turns on opto module at channel 5 (program
line 220). A LE D is controlled through the high current
port at J3-10 (port B, bit 0) (program lines 230 and 240).
For testing, a 100 ohm resistor from J3-10 to + 5 volts
can be substituted.
100 CON FIG 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
2 4 0 L I N E #1 1 0, 0 : R E M T u rn o ff L E D
300 G = LINE B(3,0 ) :RE M Re turns data a t port A
310 LIN EB 3, 1,5 :RE M w rites 5 to por t B
Line 100 configured the 82C55 so ports A and C are
inputs while B is the o utput.
Note that the LINE statement is us ed to contr ol both opto
modules and individual lines.
Lines can also be re ad or co ntrolled in the imme diate
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. E xecuting
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.
P u ls e W i d th M o du la ti on ( PW M )
A line accessible by the LIN E comm and may be pulse
width modulated. PW M comm and parameters determ ine
high and low time (to 5 ms resolution) and, optionally,
number of pulses.
Use PW M 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). O ne of the parameters should be 1.
Noticeable flicker occurs when htime and ltime sum to
more than 6 (30 ms).
See the PWM comm and in the Software Supplement for
more inform ation. Use Table 6-1 to use an output
directly from J3.
LINE MONITORING COMMANDS
ON LIN E and ON C OUN T are used to monitor any 8
l in e s w h il e p r o gr a m e xe c ut io n co n ti nu e s. U s e O N LI N E
to monitor any change in state of a line. ON C OUN T is
used to count relatively slow (less than 95 H z) pulses.
ON COUNT can be used to generate an interrupt every
time a line goes low. Simply set the count param eter to
a 1.
Lines are m onitored by the oper ating system every 5 ms.
ON LIN E generates an interrupt when a line changes
from the last monitored state. At the end of the current
BASIC statement a software interrupt is generated.
ON C OUN T can generate a software interr upt when the
number of counts at a line reaches a preset number. It
can also count the number of pulses at a line.
B ot h o f th e se in te r r up ts a re lo w e r p r io r it y t ha n O NT I C K
or ONIT R. Re fer to Appendix A, INTERRUPTS
section under the ONITR com mand for operating and
priority information.