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

Scale analog output
                                                            Analog
                             SCALE  W/PARAMETERS            Output
                            Input                        N7:21  Module  4 to 20 mA
                                                                    0 <  From  analog signal
                            Input Min.                       0  processor  DAC       Transducer
                                                                    0 <
                            Input Max.                  100             Scaled output               Proportional
                                                                100 <      O:1.0                    control valve
                            Scaled Min.             6242
                                                              6242 <                 Water                  Controlled
                            Scaled Max.           31208                              source                 water flow
                                                            31208 <
                            Scaled Output         O:1.0          Percent open register N7:21
                                                                    0 <  0000000000000000
                                                           15                             0
                          Figure 11-23  Scale analog output using the SCP instruction.



                   11.7  File Arithmetic Operations                          data in file address N7:25 to the data stored in file
                                                                             address N7:50 and store the result in file address
                   File arithmetic functions include file add, file subtract,   N7:100.
                   file multiply, file divide, file square root, file convert from   •  The rate per scan is set at All, so the instruction
                   BCD, and file convert to BCD. The file arithmetic and     goes to completion in one scan.
                   logic (FAL) instruction can combine an arithmetic opera-
                   tion with file transfer. The arithmetic operations that can   The program of Figure 11-25 is an example of the file
                   be implemented with the FAL are ADD, SUB, MULT,       subtract function of the FAL instruction. The operation of
                   DIV, and SQR.                                         the logic rung can be summarized as follows:
                     The  file add function of the FAL instruction can be   •  When input switch SW is closed the rung goes true
                   used to perform addition operations on multiple words.    and the processor subtracts a program  constant (255)
                   The program of Figure 11-24 is an example of the file add   from each word of file address N10:0 and stores the
                   function of the FAL instruction. The operation of the logic   result at the destination file address, N7:255.
                   rung can be summarized as follows:
                                                                           •  The rate per scan is set at 2, so it will take 2 scans
                     •  When input switch SW is closed the rung goes true    from the moment the instruction goes true to com-
                       and the expression tells the processor to add the     plete its operation.



                        Input           Ladder logic program                  Input           Ladder logic program
                    L1            SW                                     L1             SW
                                         FAL                                                   FAL
                            SW           FILE ARITH/LOGICAL     EN                SW           FILE ARITH/LOGICAL     EN
                                         Control         R6:1   DN                             Control         R6:5   DN
                                         Length             4                                  Length             4
                                         Position          0    ER                             Position          0    ER
                                         Mode             All                                  Mode              2
                                         Destination  #N7:100                                  Destination  #N7:255
                                         Expression                                            Expression
                                         #N7:25 + #N7:50                                       #N10:0 – 255

                          #N7:25            #N7:50            #N7:100                 #N10:0                  #N7:255
                   N7:25   25    + N7:50      50    = N7:100     75             N10:0  680     –  255  = N7:255  425
                           234   +            22                256                    950                      695
                          1256   +           456                1712                    20                     –235
                   N7:28    77   + N7:53     100    = N7:103     177            N10:3  100          = N7:258   –155

                   Figure 11-24  SLC 500 file add function of the FAL    Figure 11-25  SLC 500 file subtract function of the FAL
                   instruction.                                          instruction.



                                                                                        Math Instructions  Chapter 11   245







          pet73842_ch11_234-251.indd   245                                                                              03/11/15   4:08 PM
   259   260   261   262   263   264   265   266   267   268   269