Special function operators, Special function operators -15, Free – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 37

Advertising
background image

Publication 1746-RM001A-US-P

Expressions and Operators 3-15

Special Function
Operators

The module contains a complete set of special function operators. These operators
manipulate the I/O hardware and memory addresses of the module.

# and @

Use the # and @ operators to direct communications. Communication takes place
through port PRT1 when the @ operator is programmed, and through port PRT2
when the # operator is programmed. The absence of either the # or @ operators
indicates that communication should take place through a program port (port
PRT1 or port DH485).

EOF

Use the EOF operator to test for an empty input buffer before executing an input
statement or function. This prevents input statements from waiting indefinitely on
empty input buffers. Use the EOF# statement to test for an empty input buffer for
port PRT2. Use the EOF@ statement to test for an empty input buffer for port
PRT1.

>10 REM EXAMPLE PROGRAM

>20 IF (NOT(EOF)) THEN A=GET

>30 REM IF BUFFER NOT EMPTY, READ SINGLE CHARACTER

FREE

Use the system control value FREE to tell you how many bytes of RAM are
available to the user. When the current selected program is in RAM, the following
relationship is true:

FREE = MTOP – LEN – 511

LEN

Use the system control value LEN to tell you how many bytes of memory the
currently selected program occupies. This is the length of the program and does not
include the size of string memory or the variables and array memory usage. You
cannot assign LEN a value, it can only be read. A NULL program (example: no
program) returns a LEN of 1. The 1 represents the end of program file character.

Example

Result

>10 A = GET#

The next character in the PRT2 input buffer is assigned to variable A.

>10 A = GET@

The next character in the PRT1 input buffer is assigned to variable A.

IMPORTANT

The module does not require any dummy arguments for the
system control values.

Advertising