Publication 1746-UM004A-US-P
Programming Overview 4-5
BASIC Statements
BASIC statements are programming instructions that are executed during Run
mode. Typically these statements are used to control program execution. Table 4.5
lists the BASIC programming statements.
Refer to the BASIC Language Reference Manual (publication
number1747-RM001A-US-P) for additional information on these statements.
Table 4.5 BASIC 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
RETI RETURN from interrupt. RETI
RETURN RETURN from subroutine. RETURN
ST@ Store top of stack at user specified location. ST@ 1000H, ST@ A
STOP Break program execution. STOP
STRING Allocate memory for STRINGs. STRING 50, 10
Spare Allen-Bradley Parts