SlideShare a Scribd company logo
1 of 12
Download to read offline
8-1
Dr. D. J. Jackson Lecture 8-1Electrical & Computer Engineering
Programmable Logic
Controllers
Data Handling and Program
Control Flow Instructions
Dr. D. J. Jackson Lecture 8-2Electrical & Computer Engineering
Move (MOV)
• This output instruction moves
the source value to the
destination location. As long as
the rung remains true, the
instruction moves the data each
scan.
• Entering Parameters
– Source is the address or
constant of the data you want to
move.
– Destination is the address
where the instruction moves the
data.
• Application Note: If you wish
to move one word of data
without affecting the math flags,
use a copy (COP) instruction
with a length of 1 word instead
of the MOV instruction.
8-2
Dr. D. J. Jackson Lecture 8-3Electrical & Computer Engineering
Using MOV for Variable Initialization
• S:1/15 is a bit in the status date file that is
energized for exactly one PLC scan when the
PLC is placed in run mode
• Can be used to condition the initialization of
variables used elsewhere in the ladder logic
Dr. D. J. Jackson Lecture 8-4Electrical & Computer Engineering
Masked Move (MVM)
• The MVM instruction is a word
instruction that moves data
from a source location to a
destination, and allows portions
of the destination data to be
masked by a separate word.
• As long as the rung remains
true, the instruction moves the
data each scan.
• Entering Parameters
– Source is the address of the
data you want to move.
– Mask is the address of the mask
through which the instruction
moves data; the mask can be a
hexadecimal value (constant).
– Destination is the address
where the instruction moves the
data.
8-3
Dr. D. J. Jackson Lecture 8-5Electrical & Computer Engineering
And (AND)
• This instruction performs a bit-by-bit
logical AND. The operation is
performed using the value at source A
and the value at source B. The result
is stored in the destination.
• Source A and B can either be a word
address or a constant; however, both
sources cannot be a constant. The
destination must be a word address.
• Application Note: When entering
constants, you can use the
ampersand (&) operator to change
the radix of your entry.
– Instead of entering –1 as a constant,
you could enter &B1111111111111111
or &HFFFF (Actual PLC only)
– Use 1111111111111111B or FFFFH for
the simulator
Dr. D. J. Jackson Lecture 8-6Electrical & Computer Engineering
Or (OR), Xor (XOR), Not (NOT)
OR, XOR, and NOT
operands
are exactly as
described for the
AND operation
8-4
Dr. D. J. Jackson Lecture 8-7Electrical & Computer Engineering
Clear (CLR) Instruction
• Use the CLR
instruction to set the
destination value of
a word to zero
• This instruction
always sets the Zero
(Z) flag (S:0/2)
• Other arithmetic
status bits are
always cleared
(reset)
– S:0/0, carry (C)
– S:0/1, overflow (V)
– S:0/3, sign (S)
Dr. D. J. Jackson Lecture 8-8Electrical & Computer Engineering
Program Flow Control Instructions
Instruction Purpose
Mnemonic Name
JMP and LBL Jump to Label and Label Jump forward or backward to
the specified label instruction
JSR, SBR, and
RET
Jump to Subroutine,
Subroutine and Return
from Subroutine
Jump to a designated
subroutine and return
MCR Master Control Reset Turn off all non-retentive
outputs in a section of ladder
program
TND Temporary End Mark a temporary end that
halts program execution
SUS Suspend Identifies specific conditions
for program debugging and
system troubleshooting
8-5
Dr. D. J. Jackson Lecture 8-9Electrical & Computer Engineering
About the Program Flow Control
Instructions
• Use these instructions to control the
sequence in which your program is executed.
• Control instructions allow you to change the
order in which the processor scans a ladder
program.
• Typically, these instructions are used to
– minimize scan time,
– create a more efficient program,
– and troubleshoot a ladder program.
Dr. D. J. Jackson Lecture 8-10Electrical & Computer Engineering
Jump (JMP) and Label (LBL)
If the rung
containing the JMP
instruction is:
Then the Program:
True Skips from the rung
with the JMP to the
rung containing the
designated LBL
False Does not execute the
JMP
• Use these
instructions in pairs
to skip portions of
the ladder program
– Jumping forward to a
label saves program
scan time by omitting
a program segment
until needed
– Jumping backward lets
the controller execute
program segments
repeatedly
8-6
Dr. D. J. Jackson Lecture 8-11Electrical & Computer Engineering
Jump (JMP) and Label (LBL)
• Labels have the format Q:NNN. NNN is a numeric
value from 000-255.
• Jumping forward to a label saves program scan time
by omitting a program segment until needed
• Jumping backward lets the controller execute
program segments repeatedly
– Be careful not to jump backwards an excessive number of
times
– The watchdog timer could time out and fault the controller
– Use a counter, timer, or the “program scan” register (system
status register, word S:3, bits 0 to 7) to limit the amount of
time you spend looping inside of JMP/LBL instructions
Dr. D. J. Jackson Lecture 8-12Electrical & Computer Engineering
JMP and LBL Example
• Selectively jump over rung 1 if I:1/0 is energized.
• In this example, O:2/1 would retain its last
evaluated state if rung 1 is skipped
• Use extreme caution in programming
8-7
Dr. D. J. Jackson Lecture 8-13Electrical & Computer Engineering
Using JMP and LBL
• Using JMP
– The JMP instruction causes the controller to skip rungs. You can
jump to the same label from one or more JMP instruction.
• Using LBL
– This input instruction is the target of JMP instructions having the
same label number.
– You must program this instruction as the first instruction of a rung.
This instruction has no control bits.
– You can program multiple jumps to the same label by assigning the
same label number to multiple JMP instructions. However, label
numbers must be unique.
• Note Do not jump (JMP) into an MCR zone. Instructions that
are programmed within the MCR zone starting at the LBL
instruction and ending at the ‘END MCR’ instruction are always
evaluated as though the MCR zone is true, regardless of the
true state of the “Start MCR” instruction.
Dr. D. J. Jackson Lecture 8-14Electrical & Computer Engineering
Jump to Subroutine (JSR),
Subroutine (SBR), and Return (RET)
• The JSR, SBR, and RET
instructions are used to
direct the controller to
execute a separate
subroutine file within
the ladder program and
return to the instruction
following the JSR
instruction.
8-8
Dr. D. J. Jackson Lecture 8-15Electrical & Computer Engineering
Subroutine Usage
• If you use the SBR instruction, the SBR instruction must be the
first instruction on the first rung in the program file that
contains the subroutine.
– Use a subroutine to store recurring sections of program logic that
must be executed from several points within your application
program
– A subroutine saves memory because you program it only once.
– Update critical I/O within subroutines using immediate input and/or
output instructions (IIM, IOM), especially if your application calls
for nested or relatively long subroutines
– Otherwise, the controller does not update I/O until it reaches the
end of the main program (after executing all subroutines)
• Outputs controlled within a subroutine remain in their
last state until the subroutine is executed again.
Dr. D. J. Jackson Lecture 8-16Electrical & Computer Engineering
JSR, SBR, and RET Usage
• Using JSR
– When the JSR instruction is executed, the controller jumps to the
subroutine instruction (SBR) at the beginning of the target
subroutine file and resumes execution at that point.
– You cannot jump into any part of a subroutine except the first
instruction in that file.
• Using SBR
– The target subroutine is identified by the file number that you
entered in the JSR instruction.
– This instruction serves as a label or identifier for a program file as a
regular subroutine file.
– The instruction must be programmed as the first instruction of the
first rung of a subroutine.
• Using RET
– This output instruction marks the end of subroutine execution or
the end of the subroutine file.
– The rung containing the RET instruction may be conditional if this
rung precedes the end of the subroutine. In this way, the controller
omits the balance of a subroutine only if its rung condition is true.
8-9
Dr. D. J. Jackson Lecture 8-17Electrical & Computer Engineering
JSR, SBR, and RET Usage
Dr. D. J. Jackson Lecture 8-18Electrical & Computer Engineering
JSR, SBR, and RET Usage
(short form)
8-10
Dr. D. J. Jackson Lecture 8-19Electrical & Computer Engineering
Master Control Reset (MCR)
If the MCR Rung
that starts the
zone is:
Then the Controller:
True Executes the rungs in the MCR
zone based on each rung’s
individual input condition (as if
the zone did not exist)
False Resets all non-retentive output
instructions in the MCR zone
regardless of each rung’s
individual input conditions
Dr. D. J. Jackson Lecture 8-20Electrical & Computer Engineering
Master Control Reset (MCR)
• MCR zones let you enable or inhibit segments of your
program, such as for recipe applications
• When you program MCR instructions, note that:
– You must end the zone with an unconditional MCR instruction.
– You cannot nest one MCR zone within another.
– Do not jump into an MCR zone. If the zone is false, jumping into it
activates the zone.
– Always place the MCR instruction as the last instruction in a rung.
• Use MCR instructions in pairs to create program
zones that turn off all the non-retentive outputs in
the zone
– Rungs within the MCR zone are still scanned, but scan time is
reduced due to the false state of non-retentive outputs
8-11
Dr. D. J. Jackson Lecture 8-21Electrical & Computer Engineering
MCR Usage
• The MCR instruction is not a substitute for a hard–wired
master control relay that provides emergency stop
capability.
– You should still install a hard–wired master control relay to provide
emergency I/O power shutdown.
• Do not jump (JMP) into an MCR zone.
– Instructions that are programmed within the MCR zone starting at
the LBL instruction and ending at the ‘END MCR’ instruction are
always evaluated as though the MCR zone is true, regardless of the
true state of the “Start MCR” instruction. If the zone is false,
jumping into it activates the zone from the LBL to the end of the
zone.
• If you start instructions such as timers or counters in an
MCR zone, instruction operation ceases when the zone is
disabled.
– Re-program critical operations outside the zone if
necessary.
• The TOF timer activates when placed inside of a false
MCR zone.
Dr. D. J. Jackson Lecture 8-22Electrical & Computer Engineering
Temporary End (TND)
• This instruction, when its rung is true:
– Stops the processor from scanning the rest of the
program file
– Updates the I/O, and
– Resumes scanning at rung 0 of the main program
(file 2)
• If this instruction’s rung is false, the
processor continues the scan until the next
TND instruction or the END statement
• Use this instruction to progressively debug a
program, or conditionally omit the balance of
your current program file or subroutines
8-12
Dr. D. J. Jackson Lecture 8-23Electrical & Computer Engineering
Suspend (SUS)
• When this instruction is
executed, it causes the
processor to enter the
Suspend Idle mode and
stores the Suspend ID
in word 7 (S:7) of the
status file.
• All outputs are de-
energized.
• Use this instruction to
trap and identify
specific conditions for
program debugging and
system troubleshooting.

