SlideShare a Scribd company logo
1 of 7
Download to read offline
7-1
Dr. D. J. Jackson Lecture 7-1Electrical & Computer Engineering
Programmable Logic
Controllers
Comparison and Math Operations
Dr. D. J. Jackson Lecture 7-2Electrical & Computer Engineering
Comparison Instructions
Instruction Purpose
Mnemonic Name
EQU Equal Test whether two values are equal
NEQ Not Equal Test whether one value is not equal to a second
value
LES Less Than Test whether one value is less than a second
value
LEQ Less Than
or Equal
Test whether one value is less than or equal to a
second value
GRT Greater Than Test whether one value is greater than another
GEQ Greater Than or
Equal
Test whether one value is greater
than or equal to a second value
MEQ Masked Comparison
for Equal
Test portions of two values to see whether they
are equal. Compares data through a mask
LIM Limit Test Test whether one value is within the limit range
of two other values
7-2
Dr. D. J. Jackson Lecture 7-3Electrical & Computer Engineering
About the Comparison Instructions
• Comparison instructions are used to test
pairs of values to condition the logical
continuity of a rung
– Thus, comparison instructions would seldom, if
ever, be the last instruction on a rung
• As an example, suppose a LES instruction is
presented with two values
– If the first value is less than the second, then the
comparison instruction is true
Dr. D. J. Jackson Lecture 7-4Electrical & Computer Engineering
Equal (EQU) & Not Equal (NEQ)
• Use the EQU instruction to test
whether two values are equal.
– If source A and source B are
equal, the instruction is logically
true. If these values are not
equal, the instruction is logically
false.
• Use the NEQ instruction to test
whether two values are not
equal.
– If source A and source B are not
equal, the instruction is logically
true.
• Source A must be an address.
Source B can be either a
program constant or an address.
• Values are stored in two’s
complementary form.
7-3
Dr. D. J. Jackson Lecture 7-5Electrical & Computer Engineering
Less Than (LES) & Less Than or
Equal (LEQ)
• Use the LES instruction to test
whether one value (source A) is
less than another (source B).
– If source A is less than the value
at source B, the instruction is
logically true.
• Use the LEQ instruction to test
whether one value (source A) is
less than or equal to another
(source B).
– If the value at source A is less
than or equal to the value at
source B, the instruction is
logically true.
• Source A must be an address.
Source B can be either a
program constant or an address.
• Values are stored in two’s
complementary form.
Dr. D. J. Jackson Lecture 7-6Electrical & Computer Engineering
Greater Than (GRT) & Greater Than
Or Equal (GEQ)
• Use the GRT instruction to
test whether one value
(source A) is greater than
another (source B).
– If the value at source A is
greater than the value at
source B, the instruction is
logically true.
• Use the GEQ instruction to
test whether one value
(source A) is greater than or
equal to another (source B).
– If the value at source A is
greater than or equal to the
value at source B, the
instruction is logically true.
7-4
Dr. D. J. Jackson Lecture 7-7Electrical & Computer Engineering
Masked Comparison for Equal (MEQ)
• Source is the address of the value you want to compare.
• Mask is the address of the mask through which the instruction moves
data
– The mask can be a hexadecimal value.
• Compare is an integer value or the address of the reference.
– If the 16 bits of data at the source address are equal to the 16 bits
of data at the compare address (less masked bits), the instruction
is true.
– The instruction becomes false as soon as it detects a mismatch.
• Use the MEQ instruction to
compare data at a source address
with data at a compare address.
• Use of this instruction allows
portions of the data to be masked
by a separate word.
Dr. D. J. Jackson Lecture 7-8Electrical & Computer Engineering
Limit Test (LIM)
• Use the LIM instruction to
test for values within or
outside a specified range,
depending on how you set
the limits.
• The Low Limit, Test, and
High Limit values can be
word addresses or constants,
restricted to the following
combinations:
– If the Test parameter is a
program constant, both the
Low Limit and High Limit
parameters must be word
addresses.
– If the Test parameter is a
word address, the Low Limit
and High Limit parameters
can be either a program
constant or a word address.
7-5
Dr. D. J. Jackson Lecture 7-9Electrical & Computer Engineering
True/False Status of the LIM
Instruction
• If the Low Limit has a value equal to or less than the
High Limit, the instruction is true when the Test
value is between the limits or is equal to either limit.
Example, low limit less than high limit:
Low Limit High Limit Instruction is True when
Test value is
Instruction is False
when Test value is
5 8 5 through 8 -32768 through 4 and 9
through 32767
TrueFalse False
High LimitLow Limit
-32768 +32767
Dr. D. J. Jackson Lecture 7-10Electrical & Computer Engineering
True/False Status of the LIM
Instruction (continued)
• If the Low Limit has a value greater than the High
Limit, the instruction is false when the Test value is
between the limits.
Example, high limit less than low limit:
Low Limit High Limit Instruction is True when
Test value is
Instruction is False
when Test value is
8 5 -32768 through 5 and 8
through 32767
6 through 7
FalseTrue True
Low LimitHigh Limit
-32768 +32767
7-6
Dr. D. J. Jackson Lecture 7-11Electrical & Computer Engineering
Math Instructions
• Math Instructions Overview
• Source is the address(es) of the value(s) on which the
mathematical, logical, or move operation is to be performed.
– This can be word addresses or program constants.
– An instruction that has two source operands does not accept
program constants in both operands.
• Destination is the address of the result of the operation.
Signed integers are stored in two’s complementary form and
apply to both source and destination parameters.
• Location of math instructions in ladder logic determine to
operation performed (i.e. if the operation A(B+C) is desired, the
ADD operation must appear before the MUL).
• There are notable differences between the simulator
implementation of these instructions and the actual PLC
hardware.
Dr. D. J. Jackson Lecture 7-12Electrical & Computer Engineering
Available Math Instructions
• ADD:
– Add two values Dest=(A+B)
• SUB:
– Subtract one value from another
Dest=(A-B)
• MUL:
– Multiply two values Dest=(A*B)
• DIV:
– Divide one value by another
Dest=(A/B)
• SQR:
– Take the square root of a value
• NEG:
– Negate a value (2’s complement)
• TOD:
– Convert from integer to BCD
• FRD:
– Convert from BCD to integer
• All integer operations only
• *Other operations available with the
Micrologix PLC
7-7
Dr. D. J. Jackson Lecture 7-13Electrical & Computer Engineering
Updates to Arithmetic Status Bits
• The arithmetic status bits are found in Word 0, bits
0–3 in the controller status file.
• After an instruction is executed, the arithmetic status
bits in the status file are updated:
With this bit: The Controller:
S:0/0 Carry (C) sets if carry is generated; otherwise cleared
S:0/1 Overflow (V) indicates that the actual result of a math
instruction does not fit in the designated
destination
S:0/2 Zero (Z) indicates a 0 value after a math, move, or logic
instruction
S:0/3 Sign (S) indicates a negative (less than 0) value after a
math, move, or logic instruction

