SlideShare a Scribd company logo
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
 
Notes part5
Notes part5Notes part5
Presentation for blast algorithm bio-informatice
Presentation for blast algorithm bio-informaticePresentation for blast algorithm bio-informatice
Presentation for blast algorithm bio-informatice
zahid6
 
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
 
Cmpe 255 Short Story Assignment
Cmpe 255 Short Story AssignmentCmpe 255 Short Story Assignment
Cmpe 255 Short Story Assignment
San Jose State University
 
GRAMMAR-BASED PRE-PROCESSING FOR PPM
GRAMMAR-BASED PRE-PROCESSING FOR PPMGRAMMAR-BASED PRE-PROCESSING FOR PPM
GRAMMAR-BASED PRE-PROCESSING FOR PPM
ijcseit
 
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
Bhaskar Mitra
 
Biological sequences analysis
Biological sequences analysisBiological sequences analysis
Biological sequences analysis
Davide Andrea Guastella
 

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 walk
thelaunch
 
Lect12
Lect12Lect12
Lect14
Lect14Lect14
Lect06
Lect06Lect06
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
 
Lect09
Lect09Lect09
Lect03
Lect03Lect03
Lect02
Lect02Lect02
Lect08
Lect08Lect08
Lect13
Lect13Lect13
Lect04
Lect04Lect04
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 Lect07

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
KhalidKhan412
 
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 alignment
ammar 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 CCW
John Todora
 
24csit38.pdf
24csit38.pdf24csit38.pdf
24csit38.pdf
amine597585
 
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 code
Minhazul 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
 
Convergence Analysis
Convergence AnalysisConvergence Analysis
Convergence Analysis
Saloni Singhal
 
PCA_2022-In_and_out.pptx zxczxczxczxczxcxzczx
PCA_2022-In_and_out.pptx zxczxczxczxczxcxzczxPCA_2022-In_and_out.pptx zxczxczxczxczxcxzczx
PCA_2022-In_and_out.pptx zxczxczxczxczxcxzczx
JuanManuelNasralaAlv1
 
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 research
Dorothy 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.pptx
Khayal 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 lp
kongara
 
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
cscpconf
 
Implementing Item Response Theory
Implementing Item Response TheoryImplementing Item Response Theory
Implementing Item Response Theory
Nathan Thompson
 
ML MODULE 4.pdf
ML MODULE 4.pdfML MODULE 4.pdf
ML MODULE 4.pdf
Shiwani Gupta
 
CounterFactual Explanations.pdf
CounterFactual Explanations.pdfCounterFactual Explanations.pdf
CounterFactual Explanations.pdf
Bong-Ho Lee
 

Similar to Lect07 (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
 
PCA_2022-In_and_out.pptx zxczxczxczxczxcxzczx
PCA_2022-In_and_out.pptx zxczxczxczxczxcxzczxPCA_2022-In_and_out.pptx zxczxczxczxczxcxzczx
PCA_2022-In_and_out.pptx zxczxczxczxczxcxzczx
 
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
 

Recently uploaded

Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 

Recently uploaded (20)

Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 

Lect07

  • 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