1 / 88

Programmable Logic Controllers Third Edition

Programmable Logic Controllers Third Edition. Frank D. Petruzella McGraw-Hill. Chapter 10. Data Manipulation Instructions. Data Manipulation Instructions. Data manipulation instructions enable the programmable controller to manipulate data stored in memory.

rafi
Download Presentation

Programmable Logic Controllers Third Edition

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programmable Logic Controllers Third Edition Frank D. Petruzella McGraw-Hill

  2. Chapter 10 Data Manipulation Instructions

  3. Data Manipulation Instructions Data manipulation instructions enable the programmable controller to manipulate data stored in memory. This extra characteristic gives the PLC capabilities that go far beyond the conventional relay equivalent instructions. Data manipulation involves transfer of data and operation on data with math functions, data conversion, data comparison, and logical operations.

  4. Data Files, Words, And Bits Words of data memory in singular form may be referred to either as registers, elements or as words, depending on the manufacturer. The terms table or file are generally used when a consecutive group of related data memory words is referenced. A group of consecutive elements or words in SLC-500 are referred to as a file, in a ControlLogix controller they are referred to as an array. The data contained in files and words will be in the form of binary bits represented as series of 1's and 0's.

  5. Data Files, Words, And Bits

  6. Data Manipulation Instructions Data manipulation instructions allow the movement, manipulation, or storage of data in either single- or multiple-word groups from one data memory area of the PLC to another. The use of data manipulation instructions in applications that require the generation and manipulation of large quantities of data generally reduces the complexity and quantity of the programming required.

  7. MOV MVM AND NOT OR XOR CLR Move / Logical COMMAND NAME DESCRIPTION NOT Not Performs a NOT operation MVM Masked Move Moves data from a source location to a selected portion of the destination AND And Performs a bitwise AND operation CLR Clear Sets all bits of a word to zero XOR Exclusive Or Performs a bitwise XOR operation MOV Move Moves the source value to the destination OR Or Performs a bitwise OR operation Data Manipulation Instructions

  8. Data Transfer Operations Data manipulation can be placed in two broad categories: data transfer and data comparison. Data transfer instructions simply involve the transfer of the contents from one word or register to another. When new data replaces existing data, the process is referred to as writing over the existing data. Data transfer instructions can address almost any location in the memory. That location may be the preset register for a timer or counter or even an output register that controls a seven-segment display.

  9. Data Transfer Concept

  10. Get/Put Data Transfer Rung The older Allen-Bradley PLC-2 controller uses coil formatted data transfer instructions: GET and PUT. The PUT instruction is used with the GET instruction to form a data transfer rung. When input A is true, the GET/PUT instructions tell the processor to get the numeric value 005 stored in word 020 and put it into word 130.

  11. MOVE (MOV) Instruction Allen-Bradley PLC-5 and SLC-500 controllers use a block formatted MOVE instruction to accomplish data moves. The MOVE instruction is used to copy the value in one word to another word. This instruction copies data from a source word to a destination word.

  12. MOVE (MOV) Instruction When the rung is true, the value stored at the source address, N7:30, is copied into the destination address, N7:20. When the rung goes false, the destination address will retain the value, unless it is changed elsewhere in the program.

  13. Move With Mask (MVM) Instruction The move with mask (MVM) instruction differs slightly from the MOVE instruction because a mask word is involved in the move. The data being moved must pass through the mask to get to their destination address. The MVM instruction is used to copy the desired part of a 16-bit word by masking the rest of the value.

  14. Where there is a 1 in the mask, data will pass from the source to the destination. Where there is a 0 in the mask, data in the destination will remain in their last state. Move With Mask (MVM) Instruction The mask may be entered as an address or in hexadecimal format, and its value will be displayed in hexadecimal.

  15. Move With Mask (MVM) Instruction

  16. On each scan, when the rung that contains the BTD instruction is true, the processor moves the bit field from the source word to the destination word. Bit Distribute (BTD) Instruction The bit distribute (BTD) instruction is used to move bits within a word or between words. Moving bits between words To move data within a word, enter the same address for the source and destination

  17. Program To Change The Preset Value Of A Timer Using The MOVE (MOV) Instruction • When the selector switch is 10-s position, rung 2 has logic continuity and rung 3 does not. As a result, the value 10 stored at the source address, N7:1, is copied into the destination address, T4:1 PRE. • Therefore, the preset value of the timer T4:1 will be 10. When PB1 is closed, there will be a 10-s delay period before the pilot light is energized. • To change the preset value of the timer to 5 s, the selector switch is turned to the 5-s position. This makes rung 3 true and rung 2 false. As a result, the preset value of the timer will change from 10 to 5. Closing PB1 will now result in a 5-s time-delay period before the pilot light is energized.

  18. Changing The Preset Value Of A Timer Using The MOVE (MOV) Instruction

  19. Program To Change The Preset Value Of A Counter Using The MOVE (MOV) Instruction • A limit switch provides count pulses for products coming off of a conveyor line onto a storage rack. The storage rack has room for only 300 boxes of product A or 175 boxes of product B or 50 boxes of product C. • Three switches are provided to select the desired preset counter value depending on the product line being manufactured. • A reset button is provided to reset the accumulated count to zero. • A pilot lamp is switched on when the storage rack is full. • If more than one of the preset counter switches is closed, the last value is selected.

  20. Changing The Preset Value Of A Counter Using The MOVE (MOV) Instruction

  21. A batch process program may contain several separate recipes in different files that can be selected by an operator. Moving Data With File Instructions A file is a group of related consecutive words in the data table that have a definite start and end and are used to store information.

  22. Moving Data With File Instructions Files allow large amounts of data to be scanned quickly and are useful in programs requiring the transfer, comparison, or conversion of data. File to File File to Word Word to File

  23. PLC-5 And SLC-500 Word And File Addresses

  24. FAL (File, Arithmetic, and Logical) Instruction The file, arithmetic and logic (FAL) instruction is used to copy data from one file to another and to do file math and file logic.

  25. FAL (File, Arithmetic, and Logical) Instruction Control is the address of the control structure in the control area (R) of processor memory. The processor uses this information to run the instruction.

  26. FAL (File, Arithmetic, and Logical) Instruction Length represents the file length. Position represents the current location in the data block that the processor is accessing. It points to the word being operated on. Mode represents the number of file elements operated on per program scan: all mode, numeric mode, or incremental mode. Destination is the address where the processor stores the result of the operation. Expression contains addresses, program constraints, and operators that specify the source of data and the operations to be performed. The expression entered determines the function of the FAL instruction.

  27. File-To-File Function Using The FAL Instruction When input A goes true, data from the expression file #N7:20 will be copied into the destination file #N7:50

  28. File-To-Word Copy Function Using The FAL Instruction With each false-to-true transition of input A, the processor reads one element of integer file N29, starting at element 0, and writes the image into element 5 of integer file N29. The instruction writes over any data in the destination.

  29. Word-To-File Copy Function Using The FAL Instruction If we start at position 0, the data from N7:100 will be copied to N7:101 on the first false-to-true transition of input A. On successive transitions the data will be copied into the next position in the file.

  30. Copying Recipes And Storing Values For Timer Presets The exceptions to the rule that file addresses must take consecutive words in the data table are the timer, counter, and control data files for the FAL instruction. In these three data files, if you designate a file address, the FAL instruction will take every third word in that file and make a file of preset, accumulated, length, or position data within the corresponding file type.

  31. File Copy (COP) And File Fill (FLL) Instructions The file copy (COP) instruction and the file fill (FLL) instruction are high-speed instructions that operate more quickly than the same operation with the FAL instruction. Unlike the FAL instruction, there is no control element to monitor or manipulate. Data conversion does not take place, so the source and destination should be the same file types.

  32. File Copy (COP) Instruction Location in RSLogix software When input A goes true, the values in file N40 are copied to file N20.

  33. Fill (FLL) Instruction Location in RSLogix software When input A goes true, the value in N15:5 is copied into N20:1 through N20:6 Since the instruction transfers to the end of the file, the file will be filled with the same data value in each word.

  34. Using The FLL Instruction To Zero All Of The Data In A File Momentarily closing PB1 copies the contents of file #N10:0 into file #N12:0. Momentarily closing PB2 then clears file #N12:0. Note that zero is entered for the source value.

  35. 1. Data transfer instruction can not address timer or counter preset values. (True/False) 2. The terms table or file are generally used when a consecutive group of related memory words is referenced. (True/False) 3. PLCs can not handle manipulation of entire words. (True/False)

  36. 4. The ______ parameter of the FAL instruction is used to run the instruction. • Mode (b) Position • (c) Control (d) Length 5. For the MVM instruction,where there is a _____ in the mask, data will pass from the source to the destination. (a) 0 (b) 1 (c) 5 (d) 10

  37. 6. In the example of the instruction shown, when the rung is true the value stored in N20:0 will be: (a) 30 (b) 100 (c) 20 (d) 120

  38. 7. For the example of the instruction shown, when the rung is true the value stored in the destination address is: a. 1010101010101010 c. 1111111111111111 b. 1010101011001010 d. 0000000000000000

  39. 8. The example of the instruction shown is one of a ______ copy function. a. word-to-file c. file-to-file b. file-to-word d. word-to-word

  40. 9. For the program shown, the preset value of the counter would be: • 0 • 50 • 175 • 300

  41. 10. For the program shown, closing PB2 changes all the data in #N10:0 to 0. (True/False)

  42. Data Compare Instructions Data transfer operations are all output instructions, whereas data compare instructions are input instructions. Data Compare Instruction Data compare instructions compare the data stored in two or more words (or registers) and make decisions based on the program instructions.

  43. RSLogix Data Compare Instructions LIM MEQ EQU NEQ LES GRT LEQ GEQ LEQ Less Than or Equal Test whether one value is less than or equal to a second value LIM Limit Test Test whether one value is within the limit range of two other values LES Less Than Test whether one value is less than a second value EQU Equal Test whether two values are equal GEQ Greater Than or Equal Test whether one value is greater than or equal to a second value GRT Greater Than Test whether one value is greater than a second value NEQ Not Equal Test where one value is not equal to a second value MEQ Masked Comparison For Equal Test portions of two values to see whether they are equal

  44. Equal (EQU) Instruction The equal (EQU) instruction is an input instruction that compares source A to source B. When source A is equal to source B, the instruction is logically true; otherwise it is logically false.

  45. 250 EQUAL (EQU) Logic Rung When the accumulated value of counter T4:0 stored in source A's address equals the value in source B's address, N7:40, the instruction is true and the output is energized. 100

  46. NOT EQUAL (NEQ) Instruction The notequal (NEQ) instruction is an input instruction that compares source A to source B. When source A is not equal to source B, the instruction is logically true; otherwise it is logically false.

  47. 25 NOT EQUAL (NEQ) Logic Rung When the value stored at source A's address, N7:5, is not equal to 25, the output will be true, otherwise the output will be false.

  48. GREATER THAN (GRT) Instruction The greater than (GRT) instruction is an input instruction that compares source A to source B. When source A is greater than source B, the instruction is logically true; otherwise it is logically false.

  49. 220 GREATER THAN (GRT) Logic Rung When the accumulated value of the timer T4:10, stored at the address of source A, is greater than the constant 200 of source B, the output will be on; otherwise, it will be off. 150

  50. LESS THAN (LES) Instruction The less than (LES) instruction is an input instruction that compares source A to source B. When source A is less than source B, the instruction is logically true; otherwise it is logically false.

More Related