Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 187

Advertising
background image

Chapter
Statements

11

11 -35

Use the ST@ statement to store BASIC module floating point numbers to a
specified address. The expression following the ST@ statement specifies
the address where you want the number stored in RAM. The ST@
statement takes the value on the top of the argument stack and stores it in
RAM at the address location you specify by expr.

You can use this statement with CALL 77 (page 13 -6) to store variables to
a protected area of memory. This protected area is not zeroed on power up
or when you issue the RUN command (page 10 -19). Use the LD@
statement (page 11 -18) to retrieve the floating point number you stored
with the ST@ statement.

Important: ST@ and LD@ are not used with any port designation.

Syntax

ST@

expr

Example

>PRINT MTOP

24575

>PRINT MTOP–10*6

24515

>PUSH 24515 : CALL 77

>PRINT MTOP

24515

>1 REM EXAMPLE PROGRAM

>5 DIM A(10),B(10)

>10 REM *** ARRAY SAVE ***

>20 FOR I = 0 TO 5

>30 A(I) = I+20

>40 PUSH A(I) : REM PUT NUMBER ON STACK

>50 ST@ 5FFFH-I*6

>60 NEXT I

>70 REM *** GET ARRAY ***

>80 FOR I = 0 TO 4

>90 LD@ 5FFFH-I*6

>100 POP B(I) : REM GET NUMBER FROM STACK

>110 PRINT B(I)

>120 NEXT I

READY

>RUN

20

21

22

23

24

READY

>PUSH 5FFFH : CALL 77

>PRINT MTOP

24575

ST@

Advertising