beautypg.com

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

Page 75

background image

RPBASIC-52 PROGRAMMING GUIDE

2-56

LINE

(Statemen t)

Syntax:

LINE line,data
Where: line = 0 to 8 or 100 t o 123 (L ine ran ges m ay var y. Che ck you r hardw are m anua l.)
data = 0 , 1 , O N , o r O FF . Se e te x t b e lo w .

Function:

Turns a extern al opto mod ule or lines L0-L 8 on or off.

Mode:

Comm and, Run

Use:

LIN E 0,1

Cards:

Basi c state men t availa ble for a ll cards . line ranges are card dependen t. See hardwa re manua l.

D E S C R IP T I ON

LINE is u sed to control an e xternal output opto module o r on card lines 0-8. O n board opto po sitions are
numbered 0-3. Off card opto racks using the digital I/O port are numbered 100 to 123. 100 is simply added
to the opto position to identify the external rack. For example,

LIN E 105 ,0

turns external opto ra ck position num ber 5 off.

data is ON, OFF, 0, or 1. ON is equivalent to 1 while OFF is 0. A '0' value turns off a module while a '1'
turns it on. These values are in contrast to the LINE# statement, which has the opposite meaning. For lines
0-7, "O N" se ts a line to a 1 w hile "O FF" s ets it to 0 .

LIN E 8,0 tu rns off th e high curren t port. L INE 8,1 turn s it on.

Using ON or OFF instead of numbers or variables speeds up this statement by 20%.

LIN E and LINE # ma y be us ed inte rchan geab ly in a p rogram .

RELATED

L I N E , L I N E #, L IN E B ( fu n c ti o n) , L I N E #, L IN E B ( st a te m e n t) , C O N F I G L IN E

E R R O R

B A D A R G U M E N T When line is out of range

EXAMPLE

The following example shows how different data is returned.

10 LINE 118,OFF

Turns off external opto module 18.

20 LINE #118,0

Sets digital I/O connector line 18 to 0.

30 PRINT LINE(118),LINE#(118)

run

1 0

The function LINE(118) returns a 1 because that is the necessary condition to turn off a module. Also notice
that LINE(118) returns the status at opto port position 18 while LINE#(118) returns the condition at the
digital I/O port connector pin 18.

Use the CONFIG LINE statement to configure lines as inputs and outputs. Refer to the Digital I/O lines
section in the manual and CONFIG LINE statement for more information.