Arithmetic Instructions 
Chapter 06 and supplemental material 
Northampton Community College 1
Arithmetic Instructions 
Mnemonic Name Mnemonic Name 
ADD Addition SWP Swap 
SUB Subtraction ASN Arc Sine 
MUL Multiply ACS Arc Cosine 
DIV Divide ATN Arc Tangent 
DDV Double Divide (SLC500) COS Cosine 
CLR Clear LN Natural Log 
SQR 
Square Root 
(SQRT, Siemens) 
LOG Log to the Base 10 
SCP Scale with Parameters SIN Sine 
SCL Scale TAN Tangent 
ABS Absolute Value XPY 
X to the Power of Y 
(EXPT, Siemens) 
CPT Compute NEG Negate 
We will only be learning about the instruction shown in red 
Northampton Community College 2
Allen Bradley Arithmetic Instructions 
 Math instructions are output instructions, therefore they are 
placed against the right power rail. 
 The ControlLogix processor allows math instructions to be 
placed in series on the right side of the rung. (Not in this course) 
 The ADD, SUB, MUL and DIV instructions have three 
parameters: 
 Source A 
 Source B 
 Destination 
RSLogix 500 and LogixPro ControlLogix 
Northampton Community College 3
Basic Arithmetic Instructions 
 The ADD, SUB, MUL and DIV instructions have three parameters: 
 Source A 
 Source B 
 Destination 
 These parameters have the following rules. 
1. Source A and Source B 
 In the SLC500 can be any valid word level address of type INT or FLOAT. 
 In LogixPro can be any valid word level address of type INT. 
 In ControlLogix a tag of type SINT, INT, DINT or REAL. 
2. Source A can be a program constant and Source B 
 In the SLC500 can be any valid word level address of type INT or FLOAT. 
 In LogixPro can be any valid word level address of type INT. 
 In ControlLogix a tag of type SINT, INT, DINT or REAL 
3. Source B can be a program constant and Source A 
 In the SLC500 can be any valid word level address of type INT or FLOAT. 
 In LogixPro can be any valid word level address of type INT. 
 In ControlLogix a tag of type SINT, INT, DINT or REAL. 
4. Source A and Source B cannot both be program constants. 
5. The Destination is always 
 In the SLC500 a valid word level address of type INT or FLOAT . 
 In LogixPro a valid word level address of type INT. 
 In ControlLogix a tag of type SINT, INT, DINT or REAL. 
Northampton Community College 4
Siemens Arithmetic Instructions 
 The Siemens processor allows math instructions to be 
placed in series on the rung. 
 The ADD, SUB, MUL and DIV instructions have at least six 
parameters: 
 Instruction Data Type 
 Enable (EN) 
 Enable Out (ENO) 
 OUT 
 IN1, IN2, (INn when the yellow star is present) 
Northampton Community College 5
Arithmetic Instructions 
Arithmetic instructions can be conditional or unconditional: 
 Conditional – Input logic determines when the instruction executes. 
 Unconditional – Instruction executes every scan. 
Conditional 
Unconditional 
ADD 
Add 
Source A Vessel_A_Level 
0 
Source B Vessel_B_Level 
0 
Dest Total_of_Batch 
0 
Northampton Community College 6
Allen Bradley Addition (ADD) Instruction 
 The ADD instructions adds the value in Source A to the value in 
Source B and stores the sum in the Destination. 
Source A  SourceB  
Destination 
N N N 
7 : 0 7 : 2 7 :1 
 bit signed sum 
 
  
200 650 850 16 
   
LogixPro is 32 
 
bit signed 
0 Add 
ADD 
Source A Vessel_A_Level 
367 
Source B Vessel_B_Level 
780 
Dest Total_of_Batch 
1147 
SourceA  SourceB  
Destination 
Vessel _ A _ Level  Vessel _ B _ Level  
Total _ of _ 
Batch 
 bit signed sum 
367 780 1147 32 
   
Northampton Community College 7
SLC500 Arithmetic Status Bits 
 There are four arithmetic status bits. All of the arithmetic instructions share the 
same four status bits. 
 These bits will contain the status of the last math instruction that is executed. 
 These bits are located in the Status File (S2) and are described as follows (Not 
available in the LogixPro Simulator): 
Status Bit Name Description 
S:0/0 Carry (C) 
Bit is set to a (1) if a carry is generated; otherwise it is 
cleared (0). (It is for you to determine how this bit 
works) 
S:0/1 Overflow (V) 
Bit is set to a (1) if the result or value of the math 
instruction does not fit into the designated destination. 
Value is smaller than -32,768 or larger than 32,767; 
otherwise it is cleared (0). 
S:0/2 Zero (Z) 
Bit is set to a (1) if the result or value after a math, 
move or logic instruction is zero; otherwise it is cleared 
(0). 
S:0/3 Sign (S) 
Bit is set to a (1) if the result or value after a math, 
move or logic instruction is a negative (less than zero) 
value; otherwise it is cleared (0). This bit is not to be 
confused with the sign bit (15) of a 16-bit word. 
Northampton Community College 8
ControlLogix Arithmetic Status Bits 
 There are four arithmetic status bits. All of the arithmetic instructions share the 
same four status bits. 
 These bits will contain the status of the last math instruction that is executed. 
Status Bit Name Description 
S:C Carry (C) 
Bit is set to a (1) if a carry is generated; otherwise it is 
cleared (0). (It is for you to determine how this bit 
works) 
S:V Overflow (V) 
Bit is set to a (1) if the result or value of the math 
instruction does not fit into the designated destination. 
Min. and max. values are determined by the data type 
of the tag; otherwise it is cleared (0). 
S:Z Zero (Z) 
Bit is set to a (1) if the result or value after a math, 
move or logic instruction is zero; otherwise it is cleared 
(0). 
S:N Sign (S) 
Bit is set to a (1) if the result or value after a math, 
move or logic instruction is a negative (less than zero) 
value; otherwise it is cleared (0). This bit is not to be 
confused with the sign bit (31) of a 32-bit word. 
Northampton Community College 9
Arithmetic Status Bit Example of Operation 
The status bits will 
contain the status of 
the last math 
instruction that is 
executed. Therefore, 
in the example to the 
right, that status bits 
will contain the status 
of the Square Root 
SQR instruction. 
Northampton Community College 10
Siemens Addition (ADD) Instruction 
 The ADD instructions adds the value in IN1 to the value in INB to 