More Related Content

What's hot

eTPU to GTM Migration Presentation
eTPU to GTM Migration PresentationeTPU to GTM Migration Presentation
eTPU to GTM Migration PresentationParker Mosman
 
Ladder logic fundamentals plc tutorial
Ladder logic fundamentals plc tutorialLadder logic fundamentals plc tutorial
Ladder logic fundamentals plc tutorialMavuri Malleswara Rao
 
Emulation Error Recovery
Emulation Error RecoveryEmulation Error Recovery
Emulation Error Recoverysomnathb1
 
Instruction level parallelism
Instruction level parallelismInstruction level parallelism
Instruction level parallelismdeviyasharwin
 
PLC Programming Languages
PLC Programming LanguagesPLC Programming Languages
PLC Programming LanguagesLIJU. G. CHACKO
 
[Capella Day 2019] Model execution and system simulation in Capella
[Capella Day 2019] Model execution and system simulation in Capella[Capella Day 2019] Model execution and system simulation in Capella
[Capella Day 2019] Model execution and system simulation in CapellaObeo
 
Instruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInstruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInteX Research Lab
 
PLC Internal Relays
PLC Internal RelaysPLC Internal Relays
PLC Internal RelaysAmeen San
 
Power Saving Design Techniques with Low Cost FPGAs
Power Saving Design Techniques  with Low Cost FPGAs Power Saving Design Techniques  with Low Cost FPGAs
Power Saving Design Techniques with Low Cost FPGAs Premier Farnell
 
