Page 109 - Programmable Logic Controllers, Fifth Edition
P. 109

pushbuttons are represented by the Examine If Closed
                                             5
                                        4
                          1    2   3  Discrete inputs  6  7  B3:1/3  same results. You will note that both the NO and the NC
                Rung 1                                               symbol. This is because the normal state of an input (NO
                                                          Internal   or NC) does not matter to the controller. What does matter
                                                           relay     is that if contacts need to close to energize the output, then
                                                           coil
                                     Discrete inputs                 the Examine If Closed instruction is used. Since both PB1
                        B3:1/3  8  9    10   11  12                  and PB2 must be closed to energize the pilot light, the
                Rung 2                                               Examine If Closed instruction is used for both.
                        Internal                          Discrete      A simple program using the Examine If Open (XIO)
                         relay                            output     instruction is shown in Figure 5-44. Both the hardwired
                        contact
                                                                     circuit and user program are shown. In the hardwired cir-
               Figure 5-42  Programmed internal relay control.       cuit, when the pushbutton is open relay coil CR is de-
                                                                     energized and its NO contact closes to switch the pilot
               5.8  Programming Examine If Closed                    light on. When the pushbutton is closed, relay coil CR
               and Examine If Open Instructions                      is energized and its NC contact opens to switch the pilot
                                                                     light off. The pushbutton is represented in the user pro-
               A  simple  program using  the  Examine  If  Closed  (XIC)   gram by an Examine If Open instruction. This is because
               instruction is shown in Figure 5-43. This figure shows a
               hardwired circuit and a user program that provides the      Hardwired circuit       User program providing
                                                                            PB1                       the same results
                                              User program providing
                     Hardwired circuit          the same results                                      PB_1
                                                                                     CR                        PL
                    PB1
                           PB2                PB_1   PB_2   PL              CR
                                  PL                                                 PL


               Figure 5-43  Simple program that uses the Examine If   Figure 5-44  Simple program that uses the Examine If
               Closed (XIC) instruction.                             Open (XIO) instruction.

                                                                 The status of the instruction is
                                   If the data table bit  XIC             XIO              OTE
                                         is       EXAMINE IF CLOSED  EXAMINE IF OPEN  OUTPUT ENERGIZE



                                       Logic 0          False            True              False

                                       Logic 1          True             False             False

                                       Input instructions       Output instruction
                                       XIC      XIO                 OTE





                                               Instruction outcome               Input bit status
                                     Time       XIC      XIO       OTE           XIC     XIO     OTE
                                    t (initial)  False  True       False          0       0       0

                                     1
                                      t 2       True    True     Goes true        1       0       1
                                      t 3       True    False    Goes false       1       1       0
                                      t 4       False   False   Remains false     0       1       0

                                 Figure 5-45  Simple program using both the XIC and XIO instructions.



               90         Chapter 5  Basics of PLC Programming







          pet73842_ch05_074-097.indd   90                                                                               05/11/15   4:17 PM
   104   105   106   107   108   109   110   111   112   113   114