the value in INn and stores the sum in the OUT tag. 
   The Enable Out (ENO) 
IN 1 IN 2 
INn OUT 
num 01  num 02 
 
sum 
num num 
01  200, 02  
650 
 al  
200  650  
850 Re 
will set to a logic 1 when 
the instruction is true 
and has not generated 
and math errors. 
Northampton Community College 11
Allen Bradley Subtract (SUB) Instruction 
 The SUB instructions subtracts the value in Source A from the 
value in Source B and stores the difference in the Destination. 
Source A - Source B Destination 
C5 : 1.ACC - C5 : 2.ACC N7 : 5 
65 - 85  
- 20 (16 - bit signed difference ) 
(LogixPro 32 - bit signed difference ) 
SourceA SourceB Dest 
Num _ of _ Batches . ACC Bad _ Batches . ACC Total _ of _ 
Batch 
Northampton Community College 12 
0 
End of batches 
sensor 
1 = End of Batches 
End_of_Batches 
<Local:3:I.Data.2> 
Subtract 
Source A Num_of_Batches.ACC 
50 
Source B Bad_Batches.ACC 
2 
Dest Total_of_Batch 
48 
SUB 
 bit dif ference 
   
  
  
50 2 48 32 
 

Siemens Subtract (SUB) Instruction 
 The SUB instructions subtracts the value in IN1 from the value in 
IN2 and stores the difference in the OUT. 
IN 1 IN 2 
OUT The Enable Out (ENO) 
numOfBatches  badBatches  
totalBatches 
  