Model Predictive Control Implementation with LabVIEW
Model Predictive Control Implementation with LabVIEWModel Predictive Control Implementation with LabVIEW
Model Predictive Control Implementation with LabVIEWyurongwang1
 
Performance Enhancement with Pipelining
Performance Enhancement with PipeliningPerformance Enhancement with Pipelining
Performance Enhancement with PipeliningAneesh Raveendran
 
Pt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-testPt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-testrajbabureliance
 
UNIT-III CASE STUDIES -FPGA & CPGA ARCHITECTURES APPLICATIONS
UNIT-III CASE STUDIES -FPGA & CPGA ARCHITECTURES APPLICATIONSUNIT-III CASE STUDIES -FPGA & CPGA ARCHITECTURES APPLICATIONS
UNIT-III CASE STUDIES -FPGA & CPGA ARCHITECTURES APPLICATIONSDr.YNM
 

What's hot (20)

eTPU to GTM Migration Presentation
eTPU to GTM Migration PresentationeTPU to GTM Migration Presentation
eTPU to GTM Migration Presentation
 
Basics of plc_programming1
Basics of plc_programming1Basics of plc_programming1
Basics of plc_programming1
 
Ladder logic fundamentals plc tutorial
Ladder logic fundamentals plc tutorialLadder logic fundamentals plc tutorial
Ladder logic fundamentals plc tutorial
 
