Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 128

Advertising
background image

Chapter
Expressions, Variables and Operators

9

9 -18

MTOP

Use the MTOP operator to retrieve the last valid memory address in RAM
that is available to the BASIC module. After reset, the BASIC module
sizes the external memory and assigns the last valid memory address to the
system control value MTOP. The module does not use any external RAM
beyond the value assigned to MTOP. If a CALL 77 (page 13 -6) has not
changed this value, then the last valid BASIC address is 5FFFH (24575).

>PRINT MTOP

Result:

24575

>PH0.MTOP

Result:

5FFFH

Important: Use CALL 77 to change MTOP. Do not use MTOP = 22000.

CBY

Use the CBY operator to retrieve data from the program or code memory
address location of the BASIC module. You cannot assign CBY a value;
you can only read it. The argument for the CBY operator must be a valid
integer between 0 and 65535 (0FFFFH). If it is not a valid integer, a bad
argument error occurs.

>A = CBY(1000)

Result: The value in the program or code memory address location
1000 is assigned to variable A.

DBY

Use the DBY operator to retrieve or assign data to or from the internal
RAM data memory of the BASIC module. Both the value and the
argument in the DBY operator must be between 0 and 255 inclusive.
This is because there are only 256 internal memory locations in the BASIC
module and one byte can only represent a quantity between 0 and 255
inclusive.

>A = DBY(11)

Result: Value in internal memory location 11 assigned to variable A.
The internal memory location must be between 0 and 255.

>DBY(250) = OCH

Result: Value OCH assigned to internal memory location 250.

Important: Improper use of this operator may cause a malfunction of the
BASIC module.

Important: The DBY operator cannot access the Special Function
Registers (SFR).

Advertising