beautypg.com

ProSoft Technology MVI56-BAS User Manual

Page 206

background image

BASIC-52 Implementation

MVI56-BAS ♦ ControlLogix Platform

User Manual

BASIC Module (DB/BAS Compatible)

Page 206 of 234

ProSoft Technology, Inc.

December 13, 2011

Operator /
Statement

Description

Example

ERRCODE

Returns the last error code since the
beginning of the program or the last

CLRERR call

10 ONERR 5000

5000 E = ERRCODE

ERRLINE

Returns the line number where the
last error occurred since the beginning
of the program or the last CLRERR

call

10 ONERR 5000

5000 L = ERRLINE

EXIT

EXIT BASIC to the DOS command

prompt.

EXIT

EXPORT

Saves the current RAM program to

the Compact Flash

EXPORT "test.bas"

FOR/TO/STEP

Control program loops

E=0:B=10: G=1
FOR A=E to C STEP G

GOTO

GOTO forces the next BASIC line to

be executed to change to the line

specified.

GOTO 500

GOSUB

GOSUB forces the next BASIC line to
be executed to change to the line

specified. The program returns to the

most recently executed GOSUB

statement once it finds a RETURN

statement

GOSUB 100

IDLE

Halts the program execution until an

ONTIME condition is met

10 TIME = 0
20 CLOCK1
30 ONTIME 2, 70
40 IDLE
50 PRINT "END TEST"
60 END
70 PRINT "TIMER INTERRUPT AT -"
80 RETI

IF/THEN/ELSE

Set up a conditional test

10 IF A<>8 GOTO 20
ELSE GOTO 30
20 PRINT "NOT 8"
30 PRINT "IS 8"

INPL

Reads an entire line from the program

port buffer

INPL $(0)
INPL# $(1)
INPL@ $(0), 1

INPS

Reads an entire string of characters

INPS $(0),1

INPUT

Enter data from the console device

during program execution

INPUT A

LD_AT

Retrieves a floating-point value that

was stored using a ST_AT()

10 LD_AT(A)
20 POP X
30 PRINT X

LET

Assign a value to a variable. The LET

statement is optional in BASIC.

LET A = 1
A = 25 * A

LIST