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 17.1 IL Equivalents for Ladder Logic and Figure 17.1 IL Programs for Multiple Outputs. The programs in Figure 17.1 IL Equivalents for Ladder Logic 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 17.1 IL Programs for Multiple Outputs 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 normally 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.
Complex instructions can be represented in IL, as shown in Figure 17.1 A Complex Ladder Rung and Equivalent IL. Here the function are listed by their mnemonics, and this is followed by the arguments for the functions. The second line does not have any input contacts, so the stack is loaded with a true value.
An example of an instruction language subroutine is shown in Figure 17.1 An Example of an IL Program. This program will examine a BCD input on card I:000, and if it becomes higher than 100 then 2 seconds later output O:001/00 will turn on.