More Related Content

What's hot

Dot matrix Analysis Tools (Bioinformatics)
Dot matrix Analysis Tools (Bioinformatics)Dot matrix Analysis Tools (Bioinformatics)
Dot matrix Analysis Tools (Bioinformatics)Safa Khalid
 
Basic Local Alignment Search Tool (BLAST)
Basic Local Alignment Search Tool (BLAST)Basic Local Alignment Search Tool (BLAST)
Basic Local Alignment Search Tool (BLAST)Asiri Wijesinghe
 
Presentation for blast algorithm bio-informatice
Presentation for blast algorithm bio-informaticePresentation for blast algorithm bio-informatice
Presentation for blast algorithm bio-informaticezahid6
 
ACL-WMT2013.A Description of Tunable Machine Translation Evaluation Systems i...
ACL-WMT2013.A Description of Tunable Machine Translation Evaluation Systems i...ACL-WMT2013.A Description of Tunable Machine Translation Evaluation Systems i...
ACL-WMT2013.A Description of Tunable Machine Translation Evaluation Systems i...Lifeng (Aaron) Han
 
6. Integrity and Security in DBMS
6. Integrity and Security in DBMS6. Integrity and Security in DBMS
6. Integrity and Security in DBMSkoolkampus
 
GRAMMAR-BASED PRE-PROCESSING FOR PPM
GRAMMAR-BASED PRE-PROCESSING FOR PPMGRAMMAR-BASED PRE-PROCESSING FOR PPM
GRAMMAR-BASED PRE-PROCESSING FOR PPMijcseit
 