Pipelining
PipeliningPipelining
Pipelining
 
Pipelining & All Hazards Solution
Pipelining  & All Hazards SolutionPipelining  & All Hazards Solution
Pipelining & All Hazards Solution
 
Emulation Error Recovery
Emulation Error RecoveryEmulation Error Recovery
Emulation Error Recovery
 
Instruction level parallelism
Instruction level parallelismInstruction level parallelism
Instruction level parallelism
 
PLC Programming Languages
PLC Programming LanguagesPLC Programming Languages
PLC Programming Languages
 
[Capella Day 2019] Model execution and system simulation in Capella
[Capella Day 2019] Model execution and system simulation in Capella[Capella Day 2019] Model execution and system simulation in Capella
[Capella Day 2019] Model execution and system simulation in Capella
 
Instruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInstruction pipeline: Computer Architecture
Instruction pipeline: Computer Architecture
 
PLC Internal Relays
PLC Internal RelaysPLC Internal Relays
PLC Internal Relays
 
Plc
PlcPlc
Plc
 
Power Saving Design Techniques with Low Cost FPGAs
Power Saving Design Techniques  with Low Cost FPGAs Power Saving Design Techniques  with Low Cost FPGAs
Power Saving Design Techniques with Low Cost FPGAs
 
Model Predictive Control Implementation with LabVIEW
Model Predictive Control Implementation with LabVIEWModel Predictive Control Implementation with LabVIEW
Model Predictive Control Implementation with LabVIEW
 
pipelining
pipeliningpipelining
pipelining
 
Pd flow i
Pd flow iPd flow i
Pd flow i
 
Performance Enhancement with Pipelining
Performance Enhancement with PipeliningPerformance Enhancement with Pipelining
Performance Enhancement with Pipelining
 
Pt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-testPt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-test
 
UNIT-III CASE STUDIES -FPGA & CPGA ARCHITECTURES APPLICATIONS
UNIT-III CASE STUDIES -FPGA & CPGA ARCHITECTURES APPLICATIONSUNIT-III CASE STUDIES -FPGA & CPGA ARCHITECTURES APPLICATIONS
UNIT-III CASE STUDIES -FPGA & CPGA ARCHITECTURES APPLICATIONS
 
Ladder
LadderLadder
Ladder
 

Viewers also liked (11)

Lect03
Lect03Lect03
Lect03
 
Lect05
Lect05Lect05
Lect05
 
Lect06
Lect06Lect06
Lect06
 
Lect14
Lect14Lect14
Lect14
 
Allen bradley
Allen bradleyAllen bradley
Allen bradley
 
