Opto – Remote Processing CAMBASIC User Manual

Page 124

Advertising
background image

Comm ands - 91

OPTO

Process Function

SYNTAX:

a = OPTO (channel)

PURPOSE:

To return the status of an input on an on board opto isolator rack.

REMARK S:

Inputs and outp uts are ac tive low w hen interf acing with op to-isolator r acks. Thus, writing a “1” to
an opto output module will turn it off. This confusion is eliminated with the OPTO function. OPTO
a u to m at ic a ll y i nv e rt s t he lo g ic so th a t a “ 1 ” r ep r es en ts O N an d a “ 0 ” r e pr e se n ts O F F .

The OPT O function is similar to the BIT function in that individual I/O bits or channels can be read.
It differs in that it is used specifically with opto-isolator racks and it executes much faster.

The channel parameter ranges from 0 to 23 (0-3 on the RPC-30) or 100 to 123 and the channel
number correspo nds to the position numbers on the opto module ra cks.

EXAMPLE:

20 PRINT OPTO(0)
RUN

0

In this example the bit 0 of the port at address 0 was set high. Since the OPT O function inverts the
result, a “0 ” w as retur ned. This wou ld mean th at there w as not input signal a t an opto mo dule in
this location.

ERROR:

< Data negative> – channel
< Illegal argument> - if channel > 23

Advertising