Adversarial and reinforcement learning-based approaches to information retrieval
Adversarial and reinforcement learning-based approaches to information retrievalAdversarial and reinforcement learning-based approaches to information retrieval
Adversarial and reinforcement learning-based approaches to information retrievalBhaskar Mitra
 

What's hot (10)

Dot matrix Analysis Tools (Bioinformatics)
Dot matrix Analysis Tools (Bioinformatics)Dot matrix Analysis Tools (Bioinformatics)
Dot matrix Analysis Tools (Bioinformatics)
 
Basic Local Alignment Search Tool (BLAST)
Basic Local Alignment Search Tool (BLAST)Basic Local Alignment Search Tool (BLAST)
Basic Local Alignment Search Tool (BLAST)
 
Notes part5
Notes part5Notes part5
Notes part5
 
Presentation for blast algorithm bio-informatice
Presentation for blast algorithm bio-informaticePresentation for blast algorithm bio-informatice
Presentation for blast algorithm bio-informatice
 
ACL-WMT2013.A Description of Tunable Machine Translation Evaluation Systems i...
ACL-WMT2013.A Description of Tunable Machine Translation Evaluation Systems i...ACL-WMT2013.A Description of Tunable Machine Translation Evaluation Systems i...
ACL-WMT2013.A Description of Tunable Machine Translation Evaluation Systems i...
 
6. Integrity and Security in DBMS
6. Integrity and Security in DBMS6. Integrity and Security in DBMS
6. Integrity and Security in DBMS
 
Cmpe 255 Short Story Assignment
Cmpe 255 Short Story AssignmentCmpe 255 Short Story Assignment
Cmpe 255 Short Story Assignment
 
GRAMMAR-BASED PRE-PROCESSING FOR PPM
GRAMMAR-BASED PRE-PROCESSING FOR PPMGRAMMAR-BASED PRE-PROCESSING FOR PPM
GRAMMAR-BASED PRE-PROCESSING FOR PPM
 
Adversarial and reinforcement learning-based approaches to information retrieval
Adversarial and reinforcement learning-based approaches to information retrievalAdversarial and reinforcement learning-based approaches to information retrieval
Adversarial and reinforcement learning-based approaches to information retrieval
 
Biological sequences analysis
Biological sequences analysisBiological sequences analysis
Biological sequences analysis
 

Viewers also liked

The effects of reading method on the comprehension performance of Saudi EFL s...
The effects of reading method on the comprehension performance of Saudi EFL s...The effects of reading method on the comprehension performance of Saudi EFL s...
The effects of reading method on the comprehension performance of Saudi EFL s...Buabuanana
 
Runwal codename walk
Runwal codename walkRunwal codename walk
Runwal codename walkthelaunch
 
The effects of reading method on the comprehension performance of saudi efl s...
The effects of reading method on the comprehension performance of saudi efl s...The effects of reading method on the comprehension performance of saudi efl s...
The effects of reading method on the comprehension performance of saudi efl s...Buabuanana
 
The effects of reading method on the comprehension performance of saudi efl s...
The effects of reading method on the comprehension performance of saudi efl s...The effects of reading method on the comprehension performance of saudi efl s...
The effects of reading method on the comprehension performance of saudi efl s...Buabuanana
 

Viewers also liked (13)

The effects of reading method on the comprehension performance of Saudi EFL s...
The effects of reading method on the comprehension performance of Saudi EFL s...The effects of reading method on the comprehension performance of Saudi EFL s...
The effects of reading method on the comprehension performance of Saudi EFL s...
 
Runwal codename walk
Runwal codename walkRunwal codename walk
Runwal codename walk
 
