5.6 Structured Programming
The command set of the RTC
list commands for controlling program flow:
•
set_list_jump
•
list_call
•
list_call_cond
•
list_jump_cond
•
list_return
•
list_nop
• These commands use the RTC
a single list buffer with a total capacity of 8000
entries. Each command in the list buffer has a
unique address in the range [0 ... 7999].
Together with the control commands
set_input_pointer
and execute_at_pointer, this
allows structured list programming and execution.
Input Pointer
To write a list of commands to a particular location
®
in the RTC
4 list memory, the command
set_input_pointer (see page 106)
(instead of the commands set_start_list_1 /_2).
The command places the input pointer at any address
in the range [0 ... 7999]. The next list command will
be written to this address.
Caution!
• If the end of the list buffer is reached during
writing of a list, the input pointer is reset to
zero, i.e. the next list command is written to the
address zero.
• Make sure not to overwrite any commands
which are still needed by your application.
The current position of the input pointer can be inter-
rogated by calling the command
(see page
83).
®
RTC
4 PC Interface Board
Rev. 1.3 e
5 Advanced Programming
®
4 includes a number of
®
4 list memory as
is used
get_input_pointer
List Jumps
The command
set_list_jump (see page 109)
a jump to the specified address. During execution,
®
the RTC
4 jumps to this address.
Similarly, the command
list_call
to a subroutine (sub-list). The sub-list has to be
terminated with the command list_return.
The main list must be terminated with the command
set_end_of_list.
Conditional List Jumps
Conditional list jumps and subroutine calls can be
programmed via the commands
list_call_cond: The current value of the 16-bit digital
input port at the EXTENSION 1 connector is read and,
depending on its value, a subroutine is called or a
jump within a list is executed (also see
Examples", page 46
and
"16-Bit Digital Input and
Output", page
56).
Output Pointer
To start execution at a particular address, the
command
execute_at_pointer (see page 81)
®
be used. The RTC
4 starts execution immediately.
Execution stops when a
set_end_of_list
encountered. If the end of the list buffer is reached,
®
the RTC
4 continues at the address zero.
Caution!
• If the end of the list buffer is reached during
execution (and if the last command is not a
set_end_of_list
command), execution
continues at the address zero.
If the external start signal (see the section
Control Inputs", page
13) is used, the command
set_extstartpos_list (see page 105)
of the start address for the external list start.
defines
defines a jump
list_jump_cond
and
"Programming
must
command is
"External
allows definition
45
Need help?
Do you have a question about the RTC 4 and is the answer not in the manual?