Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual

Page 83

Advertising
background image

6Ć43

Refer to the OPEN statement description (6.8.1) for more information

on how the GET statement is used with the OPEN statement.

6.8.8

READ Statement

The READ statement directs the system to read from a list of values

built in a data block by a DATA statement. A READ statement is not

legal without at least one DATA statement.
A READ statement causes the variables listed in it to be given the

value of the next expression in the next DATA statement. BASIC has

a pointer to keep track of the data being read by the READ

statement. Each time the READ statement requests data, BASIC

retrieves the next expression indicated by the data pointer.
The READ statement has the following format:

READ variable_1,variable_2,...,variable_N

where:

variable_1 through variable_N = the value(s) listed in the DATA

statements

The variables can be simple (A%) or subscripted (A%(4)) and can be

any of the five variable types: integer, double integer, real, string,

and boolean. All variables should be separated by commas. String

variables should be enclosed within single or double quotes.
The following is a valid READ statement:

10 READ A%,B%,C$,D%(5)

6.8.9

DATA Statement

The DATA statement has the following format:

DATA expression_1, expression_2,... ,expression_n

where:

expression_1 to expression_n =

expression that, after evaluation, is loaded into

the corresponding variable in a READ

statement when the READ is executed

The data type of the expression in the DATA statement must be the

same as the data type of the variable that corresponds to it in the

READ statement.
The program will run faster with READ and DATA statements as

opposed to the INPUT statement simply because the system does

not have to wait the extra time it takes for the system to stop and

request data. The data is already within the program.
The DATA statements may be formatted with any number of

expressions as long as the same number is being requested by the

READ statements:

10 READ A,B,C,D,E,F

20 ...

30 ...

40 ...

800 DATA 17

900 DATA 25,30,43,76,29

Advertising
This manual is related to the following products: