beautypg.com

ProSoft Technology MVI56-BAS User Manual

Page 34

background image

BASIC Programming

MVI56-BAS ♦ ControlLogix Platform

User Manual

BASIC Module (DB/BAS Compatible)

Page 34 of 234

ProSoft Technology, Inc.

December 13, 2011

3.1

The Argument Stack

The results of all BASIC expressions or operations are stored in the argument

stack. The argument stack holds up to 20 values.
In order to insert a value in the top of the argument stack, the

PUSH

command

must be used.
In order to retrieve the value from the top of the argument stack, a

POP

command

must be used. It will remove the current value from the top of the argument stack

moving the following value in its place.
For example, entering in the program port command line:

>PUSH 1
>PUSH 2
>PUSH 3
>POP A
>POP B
>POP C
>PRINT A
3
>PRINT B
2
>PRINT C
1

Use CALL 109 to print the first 9 values in the argument stack to aid in

troubleshooting.
For example:

>PUSH 1
>PUSH 2
>PUSH 3
>CALL 109
000 1
001 2
002 3
Argument Stack Pointer is 3