Plc (introduction and logic)
Plc (introduction and logic)Plc (introduction and logic)
Plc (introduction and logic)
 
Introduction to plc (s7)­
Introduction to  plc (s7)­ Introduction to  plc (s7)­
Introduction to plc (s7)­
 
Plc presentation
Plc presentation Plc presentation
Plc presentation
 
PLC - Programmable Logic Controller
PLC - Programmable Logic ControllerPLC - Programmable Logic Controller
PLC - Programmable Logic Controller
 
Allen Bradley- Micrologix PLC Instructions
Allen Bradley- Micrologix PLC InstructionsAllen Bradley- Micrologix PLC Instructions
Allen Bradley- Micrologix PLC Instructions
 
ppt on PLC
ppt on PLCppt on PLC
ppt on PLC
 

Similar to Lect08

Microprocessors-based systems (under graduate course) Lecture 6 of 9
Microprocessors-based systems (under graduate course) Lecture 6 of 9 Microprocessors-based systems (under graduate course) Lecture 6 of 9
Microprocessors-based systems (under graduate course) Lecture 6 of 9 Randa Elanwar
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing ModesMayank Garg
 
Low power in vlsi with upf basics part 2
Low power in vlsi with upf basics part 2Low power in vlsi with upf basics part 2
Low power in vlsi with upf basics part 2SUNODH GARLAPATI
 
Plc documentation final
Plc documentation finalPlc documentation final
Plc documentation finalSonu Kumar
 
Control unit design
Control unit designControl unit design
Control unit designDhaval Bagal
 
8051instructionset-120412233627-phpapp01.pdf
8051instructionset-120412233627-phpapp01.pdf8051instructionset-120412233627-phpapp01.pdf
8051instructionset-120412233627-phpapp01.pdfMrRRThirrunavukkaras
 
LTE KPI Optimization - A to Z Abiola.pptx
LTE KPI Optimization - A to Z Abiola.pptxLTE KPI Optimization - A to Z Abiola.pptx
LTE KPI Optimization - A to Z Abiola.pptxssuser574918
 
Microcontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVRMicrocontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVRSANTIAGO PABLO ALBERTO
 
Computer Organization : CPU, Memory and I/O organization
Computer Organization : CPU, Memory and I/O organizationComputer Organization : CPU, Memory and I/O organization
Computer Organization : CPU, Memory and I/O organizationAmrutaMehata
 
Pipeline & Nonpipeline Processor
Pipeline & Nonpipeline ProcessorPipeline & Nonpipeline Processor
Pipeline & Nonpipeline ProcessorSmit Shah
 
program-control-instruction.pdf
program-control-instruction.pdfprogram-control-instruction.pdf
program-control-instruction.pdfBapanKar2
 
FVCAG: A framework for formal verification driven power modelling and verific...
FVCAG: A framework for formal verification driven power modelling and verific...FVCAG: A framework for formal verification driven power modelling and verific...
FVCAG: A framework for formal verification driven power modelling and verific...Arun Joseph
 

Similar to Lect08 (20)

Microprocessors-based systems (under graduate course) Lecture 6 of 9
Microprocessors-based systems (under graduate course) Lecture 6 of 9 Microprocessors-based systems (under graduate course) Lecture 6 of 9
Microprocessors-based systems (under graduate course) Lecture 6 of 9
 
Lect09
Lect09Lect09
Lect09
 
Modul PLC Programming.pdf
Modul PLC Programming.pdfModul PLC Programming.pdf
Modul PLC Programming.pdf
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing Modes
 
Low power in vlsi with upf basics part 2
Low power in vlsi with upf basics part 2Low power in vlsi with upf basics part 2
Low power in vlsi with upf basics part 2
 
Plc documentation final
Plc documentation finalPlc documentation final
Plc documentation final
 
Control unit design
Control unit designControl unit design
Control unit design
 
PLC.pdf
PLC.pdfPLC.pdf
PLC.pdf
 
8051instructionset-120412233627-phpapp01.pdf
8051instructionset-120412233627-phpapp01.pdf8051instructionset-120412233627-phpapp01.pdf
8051instructionset-120412233627-phpapp01.pdf
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollers
 
