STE 80722
ā 24 ā
Selecting a task to be performed (COM1)
PROGRAM SELECT
K = 0
START:
PRINT COM1, "STR"
SELECT:
INPUT COM1, K
GOTO(K) L1, L2, L3
PRINT COM1, "NG"
GOTO FIN
L1:
(Task 1)
GOTO FIN
L2:
(Task 2)
GOTO FIN
L3:
(Task 3)
GOTO FIN
FIN:
In this program, the external device tells the
controller what task is to be performed.
First, the controller will send the character string
STR to the external device. The external device
will send back a number which specifying task the
controller (robot) is to perform. The controller
reads in this number as variable K, which is then
used in the GOTO ( ) command to branch the
program to the appropriate task.
Task 1 will be performed if the value of K is 1,
Task 2 if the value is 2, and Task 3 if the value is
3. If the value of K is anything else, the controller
will send the character string NG
(non-acknowledge) back to the external device.
Should program execution have been suspended
while the controller was waiting for the number to
come in, variable K will be taken as 0 when the
program is resumed. In this case also, the
controller will send the character string NG back to