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
- a FIFO being empty
- a FIFO being not empty
- a FIFO being full
- a FIFO being not full
- a RAM byte location being zero
- a RAM byte location being not zero
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
- while_empty
- until_empty
- while_full
- until_full
- while_zero
- until_zero
example
task_wait dlytask_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