Special function operators – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 127

Advertising
background image

Chapter
Expressions, Variables and Operators

9

9 -17

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

# and @

Use the # and @ operators to direct communications. Communication
takes place through port PRT1 when you program the @ operator.

>10 A = GET@

Result: Next character in PRT1 input buffer assigned to variable A.

Communication takes place through port PRT2 when you program the #
operator.

>10 A = GET#

Result: Next character in PRT2 input buffer is assigned to variable A.

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 you. When the current selected program is in RAM, this
relationship is true:

FREE = MTOP - LEN - 511

LEN

Use the system control value LEN to tell you how many bytes of memory
the current program occupies. This is the length of the program and does
not include the size of string, variable or array memory. You cannot assign
LEN a value, you can only read it. A null program (ex.

no program

)

returns a LEN of 1. The 1 represents the end of program file character.

Special Function Operators

Advertising