Chapter 6 digital and opto ports – Remote Processing RPC-52 User Manual

Page 21

Advertising
background image

CHAPTER 6

DIGITAL AND OPTO PORTS

Page 19

lines. The MPS-XX series boards accept G4 and/or G5
series modules.

A CM A-26-18 connects J4 on the RPC-52 to the MP S-
XX bo ard. Cable len gth should be less than 2 feet.
Excessive cable lengths will cause a voltage drop and
consequently unreliable operation. Make sure you
connect + 5 V and gr ound to the M PS-16 an d -24 opto
racks. T he MPS-08 r ack obtains its power through the
ribbon cable.

Before a line can be acc essed or r ead, the 8255 chip
must be initialized. This is done using the CONFIG
LIN E statem ent. Refer to Table 6-1 for Op to module
position, port num ber, and connec tor pin out. If opto
channels 16-23 are used, U 20 should be replaced by a
DIP shunt jumper.

The LINE and LINE # com mands are used to control
and access opto modules and lines. These commands are
both functions and statements, depending upon how they
are used.

100 LINE 100, 0

Statement

110 LINE #103, 0

Statement

120 A = LINE(100)

Function

130 A = LINE#(103)

Function

Program line 100 turns external opto module rack
position 0 off. Program line 110 sets J4, pin 3, to a
logical 0 level. Program line 120 returns the status of
externa l opto modu le rack po sition 0. If the modu le is
"off", a 1 is returned (assuming it is an output module).
Program line 130 returns the status of J4, pin 3 as a 0 or
1.

Example: To turn on opto module in slot position 8, the
following command is executed:

LINE 108, 1

A ' 1' turns on a module while a 0 turns it off. (In actual
fact, a 0 is written at the port. )

Interfacing to switches and other devices

The STB-26 terminal board provides a convenient way
of interfacing switches or other digital I/O devices.
Lines at J4 are connected to the STB-26 with a CMA-26
cable. Digital devices are then connected to the screw
term inals on the ST B-26. The M PS-X X serie s opto
racks also pro vide a way to access digital I/ O lines.

Switches may be connected directly to a line. When
jumper W9 configures the resistors as pull ups, a switch
c l os u re to g r ou n d a t a li ne is r ea d as a 0 u s in g th e L IN E
# function.

When W 9 configures the input re sistors as pull downs,
one end of the switch m ust be tied to + 5 volts. If this is
not possible or convenient, a 1K resistor can be tied
between an input and + 5 volts to force it high when a
switch is open.

Digital I/ O prog ramm ing exam ple

The follow ing exam ple read s a switch at po rt A, bit 3
(J4-25) (pr ogram line 200), reads op to module channel 1
(program line 210) and turns on opto module at channel
5 (program line 220). A LED is controlled through the
high current port at J3-10 (port B, bit 0) (program lines
230 and 240).

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

Note that the LINE statement is us ed to contr ol both opto
modules and individual lines.

Advertising