CONTREX CX-1200 User Manual

Page 176

Advertising
background image

5 - 83

There are three parts to the stack: the Result Register (R); a bit mapped location named “S0” (bit location
“0”); and a bit mapped location named “S1” (bit location “1”). When the stack is lifted with the “LOAD”
and “LOAD NOT” commands, the contents of “S0” is copied to “S1” (the contents of “S1” is overwritten)
and the contents of the Result Register (R), is copied to “S0” and the contents of the operand (or the
complement of) is copied to the Result Register, “R”. When the Stack is dropped as in the “AND 0”, the
“OR 0”, the “AND NOT 0” and the “OR NOT 0” commands, then the contents of “S0” (or its complement)
is “AND’ed” or “OR’ed” with the Result Register (R) and the result is left in (R). The contents of “S1” is
copied to “S0” (the contents of “S0” is overwritten), and the contents of “S1” remains the same. The
following example shows the stack before and after the “LOAD” and “AND 0” commands.

Location 08 (DI_8): 1

Before “LOAD 8 DI_8”:

After “LOAD 8 DI_8”:

S1: 0

S1: 1

S0: 1

S0: 0

R: 0

R: 1

Before “AND 0 S0”:

After “AND 0 S0”:

S1: 1

S1: 1

S0: 0

S0: 1

R: 1

R: 0

For commands other than “LOAD” and “LD NOT” with an operand other than “0” (S0), there is no stack
movement. For example; the “AND 9 DI_9” results in an “AND”s of the contents of Bit Location 09
(DI_9) with the Result Register (R) and the result of the operation stays in the Result Register (R). There is
no stack movement and “S0” and “S1” remain the same. The “LOAD” and “LD NOT ”commands always
lift the stack. The stack drops only when the operand is “0” (S0) for the “AND”, “OR”, “XOR”, “AND
NOT”, “OR NOT ” and “XOR NOT ” commands.

THE COMMANDS

1. LOAD
This starts a new Rung (group of commands). The stack is lifted and the contents of the operand bit is loaded
into the Result Register (R).

2. LD NOT
Same as “LOAD” but the Result Register is complemented after the load. This is used for starting the rung
with a normally-closed contact.

3. AND
The contents (the bit value) of the operand bit is AND’ed with the Result Register (R). The operand is
unaffected. The result is retained in the Result Register. If the operand is “0” (i.e., the “S0” register), then
the stack is dropped.

4. AND NOT
The complement of the operand bit is AND’ed with the Result Register (R). The operand is unaffected. The
result is retained in the Result Register. If the operand is “0” (i.e., the "S0" register), then the stack is
dropped. This is typically used to “AND” in a normally-closed contact.

Advertising