![Galil Motion Control RIO-47 series
RIO-47100 Скачать руководство пользователя страница 58](http://html1.mh-extra.com/html/galil-motion-control/rio-47-series-rio-47100/rio-47-series-rio-47100_user-manual_558776058.webp)
Executing Programs - Multitasking
The RIO can run up to 4 independent programs or threads simultaneously. They are numbered 0 thru
3, where 0 is the main thread.
The main thread differs from the others in the following ways:
1. Only the main thread, thread 0, may use the input command, IN.
2. When interrupts are implemented for command errors, the subroutines are executed in thread 0.
However for the #ININTn subroutines, the RIO has the ability to execute multiple input interrupts
(#ININTn) on designated threads, not limited to the main thread. For more information, refer to the II
command in the Command Reference.
To begin execution of the various programs, use the following instruction:
XQ #A,n
Where A represents the label and n indicates the thread number. To halt the execution of any
thread, use the instruction
HX n
where n is the thread number.
Note that both the XQ and HX commands can be performed from within an executing program.
For example:
Instruction
Interpretation
#TASK1
Task1 label
AT0
Initialize reference time
CB1
Clear Output 1
#LOOP1
Loop1 label
AT 10
Wait 10 msec from reference time
SB1
Set Output 1
AT -40
Wait 40 msec from reference time, then initialize reference
CB1
Clear Output 1
JP #LOOP1
Repeat Loop1
#TASK2
Task2 label
XQ #TASK1,1
Execute Task1
#LOOP2
Loop2 label
WT20000
Wait for 20 seconds
HX1
Stop thread 1
MG”DONE”
Print Message
EN
End of Program
The program above is executed with the instruction XQ #TASK2,0 which designates TASK2 as the main
thread (i.e. Thread 0). #TASK1 is executed within TASK2.
Debugging Programs
The RIO provides commands and operands that are useful in debugging application programs. These
commands include interrogation commands to monitor program execution, determine the state of
Chapter 5 Programming ▫ 58 RIO-47xxx Rev. 1.0r