task_wait Statement

The task_wait statement causes the currently executing task to wait until a time interval has elapsed or an event has occured.

task_wait cannot be used by one task to delay execution of another task.

The time interval is currently defined at 0.05 seconds. The period is directly linked to the heartbeat interrupt which is set at 20 beats per second. This can be changed by modifying the code in startup.asm

The minimum delay period is 1 unit, the maximum is 32767 units.

A task_wait event is defined as either

syntax

task_wait [ dly ] [ fifo_event fifo ] [ ram_event var ]

where:

dly is the number of heartbeats to wait

fifo_event is one of

ram_event is one of

example

task_wait  dly 

task_wait  dly  while_empty  fifo1 

task_wait  dly  while_zero  var 

task_wait  dly  while_empty  fifo1  while_zero  var 

task_wait  dly  while_zero  var  while_empty  fifo1 

task_wait  while_empty  fifo1  while_empty  fifo2  while_empty  fifo3 

task_wait  while_zero  var1  while_empty  fifo1  while_zero  var2 

see note on task numbers