Lect12
Lect12Lect12
Lect12
 
Lect14
Lect14Lect14
Lect14
 
Lect06
Lect06Lect06
Lect06
 
The effects of reading method on the comprehension performance of saudi efl s...
The effects of reading method on the comprehension performance of saudi efl s...The effects of reading method on the comprehension performance of saudi efl s...
The effects of reading method on the comprehension performance of saudi efl s...
 
Lect09
Lect09Lect09
Lect09
 
Lect03
Lect03Lect03
Lect03
 
Lect02
Lect02Lect02
Lect02
 
Lect08
Lect08Lect08
Lect08
 
Lect13
Lect13Lect13
Lect13
 
Lect04
Lect04Lect04
Lect04
 
The effects of reading method on the comprehension performance of saudi efl s...
The effects of reading method on the comprehension performance of saudi efl s...The effects of reading method on the comprehension performance of saudi efl s...
The effects of reading method on the comprehension performance of saudi efl s...
 

Similar to PLC Comparison and Math Operations Guide

Using an SQL coverage measurement for testing database application
Using an SQL coverage measurement for testing database applicationUsing an SQL coverage measurement for testing database application
Using an SQL coverage measurement for testing database applicationKhalidKhan412
 
Additional Descriptive Statistics methods for Data Analysis / Maxim Neronov (...
Additional Descriptive Statistics methods for Data Analysis / Maxim Neronov (...Additional Descriptive Statistics methods for Data Analysis / Maxim Neronov (...
Additional Descriptive Statistics methods for Data Analysis / Maxim Neronov (...DevGAMM Conference
 
sequence alignment
sequence alignmentsequence alignment
sequence alignmentammar kareem
 
Comparison instructions, AB, Siemens and AB CCW
Comparison instructions, AB, Siemens and AB CCWComparison instructions, AB, Siemens and AB CCW
Comparison instructions, AB, Siemens and AB CCWJohn Todora
 
13 chap07 and_08_comparison_subs_force_fa14
13 chap07 and_08_comparison_subs_force_fa1413 chap07 and_08_comparison_subs_force_fa14
13 chap07 and_08_comparison_subs_force_fa14John Todora
 
SPoC: search-based pseudocode to code
SPoC: search-based pseudocode to codeSPoC: search-based pseudocode to code
SPoC: search-based pseudocode to codeMinhazul Arefin
 
Guide for building GLMS
Guide for building GLMSGuide for building GLMS
Guide for building GLMSAli T. Lotia
 
QUANTIFYING THE THEORY VS. PROGRAMMING DISPARITY USING SPECTRAL BIPARTIVITY A...
QUANTIFYING THE THEORY VS. PROGRAMMING DISPARITY USING SPECTRAL BIPARTIVITY A...QUANTIFYING THE THEORY VS. PROGRAMMING DISPARITY USING SPECTRAL BIPARTIVITY A...
QUANTIFYING THE THEORY VS. PROGRAMMING DISPARITY USING SPECTRAL BIPARTIVITY A...ijcsit
 
Quantifying the Theory Vs. Programming Disparity using Spectral Bipartivity A...
Quantifying the Theory Vs. Programming Disparity using Spectral Bipartivity A...Quantifying the Theory Vs. Programming Disparity using Spectral Bipartivity A...
Quantifying the Theory Vs. Programming Disparity using Spectral Bipartivity A...AIRCC Publishing Corporation
 
Bioinformatica 10-11-2011-t5-database searching
Bioinformatica 10-11-2011-t5-database searchingBioinformatica 10-11-2011-t5-database searching
Bioinformatica 10-11-2011-t5-database searchingProf. Wim Van Criekinge
 
Introduction to simulating data to improve your research
Introduction to simulating data to improve your researchIntroduction to simulating data to improve your research
Introduction to simulating data to improve your researchDorothy Bishop
 
Equivalence-Partition-Testing-Notes-17122022-083818pm.pptx
Equivalence-Partition-Testing-Notes-17122022-083818pm.pptxEquivalence-Partition-Testing-Notes-17122022-083818pm.pptx
Equivalence-Partition-Testing-Notes-17122022-083818pm.pptxKhayal Abbas Akhtar
 
Lecture 4 duality and sensitivity in lp
Lecture 4 duality and sensitivity in lpLecture 4 duality and sensitivity in lp
Lecture 4 duality and sensitivity in lpkongara
 
BACKPROPAGATION LEARNING ALGORITHM BASED ON LEVENBERG MARQUARDT ALGORITHM
BACKPROPAGATION LEARNING ALGORITHM BASED ON LEVENBERG MARQUARDT ALGORITHMBACKPROPAGATION LEARNING ALGORITHM BASED ON LEVENBERG MARQUARDT ALGORITHM
BACKPROPAGATION LEARNING ALGORITHM BASED ON LEVENBERG MARQUARDT ALGORITHMcscpconf
 
Implementing Item Response Theory
Implementing Item Response TheoryImplementing Item Response Theory
Implementing Item Response TheoryNathan Thompson
 
CounterFactual Explanations.pdf
CounterFactual Explanations.pdfCounterFactual Explanations.pdf
CounterFactual Explanations.pdfBong-Ho Lee
 
Machine Learning.pdf
Machine Learning.pdfMachine Learning.pdf
Machine Learning.pdfBeyaNasr1
 

Similar to PLC Comparison and Math Operations Guide (20)

Using an SQL coverage measurement for testing database application
Using an SQL coverage measurement for testing database applicationUsing an SQL coverage measurement for testing database application
Using an SQL coverage measurement for testing database application
 
Additional Descriptive Statistics methods for Data Analysis / Maxim Neronov (...
Additional Descriptive Statistics methods for Data Analysis / Maxim Neronov (...Additional Descriptive Statistics methods for Data Analysis / Maxim Neronov (...
Additional Descriptive Statistics methods for Data Analysis / Maxim Neronov (...
 
sequence alignment
sequence alignmentsequence alignment
sequence alignment
 
Comparison instructions, AB, Siemens and AB CCW
Comparison instructions, AB, Siemens and AB CCWComparison instructions, AB, Siemens and AB CCW
Comparison instructions, AB, Siemens and AB CCW
 
24csit38.pdf
24csit38.pdf24csit38.pdf
24csit38.pdf
 
13 chap07 and_08_comparison_subs_force_fa14
13 chap07 and_08_comparison_subs_force_fa1413 chap07 and_08_comparison_subs_force_fa14
13 chap07 and_08_comparison_subs_force_fa14
 
SPoC: search-based pseudocode to code
SPoC: search-based pseudocode to codeSPoC: search-based pseudocode to code
SPoC: search-based pseudocode to code
 
Guide for building GLMS
Guide for building GLMSGuide for building GLMS
Guide for building GLMS
 
QUANTIFYING THE THEORY VS. PROGRAMMING DISPARITY USING SPECTRAL BIPARTIVITY A...
QUANTIFYING THE THEORY VS. PROGRAMMING DISPARITY USING SPECTRAL BIPARTIVITY A...QUANTIFYING THE THEORY VS. PROGRAMMING DISPARITY USING SPECTRAL BIPARTIVITY A...
QUANTIFYING THE THEORY VS. PROGRAMMING DISPARITY USING SPECTRAL BIPARTIVITY A...
 
Quantifying the Theory Vs. Programming Disparity using Spectral Bipartivity A...
Quantifying the Theory Vs. Programming Disparity using Spectral Bipartivity A...Quantifying the Theory Vs. Programming Disparity using Spectral Bipartivity A...
Quantifying the Theory Vs. Programming Disparity using Spectral Bipartivity A...
 
Convergence Analysis
Convergence AnalysisConvergence Analysis
Convergence Analysis
 
Bioinformatica 10-11-2011-t5-database searching
Bioinformatica 10-11-2011-t5-database searchingBioinformatica 10-11-2011-t5-database searching
Bioinformatica 10-11-2011-t5-database searching
 
Introduction to simulating data to improve your research
Introduction to simulating data to improve your researchIntroduction to simulating data to improve your research
Introduction to simulating data to improve your research
 
Equivalence-Partition-Testing-Notes-17122022-083818pm.pptx
Equivalence-Partition-Testing-Notes-17122022-083818pm.pptxEquivalence-Partition-Testing-Notes-17122022-083818pm.pptx
Equivalence-Partition-Testing-Notes-17122022-083818pm.pptx
 
Lecture 4 duality and sensitivity in lp
Lecture 4 duality and sensitivity in lpLecture 4 duality and sensitivity in lp
Lecture 4 duality and sensitivity in lp
 
BACKPROPAGATION LEARNING ALGORITHM BASED ON LEVENBERG MARQUARDT ALGORITHM
BACKPROPAGATION LEARNING ALGORITHM BASED ON LEVENBERG MARQUARDT ALGORITHMBACKPROPAGATION LEARNING ALGORITHM BASED ON LEVENBERG MARQUARDT ALGORITHM
BACKPROPAGATION LEARNING ALGORITHM BASED ON LEVENBERG MARQUARDT ALGORITHM
 
Implementing Item Response Theory
Implementing Item Response TheoryImplementing Item Response Theory
Implementing Item Response Theory
 
ML MODULE 4.pdf
ML MODULE 4.pdfML MODULE 4.pdf
ML MODULE 4.pdf
 
CounterFactual Explanations.pdf
CounterFactual Explanations.pdfCounterFactual Explanations.pdf
CounterFactual Explanations.pdf
 
Machine Learning.pdf
Machine Learning.pdfMachine Learning.pdf
Machine Learning.pdf
 

Recently uploaded

Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 

Recently uploaded (20)

Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 

PLC Comparison and Math Operations Guide

  • 1. 7-1 Dr. D. J. Jackson Lecture 7-1Electrical & Computer Engineering Programmable Logic Controllers Comparison and Math Operations Dr. D. J. Jackson Lecture 7-2Electrical & Computer Engineering Comparison Instructions Instruction Purpose Mnemonic Name EQU Equal Test whether two values are equal NEQ Not Equal Test whether one value is not equal to a second value LES Less Than Test whether one value is less than a second value LEQ Less Than or Equal Test whether one value is less than or equal to a second value GRT Greater Than Test whether one value is greater than another GEQ Greater Than or Equal Test whether one value is greater than or equal to a second value MEQ Masked Comparison for Equal Test portions of two values to see whether they are equal. Compares data through a mask LIM Limit Test Test whether one value is within the limit range of two other values
  • 2. 7-2 Dr. D. J. Jackson Lecture 7-3Electrical & Computer Engineering About the Comparison Instructions • Comparison instructions are used to test pairs of values to condition the logical continuity of a rung – Thus, comparison instructions would seldom, if ever, be the last instruction on a rung • As an example, suppose a LES instruction is presented with two values – If the first value is less than the second, then the comparison instruction is true Dr. D. J. Jackson Lecture 7-4Electrical & Computer Engineering Equal (EQU) & Not Equal (NEQ) • Use the EQU instruction to test whether two values are equal. – If source A and source B are equal, the instruction is logically true. If these values are not equal, the instruction is logically false. • Use the NEQ instruction to test whether two values are not equal. – If source A and source B are not equal, the instruction is logically true. • Source A must be an address. Source B can be either a program constant or an address. • Values are stored in two’s complementary form.
  • 3. 7-3 Dr. D. J. Jackson Lecture 7-5Electrical & Computer Engineering Less Than (LES) & Less Than or Equal (LEQ) • Use the LES instruction to test whether one value (source A) is less than another (source B). – If source A is less than the value at source B, the instruction is logically true. • Use the LEQ instruction to test whether one value (source A) is less than or equal to another (source B). – If the value at source A is less than or equal to the value at source B, the instruction is logically true. • Source A must be an address. Source B can be either a program constant or an address. • Values are stored in two’s complementary form. Dr. D. J. Jackson Lecture 7-6Electrical & Computer Engineering Greater Than (GRT) & Greater Than Or Equal (GEQ) • Use the GRT instruction to test whether one value (source A) is greater than another (source B). – If the value at source A is greater than the value at source B, the instruction is logically true. • Use the GEQ instruction to test whether one value (source A) is greater than or equal to another (source B). – If the value at source A is greater than or equal to the value at source B, the instruction is logically true.
  • 4. 7-4 Dr. D. J. Jackson Lecture 7-7Electrical & Computer Engineering Masked Comparison for Equal (MEQ) • Source is the address of the value you want to compare. • Mask is the address of the mask through which the instruction moves data – The mask can be a hexadecimal value. • Compare is an integer value or the address of the reference. – If the 16 bits of data at the source address are equal to the 16 bits of data at the compare address (less masked bits), the instruction is true. – The instruction becomes false as soon as it detects a mismatch. • Use the MEQ instruction to compare data at a source address with data at a compare address. • Use of this instruction allows portions of the data to be masked by a separate word. Dr. D. J. Jackson Lecture 7-8Electrical & Computer Engineering Limit Test (LIM) • Use the LIM instruction to test for values within or outside a specified range, depending on how you set the limits. • The Low Limit, Test, and High Limit values can be word addresses or constants, restricted to the following combinations: – If the Test parameter is a program constant, both the Low Limit and High Limit parameters must be word addresses. – If the Test parameter is a word address, the Low Limit and High Limit parameters can be either a program constant or a word address.
  • 5. 7-5 Dr. D. J. Jackson Lecture 7-9Electrical & Computer Engineering True/False Status of the LIM Instruction • If the Low Limit has a value equal to or less than the High Limit, the instruction is true when the Test value is between the limits or is equal to either limit. Example, low limit less than high limit: Low Limit High Limit Instruction is True when Test value is Instruction is False when Test value is 5 8 5 through 8 -32768 through 4 and 9 through 32767 TrueFalse False High LimitLow Limit -32768 +32767 Dr. D. J. Jackson Lecture 7-10Electrical & Computer Engineering True/False Status of the LIM Instruction (continued) • If the Low Limit has a value greater than the High Limit, the instruction is false when the Test value is between the limits. Example, high limit less than low limit: Low Limit High Limit Instruction is True when Test value is Instruction is False when Test value is 8 5 -32768 through 5 and 8 through 32767 6 through 7 FalseTrue True Low LimitHigh Limit -32768 +32767
  • 6. 7-6 Dr. D. J. Jackson Lecture 7-11Electrical & Computer Engineering Math Instructions • Math Instructions Overview • Source is the address(es) of the value(s) on which the mathematical, logical, or move operation is to be performed. – This can be word addresses or program constants. – An instruction that has two source operands does not accept program constants in both operands. • Destination is the address of the result of the operation. Signed integers are stored in two’s complementary form and apply to both source and destination parameters. • Location of math instructions in ladder logic determine to operation performed (i.e. if the operation A(B+C) is desired, the ADD operation must appear before the MUL). • There are notable differences between the simulator implementation of these instructions and the actual PLC hardware. Dr. D. J. Jackson Lecture 7-12Electrical & Computer Engineering Available Math Instructions • ADD: – Add two values Dest=(A+B) • SUB: – Subtract one value from another Dest=(A-B) • MUL: – Multiply two values Dest=(A*B) • DIV: – Divide one value by another Dest=(A/B) • SQR: – Take the square root of a value • NEG: – Negate a value (2’s complement) • TOD: – Convert from integer to BCD • FRD: – Convert from BCD to integer • All integer operations only • *Other operations available with the Micrologix PLC
  • 7. 7-7 Dr. D. J. Jackson Lecture 7-13Electrical & Computer Engineering Updates to Arithmetic Status Bits • The arithmetic status bits are found in Word 0, bits 0–3 in the controller status file. • After an instruction is executed, the arithmetic status bits in the status file are updated: With this bit: The Controller: S:0/0 Carry (C) sets if carry is generated; otherwise cleared S:0/1 Overflow (V) indicates that the actual result of a math instruction does not fit in the designated destination S:0/2 Zero (Z) indicates a 0 value after a math, move, or logic instruction S:0/3 Sign (S) indicates a negative (less than 0) value after a math, move, or logic instruction