PLC Math Instructions
description
Transcript of PLC Math Instructions
![Page 1: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/1.jpg)
![Page 2: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/2.jpg)
Chapter
10PLC Math Instructions
![Page 3: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/3.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Objectives
• Program the add instruction in the PLC ladder logic diagram.
• Program the subtract instruction in the PLC ladder logic diagram.
• Program the multiply instruction in the PLC ladder logic diagram.
• Program the divide instruction in the PLC ladder logic diagram.
![Page 4: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/4.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Addition
• Add (ADD) instruction has three operands:– Two operands hold source data
(Source A and Source B), which are added together.
– Either both sources can be registers or one source can be a register while the other one is a number.
– Third operand is the destination.
![Page 5: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/5.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Addition (Cont.)
• Add instruction for Allen-Bradley SLC 500 series PLC displayed in block format.
![Page 6: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/6.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Description of Status Bits
![Page 7: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/7.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Subtraction
• Subtract (SUB) instruction has three operands:– Two operands, Source A and Source B,
hold the source data. – Content of Source B is subtracted from
Source A. – Result is placed in the destination.
![Page 8: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/8.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Subtraction (Cont.)
• Subtract instruction for the Allen-Bradley SLC 500 series PLC displayed in block format.
![Page 9: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/9.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Multiplication
• Multiply (MUL) instruction has three operands:– Two operands hold the source data
(Source A and Source B).– Either both sources can be registers, or
one source can be a register while the other one is a number.
– Destination must be a register.
![Page 10: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/10.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Multiplication (Cont.)
• Multiply instructions in SLC 500 series PLCs displayed in block format.
![Page 11: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/11.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Division
• Divide (DIV) instruction has three registers:– Two registers hold the source data
(Source A and Source B).– Either both sources can be registers or
one source can be a register while the other one is a number.
– Destination must be a register.
![Page 12: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/12.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Division (Cont.)
• Divide instructions in SLC 500 series PLCs displayed in block format.
![Page 13: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/13.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Advanced Math Instructions
• Advanced math instructions are used to perform mathematical computations.
![Page 14: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/14.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Advanced Math Instructions (Cont.)
• Compute (CPT) instruction may be used to solve mathematical equations.
![Page 15: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/15.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Advanced Math Instructions Example
• Given the following equation, you can use the CPT instruction to solve it.
Y = (A × (ln B) × eC) + (tan D)
![Page 16: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/16.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Advanced Math Instructions Example (Cont.)
• First assign floating point register locations for the parameters in the equation.
• Note that integer registers such as N7:0 hold integer numbers.
• Floating point registers such as F8:0 hold a real number that has both integer and fractional part.
![Page 17: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/17.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Advanced Math Instructions Example (Cont.)
• Assigned registers are:A = F8:0B = F8:1C = F8:2D = F8:3Y = F8:4
![Page 18: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/18.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Advanced Math Instructions Example (Cont.)
• Normally open contact I:1/0 is closed, equation in CPT instruction block calculated.
• Result is placed in floating point register four (F8:4).
![Page 19: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/19.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
PLC Ladder Logic Diagram
![Page 20: PLC Math Instructions](https://reader033.fdocuments.us/reader033/viewer/2022061509/56816133550346895dd08a6b/html5/thumbnails/20.jpg)
Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.
Commonly Used Math Instructions