Inpl – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 168

Advertising
background image

Chapter
Statements

11

11 -16

Use the INPL statement to read an entire line (up to 254 characters) from
the program port buffer. The line must be stored in a string variable.
The INPL statement reads all characters from the program port until a
carriage return or the 254 character limit is reached, whichever comes first.
INPL does not echo characters read from the program port.

Use the INPL# statement to read an entire line of characters from the PRT2
port buffer. Use the INPL@ statement to read an entire line of characters
from the PRT1 port buffer. Both these statements function like INPL.

Syntax

INPL

string_variable

Example

>1 REM EXAMPLE PROGRAM

>10 STRING 270,254 : REM ONE STRING OF < 254 BYTES

>20 INPL $(0) : REM READ LINE FROM PROGRAM PORT

>30 PRINT# $(0) : REM ECHO STRING TO PORT PRT2

Use the INPS statement to read an entire string of characters from the
program port buffer. The INPS statement terminates when the number of
characters you specify is reached. The INPS reads CR, commas, and nulls.
No characters are echoed. The INPS statement is preferred over INPUT
(page 11 -17) or INPL for communications because all ASCII characters
may be significant. INPUT is least desirable because input stops when a
comma or a carriage return is seen. INPL terminates when a carriage
return is seen.

Use the INPS# statement to read an entire string of characters from the
PRT2 port buffer. Use the INPS@ statement to read an entire string of
characters from the PRT1 port buffer. Both these statements function like
the INPS statement.

Syntax

INPS

string_variable, number_of_characters

Example

>1 REM EXAMPLE PROGRAM

>100 PRINT, “TYPE P TO PROCEED OR S TO STOP”

>110 REM READ SINGLE CHARACTER FROM PROGRAM PORT

>120 INPS $(0),1

>130 IF ASC($(0),1)= ASC(P) GOTO 500

>140 IF ASC($(0),1)= ASC(S) GOTO 700

>150 GOTO 100

INPL

INPS

Advertising