STE 80722 
– 22 – 
4.2  Programming Examples for Communication with a Robot Language Program 
 
It is possible to utilize communication functions in a robot language program in order to 
do such things as specify program branches, correct the position of the robot to be 
performed, etc.    Listed below are several programming examples showing how to do 
this. 
 
4.2.1  Program Branching 
 
The INPUT command can be utilized to specify the number of times a certain action 
is to be repeated, to select a task for execution, etc. 
 
Specifying the number of times an action is to be repeated (COM1) 
 
PROGRAM REPEAT 
  N=0 
START: 
PRINT COM1, "REQ" 
INPUT COM1, N 
IF N == 0 THEN GOTO START 
FOR K = 1 TO N 
MOVE A1 
MOVE A2 
. . . 
NEXT K 
PRINT COM1, "END" 
END 
In this program, the robot will repeat a certain series 
of motions as many times as the external device 
tells it to. 
First, the controller will send the character string 
REQ to the external device.    The external device 
will reply by sending back the number of times the 
operation is to be repeated. 
The controller will read in this number as the 
variable N, and will use this variable in the FOR 
statement. 
Should the program execution have been 
suspended while the controller was waiting 
receiving data in the INPUT command, the variable 
N would be (mistakenly) taken as 0 when the 
program is resumed.    In such a case, branch is 
executed to the top address of the program by 
asking the external device for a retransmission. 
When the task is completed, the controller will send 
the character string END to the external device.