IN IN 
1  50, 2  
2 
50  2  
48 
will set to a logic 1 when 
the instruction is true 
and has not generated 
and math errors. 
Northampton Community College 13
SLC 500 Multiply (MUL) Instruction 
The MUL instruction multiplies the value in Source A by the 
value in Source B and stores the 16-bit product in the 
Destination. 
If the values being multiplied will result in a product outside 
the range -32,768 to 32,767, use Floating Point addresses. 
Source A * Source B  
Desitination 
T4 : 3.PRE * 20  
T4 : 4.PRE 
500 * 20  
10,000 (16 -bit stored in Destination 
Northampton Community College 14
SLC 500 Divide (DIV) Instruction 
When performing integer division, the DIV instruction 
performs long division. Therefore: 
5/ 2  2 witha remainderof 1 
The instruction divides the value in Source A by the value 
in Source B and stores the results as follows: 
 The rounded 16-bit quotient is stored in the Destination. 
 When dividing 5 / 2, the destination will most likely a value of 3. 
Northampton Community College 15
SLC500 Divide (DIV) Instruction 
Source A / 
SourceB Destination 
N N N 
7 : 7 / 7 :9  
7 : 23 
 
 bit rounded quotient stored inDestination 
5/ 2 3 16 
  
Northampton Community College 16
ControlLogix Multiply (MUL) Instruction 
The MUL instruction multiplies the value in Source A by the 
value in Source B and stores product in the Destination. 
Source A * Source B Destination 
2 * Thumb_Value Actual_Value 
Northampton Community College 17 
0 
Execute the MUL 
instruction 
1 = Execute 
Multiply 
<Local:3:I.Data.12> 
Multiply 
Source A 2 
Source B Thumb_Value 
6000 
Dest Actual_Value 
12000 
MUL 
2 * 6000  
12000 
 

ControlLogix Divide (DIV) Instruction 
 The ControlLogix DIV instruction divides the value of Source A by the 
value of Source B and stores the quotient in the Dest. See the next 
slide for rounding and truncating of the Dest. 
Source A / Source B Destination 
Raw_Thumb_Value / Thumb_Value Actual_Value 
Northampton Community College 18 
0 
Execute the MUL 
instruction 
1 = Execute 
Multiply 
<Local:3:I.Data.12> 
Divide 
Source A Raw _Thumb_Value 
10 
Source B Thumb_Value 
6 
Dest Actual_Value 
1 
DIV 
10 / 6  
1 
 

Siemens Multiply (MUL) Instruction 
 The Siemens MUL instruction multiplies the value of IN1 by the value of 
IN2 by the value of INn and stores the product in the OUT. 
IN1 * IN2 OUT The Enable Out (ENO) 
2 * thumbValue actualValue 
thumbValue 6 
2*6 12 
 
 
 
will set to a logic 1 when 
the instruction is true 
and has not generated 
and math errors. 
Northampton Community College 21
Siemens Divide (DIV) Instruction 
 The Siemens DIV instruction divides the value of IN1 by the value of 
IN2 and stores the quotient in the OUT. 
IN1 / IN2 OUT 
 The Enable Out (ENO) 
rawThumbValue / thumbValue  
actualValue 
rawThumbValue 10, thumbValue 6 
10 / 6  
1 
  
will set to a logic 1 when 
the instruction is true 
and has not generated 
and math errors. 
Northampton Community College 22
ControlLogix Modulo (MOD) Instruction 
The MOD instruction divides the value stored in Source A by 
the value in Source B and places the remainder in the Dest. 
The Source A, Source B and the Dest follow the same rules 
as the ADD, SUB, MUL and DIV instructions. 
0 Modulo 
MOD 
Source A Thumb_Value 
7 
Source B 2 
Dest Actual_Value 
1 
푆표푢푟푐푒퐴 
푆표푢푟푐푒퐵 
= 퐷푒푠푡 (푟푒푚푎푖푛푑푒푟) 
푇ℎ푢푚푏_푉푎푙푢푒 
2 
= 퐴푐푡푢푎푙_푉푎푙푢푒 
푇ℎ푢푚푏_푉푎푙푢푒 = 7 
7 
2 
= 1 
Northampton Community College 23
Siemens Modulo (MOD) Instruction 
The MOD instruction divides the value stored in IN1 by the 
value in IN2 and places the remainder in the OUT. 
퐼푁1 
퐼푁2 
= 푂푈푇 
푒푣푒푛푂푟푂푑푑 
2 
= 푟푒푚푎푖푛푑푒푟 
푒푣푒푛푂푟푂푑푑 = 12 
12 
2 
= 0 
Northampton Community College 25
Allen Bradley Square Root (SQR) Instruction 
 The SQR instruction has two parameter; Source and Destination. 
 Both parameters must be word level addresses. In the SLC500 the value 
can be of type INT or FLOAT and in the ControlLogix the value can be a 
tag of type SINT, INT, DINT or REAL. 
 The SQR instruction takes the square root of the value stored in the 
Source and stores the result in the Destination. 
N7 : 3  
N10 : 4 
N7 : 3  
16 
N7 : 3  
4 (16 - bit) 
Hypotenuse  
SumOfSquares 
Hypotenuse  
16 
Hypostenuse  
4 (32- bit) 
Northampton Community College 26
Siemens Square Root (SQR) Instruction 
 The SQR instruction has two parameter; IN and OUT. 
 Both parameters must be word level addresses. 
 The SQR instruction takes the square root of the value stored in the IN 
and stores the result in the OUT. 
vesselLevel  
cylVesselLevel 
vesselLevel  
16 
vesselLevel  
4 
Northampton Community College 27
ControlLogix Clear (CLR) Instruction 
The CLR instruction has one parameter; Destination. 
In the SLC500, the Destination can be any valid word level 
address and in the ControlLogix it can be a tag of type 
SINT, INT, DINT or REAL. 
When the rung containing the CLR instruction is true, the 
value stored in the word level address referenced in the 
Destination is cleared; set to zero (0). 
Northampton Community College 28 
1 
Execute the MUL 
instruction 
1 = Execute 
Multiply 
<Local:3:I.Data.12> 
Clear 
Dest Actual_Value 
0 
CLR 
ControlLogix Example
Absolute Value (ABS) Instruction 
(Not available in LogixPro) 
 The ABS instruction has two parameters; Source and Destination. 
 In the SLC500 the Source and Destination can be any valid word level 
address. In the ControlLogix they can be a tag of type SINT, INT, DINT or 
REAL. 
 When the rung containing the ABS instruction is true, the instruction takes 
the absolute value of the value stored in the Source word and places the 
resultant value in the Destination word. 
Source  
Destination 
N10 : 68 T21: 5.PRE 
- 50  
50 
 
Source  
Destination 
ABS_Source ABS_Dest 
- 50  
50 
 
Northampton Community College 29
Siemens CLR and ABS 
Siemens does not have a Clear (CLR) instruction. 
The Siemens Absolute value instruction is not available in 
ladder logic. It is only available in structured text. 
Northampton Community College 30
ControlLogix X To Power of Y (XPY) Instruction 
(Not available in LogixPro) 
 The XPY instruction has three parameters; Source A, Source B and 
Destination. 
 The rules for the parameters are the same as for the ADD, SUB, MUL and 
DIV instructions. 
 The instruction raises the value stored in Source A to the power of the 
value stored in Source B and stores the result in the Destination. 
XPY 
1 X To Pow er Of Y 
Source X Vessel_B_Level 
2 
Source Y Thumb_Value 
6 
Dest Actual_Value 
64 
ControlLogix Example Shown 
Vessel _ B _ Level Thumb _ 
Value 
 Actual _ 
Value 6 
2  
64 
Northampton Community College 31
Siemens X To Power of Y (EXPT) Instruction 
 The XPY instruction has three parameters; IN1, IN2 and OUT. 
 The instruction raises the value stored in IN1 to the power of the value 
stored in IN2 and stores the result in OUT. 
cylVesselLevel vesselLevel thumbValue 
cylVesselLevel thumbValue 
6  
2 64 
 
  
2, 6 
Northampton Community College 32
Compute (CPT) Instruction, Allen Bradley 
(Not available in LogixPro Supplement to Textbook) 
 The Compute (CPT) instruction is an output instruction. It has two 
parameters: 
 Destination 
 Expression 
 In the SLC500 the Destination can be any valid word level address. In 
the ControlLogix it can be a tag of type SINT, INT, DINT or REAL. 
 The Expression can contain any valid expression (equation) to be 
solved. 
 In the SLC500 series the CPT instruction is only available on: 
 SLC 5/03 OS302 or higher 
 SLC 5/04 OS401 or higher 
 SLC 5/05 all operating systems 
Northampton Community College 33
Compute (CPT), CALCULATE Instruction 
Supplement to Textbook 
The Allen Bradley Compute (CPT) and the Siemens 
CALCULATE instruction can perform any or all of the 
following operations: 
 Copy 
 Arithmetic 
 Logical 
 Conversion 
The operation is defined in the Expression and the result of 
the Expression is stored in the address referenced in the 
Destination. 
Northampton Community College 34
Compute (CPT) Instruction 
Supplement to Textbook 
Instructions that can be used in the Expression 
Instruction Explanation Instruction Explanation 
+ Addition AND Bit-by-bit AND of two values 
- Subtraction TOD Convert 16-bit Integers to BCD 
* Multiplication FRD Convert BCD to 16-bit Integers 
Northampton Community College 35 
| 
Division in the SLC500 (This is the 
pipe character. It is a vertical line). 
LN Calculates Natural Log 
/ Division in the ControlLogix ABS Takes the absolute value 
SQR Square Root (SQRT, Siemens) DEG Convert radians to degrees 
- 
Negate. (Same as using the NEG 
instruction) 
RAD Convert degrees to radians 
NOT 
Bit-by-bit inversion of a binary 
value 
Trig 
Functions 
SIN, COS, ATN, ACS, ASN, TAN 
XOR 
Bit-by-bit eXclusive OR of two 
values 
LOG Calculates log base 10 
OR Bit-by-bit OR of two values ** 
Raise a number to a power 
(SQR, Siemens)
Compute (CPT) Instruction, ControlLogix 
Supplement to Textbook 
The CPT instruction can be 
conditional or unconditional. 
The Expression is an 
equation of zero or more 
lines, with up to 28 
characters per line and up 
to 255 characters. 
 2 2 
 
sideA sideB hypotenuse 
If sideA and sideB Then 
2 2 
3 4 
  
  
  
9 16 
  
25 5 
3 4 
 
hypotenuse 
hypotenuse 
ControlLogix Example Shown 
Northampton Community College 36
Compute (CPT) Instruction 
Supplement to Textbook 
The arithmetic status bits update as shown in the table: 
With this bit: The Processor: 
S:0/0 or S:C Carry (C) 
Sets based on the results of the last 
instruction executed in the expression. 
S:0/1 or S:V Overflow (V) 
Sets anytime an overflow occurs during 
the evaluation of the expression. 
S:0/2 or S:Z Zero (Z) 
Sets based on the results of the last 
instruction executed in the expression. 
S:0/3 or S:N Sigh (S) 
Sets based on the results of the last 
instruction executed in the expression. 
Northampton Community College 37
CALCULATE Instruction, Siemens 
Supplement to Textbook 
The CALCULATE 
instruction can be 
conditional or 
unconditional. 
 2 2 
 
IN 1  IN 2 
 
hypotenuse 
If sideA and sideB Then 
2 2 
3 4 
  
  
9 16 
  
25 5 
3 4 
 
hypotenuse 
hypotenuse 
Northampton Community College 38
Order of Precedence 
 When parentheses are not used to control the order in which elements 
of a mathematical equation should be executed, there is an order of 
precedence to the math operators. This order and the direction they are 
evaluated are listed below. 
Operator Symbol Direction Evaluated 
Parentheses ( ) 
In order from inner pairs to 
outer pairs 
Functions 
ABS, ACS, ASN, ATN, COS, 
DEG, FRD, LN, LOG, RAD, SIN, 
SQR, TAN, TOD, TRN 
In the order as per 
instruction 
Exponentiation ** Left to Right 
Negation - Left to Right 
Math *, |, /, MOD Left to Right 
Math +, - Left to Right 
Comparison 
LES, GRT, LEQ, GEQ, EQU, 
NEQ, LIM 
Left to Right 
Logical AND, OR, NOT, XOR Right to Left 
Northampton Community College 39
Order of Precedence 
Examples of Order of Precedence: 
Equation to Evaluate 
15 + 60 / 3 – 4 * 5 + 7 
Evaluate from left to right 
Division and multiplication have higher precedence than 
addition and subtraction 
60 / 3 = 20 
4 * 5 = 20 
15 + 20 – 20 + 7 
15 + 7 = 22 
 15 + 60 / 3 – 4 * 5 + 7 = 22 
Northampton Community College 40
Order of Precedence 
Examples of Order of Precedence: 
Equation to Evaluate 
25 * 2 + 4 / 2 * 6 – 45 + 16 / 8 
Evaluate from left to right 
Division and multiplication have higher precedence than 
addition and subtraction 
25 * 2 = 50 
4 / 2 * 6 = 2 * 6 = 12 
16 / 8 = 2 
50 + 12 – 45 + 2 
62 – 45 + 2 
17 + 2 = 19 
 25 * 2 + 4 / 2 * 6 – 45 + 16 / 8 = 19 
Northampton Community College 41

More Related Content

PPTX
00 chapter07 and_08_conversion_subroutines_force_sp13
PPTX
04 chapter03 02_numbers_systems_student_version_fa16
PPTX
Math cl ccw_siemens_rev01_fa16
PPTX
10 chapter05 counters_fa14
PPTX
03 shift registers_and_more_data_manipulation_sp15
PPTX
13 chap07 and_08_comparison_subs_force_fa14
PPTX
11 chapter06 slc_int_float_mov_mvm_fa14
PPTX
03 analog control_sp17
00 chapter07 and_08_conversion_subroutines_force_sp13
04 chapter03 02_numbers_systems_student_version_fa16
Math cl ccw_siemens_rev01_fa16
10 chapter05 counters_fa14
03 shift registers_and_more_data_manipulation_sp15
13 chap07 and_08_comparison_subs_force_fa14
11 chapter06 slc_int_float_mov_mvm_fa14
03 analog control_sp17

What's hot (20)

DOCX
Computer organization and architecture lab manual
PDF
Computer Organization And Architecture lab manual
PDF
Lecture 03 Arithmetic Group of Instructions
PDF
Lecture1 The 8085 Microprocessor
PPTX
Comparison instructions, AB, Siemens and AB CCW
PDF
Lecture 02 Data Group of Instructions
PPT
Digital Logic Rcs
DOCX
Introduction to 8085 & it's description(includes basic lab experiments)
PPT
Counters ibrahem
PPT
Logic Fe Tcom
PPT
8085 instruction-set new
PDF
Chapter 7 - Programming Techniques with Additional Instructions
PDF
Microprocessor lab manual
DOCX
8051 data type and directives
PPT
Assembly Language Programming Of 8085
PDF
Unit 5 assembly language programming
PPTX
09 chapter04 timers_fa14
PDF
Chapter 7 8051 programming in c
PDF
Bds lab 4
DOC
Ec2308 microprocessor and_microcontroller__lab1
Computer organization and architecture lab manual
Computer Organization And Architecture lab manual
Lecture 03 Arithmetic Group of Instructions
Lecture1 The 8085 Microprocessor
Comparison instructions, AB, Siemens and AB CCW
Lecture 02 Data Group of Instructions
Digital Logic Rcs
Introduction to 8085 & it's description(includes basic lab experiments)
Counters ibrahem
Logic Fe Tcom
8085 instruction-set new
Chapter 7 - Programming Techniques with Additional Instructions
Microprocessor lab manual
8051 data type and directives
Assembly Language Programming Of 8085
Unit 5 assembly language programming
09 chapter04 timers_fa14
Chapter 7 8051 programming in c
Bds lab 4
Ec2308 microprocessor and_microcontroller__lab1
Ad

Viewers also liked (19)

PDF
Slc500cap6
PPTX
Diseño de juegos
PPTX
04 scaling analog_datal_sp17
PPT
Data Manipulation and Math Instruction on RSLogix 500
PPTX
Move mask moves_rev01_fa16
PPT
Sap -mise_en_oeuvre
PDF
RSLogix 5000 Report(s)
PDF
Best Practices in PLC Programming
PDF
Examen sap master 2015
PPT
Manejo de avisos y alarmas en HMI
PDF
Cap5. circuitos neumaticos
PPTX
Programación estructurada Siemens - TIA PORTAL
PDF
Programación SIEMENS S7 200
PDF
Manual manejo TIA PORTAL SIEMENS
PDF
Step 7 avanzado
PDF
INSTALACIÓN NEUMATICA
PDF
INTRODUCCION A LA ELECTRONEUMATICA Y ELECTROHIDRAULICA - DEZA
PDF
62999778 el-grafcet-practica-y-aplicaciones
PDF
Grafcet
Slc500cap6
Diseño de juegos
04 scaling analog_datal_sp17
Data Manipulation and Math Instruction on RSLogix 500
Move mask moves_rev01_fa16
Sap -mise_en_oeuvre
RSLogix 5000 Report(s)
Best Practices in PLC Programming
Examen sap master 2015
Manejo de avisos y alarmas en HMI
Cap5. circuitos neumaticos
Programación estructurada Siemens - TIA PORTAL
Programación SIEMENS S7 200
Manual manejo TIA PORTAL SIEMENS
Step 7 avanzado
INSTALACIÓN NEUMATICA
INTRODUCCION A LA ELECTRONEUMATICA Y ELECTROHIDRAULICA - DEZA
62999778 el-grafcet-practica-y-aplicaciones
Grafcet
Ad

Similar to 12 chapter06 math_instructions_fa14 (20)

PDF
Arthimatic_logical like the subtraction and additional.pdf
PDF
Arithmetic and logic unit
PPTX
Lecture 2 coal sping12
PPTX
Datapath design
PPT
8086-instruction-set-ppt
PPTX
Arithmetic instructions
PPT
Unit 2 8086 Instruction set.ppt notes good
PPTX
07_arithmeticcircuits digital electronics.pptx
PDF
ArithmeticCircuits.Ivy Nile vs. Rhea Ripley
PPTX
Presentation 4.pptx
PPTX
Arithmetic & Logic Unit
PPT
Chapter10-ALU.ppt
PPT
Chap1.ppt
PPT
05 multiply divide
PPTX
Arithmetic and logical instructions set
PDF
COMPUTER ORGANIZATION NOTES Unit 2
PPTX
Ch 2.pptx
DOCX
Notes arithmetic instructions
PPTX
Arithmetic instrctions
PPT
Chapter10-ALU.ppt ghuytresdfghuytresdfghuytre
Arthimatic_logical like the subtraction and additional.pdf
Arithmetic and logic unit
Lecture 2 coal sping12
Datapath design
8086-instruction-set-ppt
Arithmetic instructions
Unit 2 8086 Instruction set.ppt notes good
07_arithmeticcircuits digital electronics.pptx
ArithmeticCircuits.Ivy Nile vs. Rhea Ripley
Presentation 4.pptx
Arithmetic & Logic Unit
Chapter10-ALU.ppt
Chap1.ppt
05 multiply divide
Arithmetic and logical instructions set
COMPUTER ORGANIZATION NOTES Unit 2
Ch 2.pptx
Notes arithmetic instructions
Arithmetic instrctions
Chapter10-ALU.ppt ghuytresdfghuytresdfghuytre

More from John Todora (20)

PPTX
01 control logix_arrays_sp17
PPTX
Lab02 review
PPTX
Subroutines rev01 fa16
PPTX
ControlLogix Counters FA16
PPTX
Lab02 lead in
PPTX
ControlLogix Timers FA16
PPTX
02 chapter02 fa16
PPTX
01 introduction to_plc-pac_rev01_fa16
PPTX
07 chapter07 loop_diagrams
PPTX
06 chapter06 binary_logic_systems_Rev02
PPTX
04 chapter04 specification_forms
PPTX
03 chapter03 lists_indexes_databases
PPTX
02 chapter02 p&ids_and_symbols_split_animations
PPTX
01 chapter01 process_flow_diagram
PPTX
00 introduction
PPTX
EMEC130 P&ID Symbol Primer
PPTX
02 copy file_fill_sp16
PPTX
Control Systems Basics
PPTX
01 overview of_industrial_automation_sp15
PPTX
05 analog control_sp15
01 control logix_arrays_sp17
Lab02 review
Subroutines rev01 fa16
ControlLogix Counters FA16
Lab02 lead in
ControlLogix Timers FA16
02 chapter02 fa16
01 introduction to_plc-pac_rev01_fa16
07 chapter07 loop_diagrams
06 chapter06 binary_logic_systems_Rev02
04 chapter04 specification_forms
03 chapter03 lists_indexes_databases
02 chapter02 p&ids_and_symbols_split_animations
01 chapter01 process_flow_diagram
00 introduction
EMEC130 P&ID Symbol Primer
02 copy file_fill_sp16
Control Systems Basics
01 overview of_industrial_automation_sp15
05 analog control_sp15

Recently uploaded (20)

PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PDF
HVAC Specification 2024 according to central public works department
PPTX
Core Concepts of Personalized Learning and Virtual Learning Environments
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PPTX
Virtual and Augmented Reality in Current Scenario
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PDF
English Textual Question & Ans (12th Class).pdf
PDF
semiconductor packaging in vlsi design fab
PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 1).pdf
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
Empowerment Technology for Senior High School Guide
PDF
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
PDF
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
PPTX
Education and Perspectives of Education.pptx
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
HVAC Specification 2024 according to central public works department
Core Concepts of Personalized Learning and Virtual Learning Environments
Cambridge-Practice-Tests-for-IELTS-12.docx
Virtual and Augmented Reality in Current Scenario
Uderstanding digital marketing and marketing stratergie for engaging the digi...
FORM 1 BIOLOGY MIND MAPS and their schemes
English Textual Question & Ans (12th Class).pdf
semiconductor packaging in vlsi design fab
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
Introduction to pro and eukaryotes and differences.pptx
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 1).pdf
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
B.Sc. DS Unit 2 Software Engineering.pptx
A powerpoint presentation on the Revised K-10 Science Shaping Paper
Empowerment Technology for Senior High School Guide
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
Education and Perspectives of Education.pptx

