Inps, Input, Inps -40 input -40 – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 230: Example, Purpose, Syntax

Advertising
background image

Publication 1746-RM001A-US-P

13-40 Input Functions

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

INPS

Purpose

Use the INPS statement to read an entire string of characters from the program
port buffer. No characters are echoed. The INPS statement is preferred over
INPUT 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

INPUT

Purpose

Use the INPUT statement to enter data from the console device during program
execution. You may assign data to one or more variables with a single input
statement. You must separate the variables with a comma.

Use the INPUT# statement to input data from port PRT2. Use the INPUT@
statement to input data from port PRT1. Both these statements function like the
INPUT statement.

Advertising