Micromod Micro-DCI: 53MC5000 Multi-Loop Process Controller CUSTOMIZATION GUIDE User Manual

Page 16

Advertising
background image

W and D Operators

The swap (W) and duplicate (D) operators may be used to swap and duplicate data
values of the same type. For example, when a D operator is issued it will duplicate
the last value on the stack, which may be an L, B, C or H type. If a W operator is
issued it will swap the last two values on the stack (both must be the same data type).

Q Operator

The exactly equal operator (Q) can be used in decision statements to compare
two byte values, whereby either of the two byte values can include a numeric
literal. For example, to compare the last two B values on the stack — B32 2 Q ? S04.
The logical result of the comparison will cause a "0" to be placed on the stack if they
are equal (no skip), and, if they are not equal, a logical "1" will replace the two values
on the stack.

! Operator

The invert (!) operator can be used to invert the logic state of a bit or each bit in a byte
before it is applied to the gate input, or to invert the respective gate output logic. A logic bit
can take either of two states: high or logic level "1" or low or logic level "0". For example, a
contact input can be assigned a logical "1" state for a closed contact and a logical "0" state
for an open contact. Use of the invert operator permits altering gate functions to produce
the desired logic result.

& ’ X Operators

AND, OR, and XOR operators can be used with bit and byte type data when writing state-
ments.
Any of these three basic gate functions may be implemented by simply inserting the
applicable operator in the program statement. When applied to byte data, the operation
is performed on a bit by bit bases.To determine the output of a particular gate configuration
for a given set of input conditions, it may be necessary to develop a Truth Table as shown
in Figure 1.
When writing F-TRAN statements it must be remembered that conditional statements
are always evaluated such that if the stated conditions are not met, the result is false.
Two examples (from Figure 1) are shown below.

1) AND with Input A INVERT
L15 = L20 ! L58 & ;

If L20 INVERT = 1 and L58 = 1, then the AND operator will replace a logical "1" on
the stack. When the end of statement operator occurs, the bit will be removed from
the stack and L15 will be set to a logical "1" if the bit is a logical "1".

2) AND INVERT
L56 L81 & ! S02

If L56 is a logical "1" and L81 is a logical "1", then the AND operator will place a
logical “1" on the stack. The INVERT operator will transform this "1" to a "0", placing
a "0" bit back on the stack memory. The skip decision is determined by the logic level
of the bit remaining in the stack, as follows:

MODULAR CONTROLLER CUSTOMIZATION GUIDE

2-9

Advertising