|
Examples of the equivalent ladder logic and IL pro grams are shown in Figure 18.4 and Figure 18.5. The programs in Figure 18.4 show differ ent 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.
plc il -18.5
Ladder
Instruction List (IL)
AX
LD A ST X
LDN A
X ST X
LD A
X LD B ANB ST X
LD A
X LDN B ANB ST X
LD A
X LD B ORB LD C ANB ST X
LD A
X LD B LD C ORB ANB ST X
X LD A LD B ORB LD C LD D ORB ANB ST X LD A AND B ST X
LD A ANDN B ST X
LD A OR B AND C ST X
LD A LD B OR C ANB ST X
LD A OR B LD C OR D ANB ST X BACK Easy Access To All Pages 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|