RTC
®
4 PC Interface Board
Rev. 1.3 e
5 Advanced Programming
46
innovators for industry
Programming Examples
The following programming examples are written in
PASCAL.
(1)
Confirm a signal:
set_start_list(1);
...
set_io_cond_list(0, 0, 1);
// set bit #0 of the 16-bit digital output port
list_jump_cond(0, 1, get_input_pointer);
// loop until the signal is confirmed
// (i.e. bit #0 of the digital input turns HIGH)
clear_io_cond_list(0, 0, 1);
// clear bit #0 of the 16-bit output
list_jump_cond(1, 0, get_input_pointer);
// loop until the signal is confirmed
...
set_end_of_list;
execute_list(1);
(2)
If the lower four bits of the digital input have the
value (
0110
), set bit #1 of the 16-bit digital
output, otherwise clear it:
set_start_list(2);
...
list_jump_cond($0006, $0009, get_input_p 3);
// skip the next two commands if the state
// of the 16-bit input is (xxxx xxxx xxxx 0110)
clear_io_cond_list(0, 0, 2);
// clear bit #1 of the 16-bit output and ..
set_list_jump(get_input_p 2);
// .. skip the next command
set_io_cond_list(0, 0, 2);
// set bit #1 of the 16-bit output
...
// (continue)
set_end_of_list;
execute_list(2);
...
bit1 := (get_io_status AND $0002)
// returns the current state of bit #1
(3)
Choose between 15 small subroutines:
...
for i := 1 to 15 do
list_call_cond(i, 15-i, i*100);
// call subroutine at address i*100
// if [bit #3...bit #0] (binary) = i
...