Page 240 - Programmable Logic Controllers, Fifth Edition - Mobile version
P. 240

Ladder logic program
                                                                         as follows:
                       MEQ                                 Output   L2   The operation of the hardwired circuit can be summarized
                       MASKED EQUAL             PL1
                                                         PL1               •  When the momentary start pushbutton is pressed
                       Source          N7:5
                                                                             solenoid A is energized immediately.
                       Mask            N7:6                                •  Solenoid B is energized 5 s later than solenoid A.
                       Compare        N7:10                                •  Solenoid C is energized 10 s later than solenoid A.
                                                                           •  Solenoid D is energized 15 s later than solenoid A.
                       Source   N7:5  01010101  0101 1111
                       Mask     N7:6  1 1 1 1 1 1 1 1  1 1 1 1 0000        The hardwired time-delay circuit could be implemented
                       Compare  N7:10 01010101  0101 xxxx                using a conventional PLC program and three internal

                   Figure 10-32  Masked comparison for equal (MEQ)       timers. However, the same circuit can be programmed
                   logic rung.                                           using only one internal timer along with data compare in-
                                                                         structions. Figure 10-34 shows the program required to
                                                                         implement the circuit using only one internal timer. The
                     •  The mask must be the same element size (16 bits) as
                       the source and compare addresses.                 operation of the program can be summarized as follows:
                     •  You must set mask bits to 1 to compare data. Bits   •  The momentary stop button is closed.
                       in the compare address that correspond to 0s in the   •  When the momentary start button is pressed,
                       mask are not compared.                                SOL A output energizes immediately to switch
                     •  If you want the ladder program to change mask        on solenoid A.
                       value, store the mask at a data address. Otherwise,   •  SOL A examine-on contact becomes true to seal in
                       enter a hexadecimal value for a constant mask value.  output SOL A and to start on-delay timer T4:1 timing.
                                                                           •  The timer preset time is set to 15 seconds.
                   10.4  Data Manipulation Programs                        •  Output SOL B will energize after a total time delay

                   Data manipulation instructions give new dimension and     of 5 seconds, when the accumulated time becomes
                   flexibility to the programming of control circuits. For ex-  equal to and then greater than 5 seconds. This, in
                   ample, consider the hardwired relay-operated, time-delay   turn, will energize solenoid B.
                   circuit in Figure 10-33. This circuit uses three electrome-  •  Output SOL C will energize after a total time delay
                   chanical time-delay relays to control four solenoid valves.   of 10 seconds, when the accumulated time becomes
                                                                             equal to and then greater than 10 seconds. This, in
                                                                             turn, will energize solenoid C.
                     L1                                          L2
                                                                           •  Output SOL D will energize (through the timer done
                                                          CR                 bit T4:1/DN) after a total time delay of 15 seconds
                                     Start
                           Stop                                              to energize solenoid D.
                                                             SOL A
                                                                           Figure 10-35 shows an application of an on-delay timer
                                                                         program implemented using the EQU instruction. The op-
                                                         1TD
                                      CR                                 eration of the program can be summarized as follows:
                           1TD                               SOL B         •  When the switch (S1) is closed, timer T4:1 will
                               (5 s)
                                                                             begin timing.
                                                         2TD               •  Both EQU instructions’ source As are addressed to
                                                                             get the accumulated value from the timer while it is
                           2TD                               SOL C
                               (5 s)                                         running.
                                                                           •  The EQU instruction of rung 2 has the value of 5
                                                         3TD
                                                                             stored in source B.
                           3TD                               SOL D         •  When the accumulated value of the timer reaches 5,
                               (5 s)                                         the EQU instruction of rung 2 will become logic
                                                                             true for 1 second.

                   Figure 10-33  Three electromechanical time-delay relays   •  As a result, the latch output will energize to switch
                   used to control four solenoid valves.                     the pilot light PL1 on.



                                                                              Data Manipulation Instructions  Chapter 10  221







          pet73842_ch10_207-233.indd   221                                                                              03/11/15   4:02 PM
   235   236   237   238   239   240   241   242   243   244   245