Using Digital I/O Statements

There are four statements that control digital I/O signals: WAIT_FOR, WAIT_UNTIL, IO_LIST, and IO.

WAIT_FOR Statement

The WAIT_FOR statement has one required and two optional arguments. The required argument is a constant or Variables database record specifying a digital signal. When a WAIT_FOR statement is encountered in a sequence, the sequence will suspend until the specified signal achieves the correct state.

The syntax for WAIT_FOR is:

WAIT_FOR --input-- {OUTPUT --output-- {PULSE --constant--}} 

If the statement:

WAIT_FOR dev_ready 

is encountered in a sequence, the sequence will suspend until the digital signal specified in the Variables database record "dev_ready" is turned off (if the signal is already off, the sequence will not wait).1

The optional arguments to the WAIT_FOR statement allow you to specify the digital output signal to set and the duration for output signal pulse.

If the statement:

WAIT_FOR dev_ready {OUTPUT dev_run {PULSE 10}} 

is encountered in a sequence, the sequence will suspend until the digital signal specified in "dev_ready" is turned on. When this digital signal is on, execution will resume and the digital output signal specified in the Variables database record "dev_run" will be turned on for 0.1 seconds. (The constant replacing the PULSE argument is multiplied by 0.01 seconds to indicate the total duration of the signal change.) If a pulse argument is not entered, the specified digital output signal will remain on.

If the digital output signal is already at the indicated state, it is not changed.

WAIT_UNTIL Statement

The syntax for WAIT_UNTIL is:

WAIT_UNTIL {--uopr--} --variable-- {--opr-- --variable-- 
{--opr-- --variable-- {opr-- --variable-- {--opr--
--variable-- {--opr-- --variable--}}}}} {TIMEOUT
--constant--} 

WAIT_UNTIL is similar to WAIT_FOR. However, it allows more complicated conditions to be evaluated. The statement has one required argument, a digital signal number or name from the Variables database that specifies a digital signal number (--variable--). If only this argument is specified, sequence execution will halt until the signal is correctly set. The required --variable-- can be preceded with a keyword from the list of unary operators (this operation is applied after all clauses in the statement have been evaluated). NOT is the most commonly used unary operator.

Each optional --variable-- argument also takes a digital signal number or record from the variable database that specifies a digital signal number. Each signal can be preceded with a keyword from the list of operators. AND and OR are the most commonly used operators.

The final optional argument in this statement is a TIMEOUT value. This value sets the maximum time (in 0.01 seconds units) that the sequence will pause while waiting for the correct states of the specified digital I/O signals.

IO Statement

The IO statement has one required and two optional arguments. The required argument is a constant that requires a digital output signal number. When an IO statement is encountered in a sequence, the specified digital output signal will be set to the specified state.

The syntax for IO is:

IO {WAIT_FOR --input--} OUTPUT --output-- 
{PULSE --constant--} 

If the statement:

IO OUTPUT test.sig 

is encountered in a sequence, the digital output signal specified in the variable "test.sig" will be turned on.

The optional arguments to the IO statement allow you to wait for an input signal before signaling the output signal and to specify a duration for the state change of the output signal.

If the statement:

IO {WAIT_FOR -1012} OUTPUT -20 {PULSE 5} 

is encountered, execution will suspend until digital input signal 1012 is turned off. When signal 1012 is turned off, digital output signal 20 will be turned off for 0.05 seconds. Execution will resume at the next statement.

IO_LIST Statement

This statement allows you to set up to 12 output signals at the same time.

The syntax is:

IO_LIST --output-- {--output-- {...}}}}}}}}}} 

IO_LIST_VAR Statement

This statement allows you to set up to 12 output signals at the same time.

The syntax is:

IO_LIST_VAR variable_1 {variable_2
		{variable_3 {... variable_12}}}}}}}}}}} 

The IO_LIST_VAR statement is similar to the IO_LIST statement. However, the signal numbers are stored as AIM variables rather than constants.

1

In all cases where a digital signal is expected, a minus sign (-) can precede the signal number or variable name. This will invert the sense of the signal. Thus "WAIT_FOR -1003" will wait until signal 1003 is low.