module-3.pptx
module-3.pptxmodule-3.pptx
module-3.pptx
 
LTE KPI Optimization - A to Z Abiola.pptx
LTE KPI Optimization - A to Z Abiola.pptxLTE KPI Optimization - A to Z Abiola.pptx
LTE KPI Optimization - A to Z Abiola.pptx
 
Microcontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVRMicrocontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVR
 
IS.pptx
IS.pptxIS.pptx
IS.pptx
 
mod 3-1.pptx
mod 3-1.pptxmod 3-1.pptx
mod 3-1.pptx
 
Computer Organization : CPU, Memory and I/O organization
Computer Organization : CPU, Memory and I/O organizationComputer Organization : CPU, Memory and I/O organization
Computer Organization : CPU, Memory and I/O organization
 
Pipeline & Nonpipeline Processor
Pipeline & Nonpipeline ProcessorPipeline & Nonpipeline Processor
Pipeline & Nonpipeline Processor
 
program-control-instruction.pdf
program-control-instruction.pdfprogram-control-instruction.pdf
program-control-instruction.pdf
 
FVCAG: A framework for formal verification driven power modelling and verific...
FVCAG: A framework for formal verification driven power modelling and verific...FVCAG: A framework for formal verification driven power modelling and verific...
FVCAG: A framework for formal verification driven power modelling and verific...
 
Uc 2(vii)
Uc 2(vii)Uc 2(vii)
Uc 2(vii)
 

More from Abhishek Gupta (8)

Lect13
Lect13Lect13
Lect13
 
Lect12
Lect12Lect12
Lect12
 
Lect11
Lect11Lect11
Lect11
 
Lect10
Lect10Lect10
Lect10
 
Lect07
Lect07Lect07
Lect07
 
Lect04
Lect04Lect04
Lect04
 
Lect02
Lect02Lect02
Lect02
 
Lect01
Lect01Lect01
Lect01
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
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
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
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
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 

Recently uploaded (20)

OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........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
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
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
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
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🔝
 

