Basic statements -5, Basic statements – Rockwell Automation 1746-BAS-T SLC 500 Basic Basic-T Modules User Manual

Page 53

Advertising
background image

Publication 1746-UM004B-EN-P - December 2005

Programming Overview 4-5

Refer to the BASIC Language Reference Manual, publication
1747-RM001, for additional information on these commands.

BASIC Statements

BASIC statements are programming instructions that are executed
during Run mode. Typically these statements are used to control
program execution. The following table lists the BASIC programming
statements.

Statement

Function

Examples

CLEAR

CLEAR variables, interrupts, and strings.

CLEAR

CLEAR (S&I)

CLEAR stacks and interrupts.

CLEARS, CLEARI

CLOCK (1&0)

Enable and disable free running clock.

CLOCK1, CLOCK0

DATA

Read information with the DATA statement.

DATA 100

DIM

Allocate memory for arrayed variables.

DIM A(20)

DO-WHILE

Set up loop for WHILE.

DO - WHILE

DO-UNTIL

Set up loop for UNTIL.

DO - UNTIL

END

Terminate program execution.

END

FOR-TO-STEP

Set up FOR-NEXT loop.

FOR A = 1 TO 5

GOSUB

Execute subroutine.

GOSUB 1000

GOTO

GOTO program line number.

GOTO 500

IF-THEN-ELSE

Test for a condition.

IF A>B THEN A=0

INPUT

INPUT a string or variable.

INPUT A

LD@

Load top of stack from user specified location.

LD@ 1000H, LD@ A

LET

Assign a variable or string a value. (LET is optional.)

LET A=1

NEXT

Test FOR-NEXT loop condition.

NEXT A

ONERR

Perform conditional arithmetic ERROR handling.

ONERROR 10

ON-GOTO

Perform conditional GOTO.

ON A GOTO 5, 20

ON-GOSUB

Perform conditional GOSUB.

ON A GOSUB 6, 2

ONTIME

Generate an interrupt when TIME is equal to or
greater than the expression following ONTIME
statement.

ONTIME10, 1000

PH0.

PRINT HEX mode with zero suppression.

PH0. A

PH1.

PRINT HEX mode without zero suppression.

PH1. A

POP

POP argument stack to variables.

POP A, B, C

PRINT

PRINT variables, strings or literals.

PRINT A

PUSH

PUSH expressions on argument stack.

PUSH 10, A

READ

READ data in a DATA statement.

READ A

REM

Insert a remark statement in a program.

REM DONE

RESTORE

RESTORE READ pointer.

RESTORE

Advertising
This manual is related to the following products: