37 of 286
23 Loop End Sub Sub MyTask() Do Debug.Print "Hello from MyTask" Call Delay(2.0) Loop End Sub Example 2 Dim taskStack(1 to 50) as Byte Sub Main() CallTask MyTask(2.0), taskStack Do Debug.Print "Hello from Main" Call Delay(1.0) Loop End Sub Sub MyTask(ByVal taskDelay as Single) Do Debug.Print "Hello from MyTask" Call Delay(taskDelay) Loop End Sub Example 3 Dim taskStack(1 to 50) as Byte Sub Main() Dim stkAddr as UnsignedInteger Dim stkSize as Integer stkAddr = taskStack.DataAddress stkSize = SizeOf(taskStack) CallTask MyTask(2.0), stkAddr, stkSize Do Debug.Print "Hello from Main" Call Delay(1.0) Loop End Sub Sub MyTask(ByVal taskDelay as Single) Do Debug.Print "Hello from MyTask" Call Delay(taskDelay) Loop End Sub Compatibility In BasicX compatibility mode, the task name must be enclosed in quotes (i.e. so that it appears to be a string). Also, task parameters, specifying the task stack by address, and specifying the task stack size are not supported in BasicX compatibility mode.