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

N7:20  00 00     1  1  1  1  0  00 0  1  1  1  1       •  The instruction may be programmed with input
                            Original data stored in registers N7:30 and N7:20  conditions preceding it, or it may be programmed
                                                                             unconditionally.
                    N7:28                                                  A Masked Move (MVM) instruction functions like a
                    N7:29
                    N7:30  1  1  00  1  1  1  00  1  1  0  1  1  1  0    standard move (MOV) instruction, except that a masked
                     N7:31                                               move allows data to be filtered out that is not required to
                                             (a)                         be moved. The mask parameter specified in the instruc-
                                                                         tion block is what performs this filtering process. This
                    N7:20  1  1  00  1  1  1  00  1  1  0  1  1  1  0    mask parameter can be either a word address location or a
                             Data transferred from register N7:30 to N7:20
                                                                         numerical constant. The operation of the mask parameter
                                                                         can be summarized as follows:
                    N7:28
                    N7:29                                                  •  The pattern of characters in the mask determines
                    N7:30  1  1  00  1  1  1  00  1  1  0  1  1  1  0        which source bits will be passed through to the des-
                     N7:31                                                   tination address.
                                             (b)
                                                                           •  The bits in the mask that are set to zero (0) do not
                   Figure 10-3  Data transfer concept.                       pass data.
                                                                           •  Only the bits in the mask that are set to one (1) will
                     Data transfer instructions can address almost any loca-  pass the source data through to the destination.
                   tion in the memory. Prestored values can be automatically   •  Bits in the destination are not affected when the cor-
                   retrieved and placed in any new location. That location   responding bits in the mask are zero.
                   may be the preset register for a timer or counter or even   •  The MVM instruction is used to copy the desired part
                   an output register that controls a seven-segment display.  of a 16-bit word by masking the rest of the value.
                     SLC 500 controllers use a block-formatted  move
                   (MOV) instruction to accomplish data moves. The MOV     Figure 10-5 shows an example of a mask move (MVM)
                   instruction is used to copy the value in one register or word   instruction.  This instruction  transfers  data  through  the
                   to another. This instruction copies data from a source reg-  mask from the source address, B3:0, to the destination
                   ister to a destination register. Figure 10-4 shows an exam-  address, B3:4. The operation of the program can be sum-
                   ple of the MOV instruction. The operation of the program   marized as follows:
                   can be summarized as follows:                           •  The mask may be entered as an address or in hexa-

                     •  When the rung is true, input switch A closed, the    decimal format, and its value will be displayed in
                       value stored at the source address, N7:30, is copied   hexadecimal.
                       into the destination address, N7:20.
                     •  When the rung goes false, input switch A opened,                         Ladder logic program
                       the destination address will retain the value unless it   Input
                       is changed elsewhere in the program.               L1               A        MVM
                                                                                   A                MASKED MOVE
                     •  The source value remains unchanged and no data                              Source          B3:0
                       conversion occurs.                                                           1010101010101010  B3:1
                                                                                                    Mask
                                                                                                                    FF0F
                                                         N7: Integer table                          Destination     B3:4
                        Input      Ladder logic program                                             1010101011001010

                   L1                                        N7:20
                               A                                           10101010 1010 1010     Source B3:0
                           A         MOV
                                     MOVE                                  11111111 0000 1111
                                     Source    N7:30                                              Mask FF0F
                                     Destination  N7:20                    11001100 1100 1100     Destination B3:4 before instruction
                                                                                                  went true
                                                                           10101010 1100 1010     Destination B3:4 after instruction
                                                             N7:30                                went true

                                                                                    Unchanged
                   Figure 10-4  SLC 500 block-formatted move instruction.  Figure 10-5  Masked move (MVM) instruction.



                                                                              Data Manipulation Instructions  Chapter 10  209







          pet73842_ch10_207-233.indd   209                                                                              03/11/15   4:02 PM
   223   224   225   226   227   228   229   230   231   232   233