RTC
®
4 PC Interface Board
Rev. 1.3 e
5 Advanced Programming
44
innovators for industry
5.5 Circular Queue Mode
Instead of using the two list buffers as described in
, the RTC
®
4 memory can also be used as
a
circular queue
. This mode allows list commands to
be sent to the RTC
®
4 continuously without any limit.
New commands are added by the application at one
point of the circular queue, while commands from
another point of the circular queue are executed at
the same time.
Initialization
The circular queue mode is enabled by the command
set_list_mode(1)
(see
This command should be called at the beginning of
the application program, i.e. before writing any list
commands.
Start
After enabling the circular queue mode, the user can
immediately start writing list commands to the
RTC
®
4. The command
must not be
used.
Execution starts automatically when the number of
stored commands exceeds 4000 or if the command
While the RTC
®
4 executes a block of entered
commands, it is possible to load the circular queue
with subsequent list commands. When the end of the
list buffer is reached, the RTC
®
4 starts over at the
beginning. However, the RTC
®
4 overwrites only those
commands which have already been executed. Also
see Note
Continuous Data Transfer
After execution of the first block of commands,
the RTC
®
4 checks if the next block of 4000
commands is ready for execution. If this is the case,
the next block is executed immediately afterwards.
Usually it takes much less time to write a list than to
execute it. Therefore it should be no problem to write
the next block of commands during execution of the
current block.
Termination
At the end of the application, usually a block of less
than 4000 commands will remain. To ensure correct
execution of this last block, it must be terminated
with the command
.
Circular Queue Control
If it is necessary, the command
can
be called to immediately stop execution of the
circular queue. In addition, calling the command
pauses execution and calling the command
Notes
(1)
When the circular queue mode is active, only the
following list handling commands can be used:
•
•
•
•
.
Do not use any of the other
.
(2)
Avoid writing a list command into a
full
circular
queue because the call of that command will
automatically wait until it can enter the circular
queue. On the one hand, this guarantees that no
list command will be lost, but on the other hand,
the RTC
®
4 will not handle new control
commands during that lock period – in contrast,
control commands are immediately processed
when the circular queue is not full.
For preventing a lock period, call the command
remaining capacity of the circular queue (which
has a total capacity of 8000 commands).
For relieving the RTC
®
4, it is a good idea to keep
track of the remaining capacity instead of calling
each time before trying to write a
list command into the circular queue.