Lect08

  • 1. 8-1 Dr. D. J. Jackson Lecture 8-1Electrical & Computer Engineering Programmable Logic Controllers Data Handling and Program Control Flow Instructions Dr. D. J. Jackson Lecture 8-2Electrical & Computer Engineering Move (MOV) • This output instruction moves the source value to the destination location. As long as the rung remains true, the instruction moves the data each scan. • Entering Parameters – Source is the address or constant of the data you want to move. – Destination is the address where the instruction moves the data. • Application Note: If you wish to move one word of data without affecting the math flags, use a copy (COP) instruction with a length of 1 word instead of the MOV instruction.
  • 2. 8-2 Dr. D. J. Jackson Lecture 8-3Electrical & Computer Engineering Using MOV for Variable Initialization • S:1/15 is a bit in the status date file that is energized for exactly one PLC scan when the PLC is placed in run mode • Can be used to condition the initialization of variables used elsewhere in the ladder logic Dr. D. J. Jackson Lecture 8-4Electrical & Computer Engineering Masked Move (MVM) • The MVM instruction is a word instruction that moves data from a source location to a destination, and allows portions of the destination data to be masked by a separate word. • As long as the rung remains true, the instruction moves the data each scan. • Entering Parameters – Source is the address of the data you want to move. – Mask is the address of the mask through which the instruction moves data; the mask can be a hexadecimal value (constant). – Destination is the address where the instruction moves the data.
  • 3. 8-3 Dr. D. J. Jackson Lecture 8-5Electrical & Computer Engineering And (AND) • This instruction performs a bit-by-bit logical AND. The operation is performed using the value at source A and the value at source B. The result is stored in the destination. • Source A and B can either be a word address or a constant; however, both sources cannot be a constant. The destination must be a word address. • Application Note: When entering constants, you can use the ampersand (&) operator to change the radix of your entry. – Instead of entering –1 as a constant, you could enter &B1111111111111111 or &HFFFF (Actual PLC only) – Use 1111111111111111B or FFFFH for the simulator Dr. D. J. Jackson Lecture 8-6Electrical & Computer Engineering Or (OR), Xor (XOR), Not (NOT) OR, XOR, and NOT operands are exactly as described for the AND operation
  • 4. 8-4 Dr. D. J. Jackson Lecture 8-7Electrical & Computer Engineering Clear (CLR) Instruction • Use the CLR instruction to set the destination value of a word to zero • This instruction always sets the Zero (Z) flag (S:0/2) • Other arithmetic status bits are always cleared (reset) – S:0/0, carry (C) – S:0/1, overflow (V) – S:0/3, sign (S) Dr. D. J. Jackson Lecture 8-8Electrical & Computer Engineering Program Flow Control Instructions Instruction Purpose Mnemonic Name JMP and LBL Jump to Label and Label Jump forward or backward to the specified label instruction JSR, SBR, and RET Jump to Subroutine, Subroutine and Return from Subroutine Jump to a designated subroutine and return MCR Master Control Reset Turn off all non-retentive outputs in a section of ladder program TND Temporary End Mark a temporary end that halts program execution SUS Suspend Identifies specific conditions for program debugging and system troubleshooting
  • 5. 8-5 Dr. D. J. Jackson Lecture 8-9Electrical & Computer Engineering About the Program Flow Control Instructions • Use these instructions to control the sequence in which your program is executed. • Control instructions allow you to change the order in which the processor scans a ladder program. • Typically, these instructions are used to – minimize scan time, – create a more efficient program, – and troubleshoot a ladder program. Dr. D. J. Jackson Lecture 8-10Electrical & Computer Engineering Jump (JMP) and Label (LBL) If the rung containing the JMP instruction is: Then the Program: True Skips from the rung with the JMP to the rung containing the designated LBL False Does not execute the JMP • Use these instructions in pairs to skip portions of the ladder program – Jumping forward to a label saves program scan time by omitting a program segment until needed – Jumping backward lets the controller execute program segments repeatedly
  • 6. 8-6 Dr. D. J. Jackson Lecture 8-11Electrical & Computer Engineering Jump (JMP) and Label (LBL) • Labels have the format Q:NNN. NNN is a numeric value from 000-255. • Jumping forward to a label saves program scan time by omitting a program segment until needed • Jumping backward lets the controller execute program segments repeatedly – Be careful not to jump backwards an excessive number of times – The watchdog timer could time out and fault the controller – Use a counter, timer, or the “program scan” register (system status register, word S:3, bits 0 to 7) to limit the amount of time you spend looping inside of JMP/LBL instructions Dr. D. J. Jackson Lecture 8-12Electrical & Computer Engineering JMP and LBL Example • Selectively jump over rung 1 if I:1/0 is energized. • In this example, O:2/1 would retain its last evaluated state if rung 1 is skipped • Use extreme caution in programming
  • 7. 8-7 Dr. D. J. Jackson Lecture 8-13Electrical & Computer Engineering Using JMP and LBL • Using JMP – The JMP instruction causes the controller to skip rungs. You can jump to the same label from one or more JMP instruction. • Using LBL – This input instruction is the target of JMP instructions having the same label number. – You must program this instruction as the first instruction of a rung. This instruction has no control bits. – You can program multiple jumps to the same label by assigning the same label number to multiple JMP instructions. However, label numbers must be unique. • Note Do not jump (JMP) into an MCR zone. Instructions that are programmed within the MCR zone starting at the LBL instruction and ending at the ‘END MCR’ instruction are always evaluated as though the MCR zone is true, regardless of the true state of the “Start MCR” instruction. Dr. D. J. Jackson Lecture 8-14Electrical & Computer Engineering Jump to Subroutine (JSR), Subroutine (SBR), and Return (RET) • The JSR, SBR, and RET instructions are used to direct the controller to execute a separate subroutine file within the ladder program and return to the instruction following the JSR instruction.
  • 8. 8-8 Dr. D. J. Jackson Lecture 8-15Electrical & Computer Engineering Subroutine Usage • If you use the SBR instruction, the SBR instruction must be the first instruction on the first rung in the program file that contains the subroutine. – Use a subroutine to store recurring sections of program logic that must be executed from several points within your application program – A subroutine saves memory because you program it only once. – Update critical I/O within subroutines using immediate input and/or output instructions (IIM, IOM), especially if your application calls for nested or relatively long subroutines – Otherwise, the controller does not update I/O until it reaches the end of the main program (after executing all subroutines) • Outputs controlled within a subroutine remain in their last state until the subroutine is executed again. Dr. D. J. Jackson Lecture 8-16Electrical & Computer Engineering JSR, SBR, and RET Usage • Using JSR – When the JSR instruction is executed, the controller jumps to the subroutine instruction (SBR) at the beginning of the target subroutine file and resumes execution at that point. – You cannot jump into any part of a subroutine except the first instruction in that file. • Using SBR – The target subroutine is identified by the file number that you entered in the JSR instruction. – This instruction serves as a label or identifier for a program file as a regular subroutine file. – The instruction must be programmed as the first instruction of the first rung of a subroutine. • Using RET – This output instruction marks the end of subroutine execution or the end of the subroutine file. – The rung containing the RET instruction may be conditional if this rung precedes the end of the subroutine. In this way, the controller omits the balance of a subroutine only if its rung condition is true.
  • 9. 8-9 Dr. D. J. Jackson Lecture 8-17Electrical & Computer Engineering JSR, SBR, and RET Usage Dr. D. J. Jackson Lecture 8-18Electrical & Computer Engineering JSR, SBR, and RET Usage (short form)
  • 10. 8-10 Dr. D. J. Jackson Lecture 8-19Electrical & Computer Engineering Master Control Reset (MCR) If the MCR Rung that starts the zone is: Then the Controller: True Executes the rungs in the MCR zone based on each rung’s individual input condition (as if the zone did not exist) False Resets all non-retentive output instructions in the MCR zone regardless of each rung’s individual input conditions Dr. D. J. Jackson Lecture 8-20Electrical & Computer Engineering Master Control Reset (MCR) • MCR zones let you enable or inhibit segments of your program, such as for recipe applications • When you program MCR instructions, note that: – You must end the zone with an unconditional MCR instruction. – You cannot nest one MCR zone within another. – Do not jump into an MCR zone. If the zone is false, jumping into it activates the zone. – Always place the MCR instruction as the last instruction in a rung. • Use MCR instructions in pairs to create program zones that turn off all the non-retentive outputs in the zone – Rungs within the MCR zone are still scanned, but scan time is reduced due to the false state of non-retentive outputs
  • 11. 8-11 Dr. D. J. Jackson Lecture 8-21Electrical & Computer Engineering MCR Usage • The MCR instruction is not a substitute for a hard–wired master control relay that provides emergency stop capability. – You should still install a hard–wired master control relay to provide emergency I/O power shutdown. • Do not jump (JMP) into an MCR zone. – Instructions that are programmed within the MCR zone starting at the LBL instruction and ending at the ‘END MCR’ instruction are always evaluated as though the MCR zone is true, regardless of the true state of the “Start MCR” instruction. If the zone is false, jumping into it activates the zone from the LBL to the end of the zone. • If you start instructions such as timers or counters in an MCR zone, instruction operation ceases when the zone is disabled. – Re-program critical operations outside the zone if necessary. • The TOF timer activates when placed inside of a false MCR zone. Dr. D. J. Jackson Lecture 8-22Electrical & Computer Engineering Temporary End (TND) • This instruction, when its rung is true: – Stops the processor from scanning the rest of the program file – Updates the I/O, and – Resumes scanning at rung 0 of the main program (file 2) • If this instruction’s rung is false, the processor continues the scan until the next TND instruction or the END statement • Use this instruction to progressively debug a program, or conditionally omit the balance of your current program file or subroutines
  • 12. 8-12 Dr. D. J. Jackson Lecture 8-23Electrical & Computer Engineering Suspend (SUS) • When this instruction is executed, it causes the processor to enter the Suspend Idle mode and stores the Suspend ID in word 7 (S:7) of the status file. • All outputs are de- energized. • Use this instruction to trap and identify specific conditions for program debugging and system troubleshooting.