MyTask Function
Returns the task number of the current program.
Syntax
MyTask
Return Values
The task number of the current task. Valid entries are as below:
- Normal task: 1 to 32
- Background tasks: 65 to 80
- Trap tasks: 257 to 267
Description
MyTask returns the task number of the current program with a numeral. The MyTask instruction is inserted inside a specific program and when that program runs the MyTask function will return the task number that the program is running in.
See Also
Xqt
MyTask Function Example
The following program switches On and Off the I/O ports from 1 to 8.
Function main
Xqt 2, task 'Execute task 2.
Xqt 3, task 'Execute task 3.
Xqt 4, task 'Execute task 4.
Xqt 5, task 'Execute task 5.
Xqt 6, task 'Execute task 6.
Xqt 7, task 'Execute task 7.
Xqt 8, task 'Execute task 8.
Call task
Fend
Function task
Do
On MyTask 'Switch On I/O port which has the same number as 'current task number
Off MyTask 'Switch Off I/O port which has the same number as 'current task number
Loop
Fend
← MsgBox Statement N →