THE ALLEN-BRADLEY VERSION
Allen Bradley only supports IL programming on the Micrologix 1000, and does
not plan to support it in the future. Examples of the equivalent ladder logic and IL programs
are shown in Figure 18.4 and Figure 18.5. The programs in Figure 18.4 show different
variations when there is only a single output. Multiple IL programs are given where
available. When looking at these examples recall the stack concept. When a LD or LDN
instruction is encountered it will put a value on the top of the stack. The ANB and ORB
instructions will remove the top two values from the stack, and replace them with a single
value that is the result of an Boolean operation. The AND and OR functions take one value
off the top of the stack, perform a Boolean operation and put the result on the top of the
stack. The equivalent programs (to the right) are shorter and will run faster.
Figure 18.5 shows the IL programs that are generated when there are multiple outputs.
This often requires that the stack be used to preserve values that would be lost nor-
mally using the MPS, MPP and MRD functions. The MPS instruction will store the current
value of the top of the stack. Consider the first example with two outputs, the value of A is
loaded on the stack with LD A. The instruction ST X examines the top of the stack, but
does not remove the value, so it is still available for ST Y. In the third example the value of
the top of the stack would not be correct when the second output rung was examined. So,
when the output branch occurs the value at the top of the stack is copied using MPS, and
pushed on the top of the stack. The copy is then ANDed with B and used to set X. After
this the value at the top is pulled off with the MPP instruction, leaving the value at the top
what is was before the first output rung. The last example shows multiple output rungs.
Before the first rung the value is copied on the stack using MPS. Before the last rung the
value at the top of the stack is discarded with the MPP instruction. But, the two center
instructions use MRD to copy the right value to the top of the stack - it could be replaced
with MPP then MPS.
ليست هناك تعليقات:
إرسال تعليق