12 chapter06 math_instructions_fa14

  • 1. Arithmetic Instructions Chapter 06 and supplemental material Northampton Community College 1
  • 2. Arithmetic Instructions Mnemonic Name Mnemonic Name ADD Addition SWP Swap SUB Subtraction ASN Arc Sine MUL Multiply ACS Arc Cosine DIV Divide ATN Arc Tangent DDV Double Divide (SLC500) COS Cosine CLR Clear LN Natural Log SQR Square Root (SQRT, Siemens) LOG Log to the Base 10 SCP Scale with Parameters SIN Sine SCL Scale TAN Tangent ABS Absolute Value XPY X to the Power of Y (EXPT, Siemens) CPT Compute NEG Negate We will only be learning about the instruction shown in red Northampton Community College 2
  • 3. Allen Bradley Arithmetic Instructions  Math instructions are output instructions, therefore they are placed against the right power rail.  The ControlLogix processor allows math instructions to be placed in series on the right side of the rung. (Not in this course)  The ADD, SUB, MUL and DIV instructions have three parameters:  Source A  Source B  Destination RSLogix 500 and LogixPro ControlLogix Northampton Community College 3
  • 4. Basic Arithmetic Instructions  The ADD, SUB, MUL and DIV instructions have three parameters:  Source A  Source B  Destination  These parameters have the following rules. 1. Source A and Source B  In the SLC500 can be any valid word level address of type INT or FLOAT.  In LogixPro can be any valid word level address of type INT.  In ControlLogix a tag of type SINT, INT, DINT or REAL. 2. Source A can be a program constant and Source B  In the SLC500 can be any valid word level address of type INT or FLOAT.  In LogixPro can be any valid word level address of type INT.  In ControlLogix a tag of type SINT, INT, DINT or REAL 3. Source B can be a program constant and Source A  In the SLC500 can be any valid word level address of type INT or FLOAT.  In LogixPro can be any valid word level address of type INT.  In ControlLogix a tag of type SINT, INT, DINT or REAL. 4. Source A and Source B cannot both be program constants. 5. The Destination is always  In the SLC500 a valid word level address of type INT or FLOAT .  In LogixPro a valid word level address of type INT.  In ControlLogix a tag of type SINT, INT, DINT or REAL. Northampton Community College 4
  • 5. Siemens Arithmetic Instructions  The Siemens processor allows math instructions to be placed in series on the rung.  The ADD, SUB, MUL and DIV instructions have at least six parameters:  Instruction Data Type  Enable (EN)  Enable Out (ENO)  OUT  IN1, IN2, (INn when the yellow star is present) Northampton Community College 5
  • 6. Arithmetic Instructions Arithmetic instructions can be conditional or unconditional:  Conditional – Input logic determines when the instruction executes.  Unconditional – Instruction executes every scan. Conditional Unconditional ADD Add Source A Vessel_A_Level 0 Source B Vessel_B_Level 0 Dest Total_of_Batch 0 Northampton Community College 6
  • 7. Allen Bradley Addition (ADD) Instruction  The ADD instructions adds the value in Source A to the value in Source B and stores the sum in the Destination. Source A  SourceB  Destination N N N 7 : 0 7 : 2 7 :1  bit signed sum    200 650 850 16    LogixPro is 32  bit signed 0 Add ADD Source A Vessel_A_Level 367 Source B Vessel_B_Level 780 Dest Total_of_Batch 1147 SourceA  SourceB  Destination Vessel _ A _ Level  Vessel _ B _ Level  Total _ of _ Batch  bit signed sum 367 780 1147 32    Northampton Community College 7
  • 8. SLC500 Arithmetic Status Bits  There are four arithmetic status bits. All of the arithmetic instructions share the same four status bits.  These bits will contain the status of the last math instruction that is executed.  These bits are located in the Status File (S2) and are described as follows (Not available in the LogixPro Simulator): Status Bit Name Description S:0/0 Carry (C) Bit is set to a (1) if a carry is generated; otherwise it is cleared (0). (It is for you to determine how this bit works) S:0/1 Overflow (V) Bit is set to a (1) if the result or value of the math instruction does not fit into the designated destination. Value is smaller than -32,768 or larger than 32,767; otherwise it is cleared (0). S:0/2 Zero (Z) Bit is set to a (1) if the result or value after a math, move or logic instruction is zero; otherwise it is cleared (0). S:0/3 Sign (S) Bit is set to a (1) if the result or value after a math, move or logic instruction is a negative (less than zero) value; otherwise it is cleared (0). This bit is not to be confused with the sign bit (15) of a 16-bit word. Northampton Community College 8
  • 9. ControlLogix Arithmetic Status Bits  There are four arithmetic status bits. All of the arithmetic instructions share the same four status bits.  These bits will contain the status of the last math instruction that is executed. Status Bit Name Description S:C Carry (C) Bit is set to a (1) if a carry is generated; otherwise it is cleared (0). (It is for you to determine how this bit works) S:V Overflow (V) Bit is set to a (1) if the result or value of the math instruction does not fit into the designated destination. Min. and max. values are determined by the data type of the tag; otherwise it is cleared (0). S:Z Zero (Z) Bit is set to a (1) if the result or value after a math, move or logic instruction is zero; otherwise it is cleared (0). S:N Sign (S) Bit is set to a (1) if the result or value after a math, move or logic instruction is a negative (less than zero) value; otherwise it is cleared (0). This bit is not to be confused with the sign bit (31) of a 32-bit word. Northampton Community College 9
  • 10. Arithmetic Status Bit Example of Operation The status bits will contain the status of the last math instruction that is executed. Therefore, in the example to the right, that status bits will contain the status of the Square Root SQR instruction. Northampton Community College 10
  • 11. Siemens Addition (ADD) Instruction  The ADD instructions adds the value in IN1 to the value in INB to the value in INn and stores the sum in the OUT tag.    The Enable Out (ENO) IN 1 IN 2 INn OUT num 01  num 02  sum num num 01  200, 02  650  al  200  650  850 Re will set to a logic 1 when the instruction is true and has not generated and math errors. Northampton Community College 11
  • 12. Allen Bradley Subtract (SUB) Instruction  The SUB instructions subtracts the value in Source A from the value in Source B and stores the difference in the Destination. Source A - Source B Destination C5 : 1.ACC - C5 : 2.ACC N7 : 5 65 - 85  - 20 (16 - bit signed difference ) (LogixPro 32 - bit signed difference ) SourceA SourceB Dest Num _ of _ Batches . ACC Bad _ Batches . ACC Total _ of _ Batch Northampton Community College 12 0 End of batches sensor 1 = End of Batches End_of_Batches <Local:3:I.Data.2> Subtract Source A Num_of_Batches.ACC 50 Source B Bad_Batches.ACC 2 Dest Total_of_Batch 48 SUB  bit dif ference        50 2 48 32  
  • 13. Siemens Subtract (SUB) Instruction  The SUB instructions subtracts the value in IN1 from the value in IN2 and stores the difference in the OUT. IN 1 IN 2 OUT The Enable Out (ENO) numOfBatches  badBatches  totalBatches   IN IN 1  50, 2  2 50  2  48 will set to a logic 1 when the instruction is true and has not generated and math errors. Northampton Community College 13
  • 14. SLC 500 Multiply (MUL) Instruction The MUL instruction multiplies the value in Source A by the value in Source B and stores the 16-bit product in the Destination. If the values being multiplied will result in a product outside the range -32,768 to 32,767, use Floating Point addresses. Source A * Source B  Desitination T4 : 3.PRE * 20  T4 : 4.PRE 500 * 20  10,000 (16 -bit stored in Destination Northampton Community College 14
  • 15. SLC 500 Divide (DIV) Instruction When performing integer division, the DIV instruction performs long division. Therefore: 5/ 2  2 witha remainderof 1 The instruction divides the value in Source A by the value in Source B and stores the results as follows:  The rounded 16-bit quotient is stored in the Destination.  When dividing 5 / 2, the destination will most likely a value of 3. Northampton Community College 15
  • 16. SLC500 Divide (DIV) Instruction Source A / SourceB Destination N N N 7 : 7 / 7 :9  7 : 23   bit rounded quotient stored inDestination 5/ 2 3 16   Northampton Community College 16
  • 17. ControlLogix Multiply (MUL) Instruction The MUL instruction multiplies the value in Source A by the value in Source B and stores product in the Destination. Source A * Source B Destination 2 * Thumb_Value Actual_Value Northampton Community College 17 0 Execute the MUL instruction 1 = Execute Multiply <Local:3:I.Data.12> Multiply Source A 2 Source B Thumb_Value 6000 Dest Actual_Value 12000 MUL 2 * 6000  12000  
  • 18. ControlLogix Divide (DIV) Instruction  The ControlLogix DIV instruction divides the value of Source A by the value of Source B and stores the quotient in the Dest. See the next slide for rounding and truncating of the Dest. Source A / Source B Destination Raw_Thumb_Value / Thumb_Value Actual_Value Northampton Community College 18 0 Execute the MUL instruction 1 = Execute Multiply <Local:3:I.Data.12> Divide Source A Raw _Thumb_Value 10 Source B Thumb_Value 6 Dest Actual_Value 1 DIV 10 / 6  1  
  • 19. Siemens Multiply (MUL) Instruction  The Siemens MUL instruction multiplies the value of IN1 by the value of IN2 by the value of INn and stores the product in the OUT. IN1 * IN2 OUT The Enable Out (ENO) 2 * thumbValue actualValue thumbValue 6 2*6 12    will set to a logic 1 when the instruction is true and has not generated and math errors. Northampton Community College 21
  • 20. Siemens Divide (DIV) Instruction  The Siemens DIV instruction divides the value of IN1 by the value of IN2 and stores the quotient in the OUT. IN1 / IN2 OUT  The Enable Out (ENO) rawThumbValue / thumbValue  actualValue rawThumbValue 10, thumbValue 6 10 / 6  1   will set to a logic 1 when the instruction is true and has not generated and math errors. Northampton Community College 22
  • 21. ControlLogix Modulo (MOD) Instruction The MOD instruction divides the value stored in Source A by the value in Source B and places the remainder in the Dest. The Source A, Source B and the Dest follow the same rules as the ADD, SUB, MUL and DIV instructions. 0 Modulo MOD Source A Thumb_Value 7 Source B 2 Dest Actual_Value 1 푆표푢푟푐푒퐴 푆표푢푟푐푒퐵 = 퐷푒푠푡 (푟푒푚푎푖푛푑푒푟) 푇ℎ푢푚푏_푉푎푙푢푒 2 = 퐴푐푡푢푎푙_푉푎푙푢푒 푇ℎ푢푚푏_푉푎푙푢푒 = 7 7 2 = 1 Northampton Community College 23
  • 22. Siemens Modulo (MOD) Instruction The MOD instruction divides the value stored in IN1 by the value in IN2 and places the remainder in the OUT. 퐼푁1 퐼푁2 = 푂푈푇 푒푣푒푛푂푟푂푑푑 2 = 푟푒푚푎푖푛푑푒푟 푒푣푒푛푂푟푂푑푑 = 12 12 2 = 0 Northampton Community College 25
  • 23. Allen Bradley Square Root (SQR) Instruction  The SQR instruction has two parameter; Source and Destination.  Both parameters must be word level addresses. In the SLC500 the value can be of type INT or FLOAT and in the ControlLogix the value can be a tag of type SINT, INT, DINT or REAL.  The SQR instruction takes the square root of the value stored in the Source and stores the result in the Destination. N7 : 3  N10 : 4 N7 : 3  16 N7 : 3  4 (16 - bit) Hypotenuse  SumOfSquares Hypotenuse  16 Hypostenuse  4 (32- bit) Northampton Community College 26
  • 24. Siemens Square Root (SQR) Instruction  The SQR instruction has two parameter; IN and OUT.  Both parameters must be word level addresses.  The SQR instruction takes the square root of the value stored in the IN and stores the result in the OUT. vesselLevel  cylVesselLevel vesselLevel  16 vesselLevel  4 Northampton Community College 27
  • 25. ControlLogix Clear (CLR) Instruction The CLR instruction has one parameter; Destination. In the SLC500, the Destination can be any valid word level address and in the ControlLogix it can be a tag of type SINT, INT, DINT or REAL. When the rung containing the CLR instruction is true, the value stored in the word level address referenced in the Destination is cleared; set to zero (0). Northampton Community College 28 1 Execute the MUL instruction 1 = Execute Multiply <Local:3:I.Data.12> Clear Dest Actual_Value 0 CLR ControlLogix Example
  • 26. Absolute Value (ABS) Instruction (Not available in LogixPro)  The ABS instruction has two parameters; Source and Destination.  In the SLC500 the Source and Destination can be any valid word level address. In the ControlLogix they can be a tag of type SINT, INT, DINT or REAL.  When the rung containing the ABS instruction is true, the instruction takes the absolute value of the value stored in the Source word and places the resultant value in the Destination word. Source  Destination N10 : 68 T21: 5.PRE - 50  50  Source  Destination ABS_Source ABS_Dest - 50  50  Northampton Community College 29
  • 27. Siemens CLR and ABS Siemens does not have a Clear (CLR) instruction. The Siemens Absolute value instruction is not available in ladder logic. It is only available in structured text. Northampton Community College 30
  • 28. ControlLogix X To Power of Y (XPY) Instruction (Not available in LogixPro)  The XPY instruction has three parameters; Source A, Source B and Destination.  The rules for the parameters are the same as for the ADD, SUB, MUL and DIV instructions.  The instruction raises the value stored in Source A to the power of the value stored in Source B and stores the result in the Destination. XPY 1 X To Pow er Of Y Source X Vessel_B_Level 2 Source Y Thumb_Value 6 Dest Actual_Value 64 ControlLogix Example Shown Vessel _ B _ Level Thumb _ Value  Actual _ Value 6 2  64 Northampton Community College 31
  • 29. Siemens X To Power of Y (EXPT) Instruction  The XPY instruction has three parameters; IN1, IN2 and OUT.  The instruction raises the value stored in IN1 to the power of the value stored in IN2 and stores the result in OUT. cylVesselLevel vesselLevel thumbValue cylVesselLevel thumbValue 6  2 64    2, 6 Northampton Community College 32
  • 30. Compute (CPT) Instruction, Allen Bradley (Not available in LogixPro Supplement to Textbook)  The Compute (CPT) instruction is an output instruction. It has two parameters:  Destination  Expression  In the SLC500 the Destination can be any valid word level address. In the ControlLogix it can be a tag of type SINT, INT, DINT or REAL.  The Expression can contain any valid expression (equation) to be solved.  In the SLC500 series the CPT instruction is only available on:  SLC 5/03 OS302 or higher  SLC 5/04 OS401 or higher  SLC 5/05 all operating systems Northampton Community College 33
  • 31. Compute (CPT), CALCULATE Instruction Supplement to Textbook The Allen Bradley Compute (CPT) and the Siemens CALCULATE instruction can perform any or all of the following operations:  Copy  Arithmetic  Logical  Conversion The operation is defined in the Expression and the result of the Expression is stored in the address referenced in the Destination. Northampton Community College 34
  • 32. Compute (CPT) Instruction Supplement to Textbook Instructions that can be used in the Expression Instruction Explanation Instruction Explanation + Addition AND Bit-by-bit AND of two values - Subtraction TOD Convert 16-bit Integers to BCD * Multiplication FRD Convert BCD to 16-bit Integers Northampton Community College 35 | Division in the SLC500 (This is the pipe character. It is a vertical line). LN Calculates Natural Log / Division in the ControlLogix ABS Takes the absolute value SQR Square Root (SQRT, Siemens) DEG Convert radians to degrees - Negate. (Same as using the NEG instruction) RAD Convert degrees to radians NOT Bit-by-bit inversion of a binary value Trig Functions SIN, COS, ATN, ACS, ASN, TAN XOR Bit-by-bit eXclusive OR of two values LOG Calculates log base 10 OR Bit-by-bit OR of two values ** Raise a number to a power (SQR, Siemens)
  • 33. Compute (CPT) Instruction, ControlLogix Supplement to Textbook The CPT instruction can be conditional or unconditional. The Expression is an equation of zero or more lines, with up to 28 characters per line and up to 255 characters.  2 2  sideA sideB hypotenuse If sideA and sideB Then 2 2 3 4       9 16   25 5 3 4  hypotenuse hypotenuse ControlLogix Example Shown Northampton Community College 36
  • 34. Compute (CPT) Instruction Supplement to Textbook The arithmetic status bits update as shown in the table: With this bit: The Processor: S:0/0 or S:C Carry (C) Sets based on the results of the last instruction executed in the expression. S:0/1 or S:V Overflow (V) Sets anytime an overflow occurs during the evaluation of the expression. S:0/2 or S:Z Zero (Z) Sets based on the results of the last instruction executed in the expression. S:0/3 or S:N Sigh (S) Sets based on the results of the last instruction executed in the expression. Northampton Community College 37
  • 35. CALCULATE Instruction, Siemens Supplement to Textbook The CALCULATE instruction can be conditional or unconditional.  2 2  IN 1  IN 2  hypotenuse If sideA and sideB Then 2 2 3 4     9 16   25 5 3 4  hypotenuse hypotenuse Northampton Community College 38
  • 36. Order of Precedence  When parentheses are not used to control the order in which elements of a mathematical equation should be executed, there is an order of precedence to the math operators. This order and the direction they are evaluated are listed below. Operator Symbol Direction Evaluated Parentheses ( ) In order from inner pairs to outer pairs Functions ABS, ACS, ASN, ATN, COS, DEG, FRD, LN, LOG, RAD, SIN, SQR, TAN, TOD, TRN In the order as per instruction Exponentiation ** Left to Right Negation - Left to Right Math *, |, /, MOD Left to Right Math +, - Left to Right Comparison LES, GRT, LEQ, GEQ, EQU, NEQ, LIM Left to Right Logical AND, OR, NOT, XOR Right to Left Northampton Community College 39
  • 37. Order of Precedence Examples of Order of Precedence: Equation to Evaluate 15 + 60 / 3 – 4 * 5 + 7 Evaluate from left to right Division and multiplication have higher precedence than addition and subtraction 60 / 3 = 20 4 * 5 = 20 15 + 20 – 20 + 7 15 + 7 = 22  15 + 60 / 3 – 4 * 5 + 7 = 22 Northampton Community College 40
  • 38. Order of Precedence Examples of Order of Precedence: Equation to Evaluate 25 * 2 + 4 / 2 * 6 – 45 + 16 / 8 Evaluate from left to right Division and multiplication have higher precedence than addition and subtraction 25 * 2 = 50 4 / 2 * 6 = 2 * 6 = 12 16 / 8 = 2 50 + 12 – 45 + 2 62 – 45 + 2 17 + 2 = 19  25 * 2 + 4 / 2 * 6 – 45 + 16 / 8 = 19 Northampton Community College 41