PLC Instructions: Jump To, Go To Subroutine, Label, Return, and Arithmetic Instructions, Slides of Digital Logic Design and Programming

Various plc instructions including jump to, go to subroutine, label, return, and arithmetic instructions. These instructions allow altering the order of execution of control programs and performing arithmetic operations. The document also covers the use of labels, return instructions, and arithmetic instructions in both ladder and functional block formats.

Typology: Slides

2011/2012

Uploaded on 07/20/2012

shally_866
shally_866 🇺🇸

4.5

(27)

265 documents

1 / 20

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Jump To
Ajumpto(JMP)instructionallowsthecontrolprogram
sequence to be altered if certain conditions exist.
If the rung condition is TRUE, the jump to coil reference
address tells the processor to jump forward and execute the
target rung.
The jump to address label specifies the target rung to jump to.
Using this instruction, a PLC can alter the order of execution of
the control program to execute a rung that needs immediate
attention.
This instruction may also be called a go to instruction.
Note: Care should be exercised when jumping over timers and
counters.
Jumping over timers and counters will cause the timing and
counting instructions not to be executed.
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download PLC Instructions: Jump To, Go To Subroutine, Label, Return, and Arithmetic Instructions and more Slides Digital Logic Design and Programming in PDF only on Docsity!

Jump To^ ^ A^ jump^ to^

(JMP)^ instruction

allows^ the^ control

program

sequence to be altered if certain conditions exist.  If^ the^ rung^ condition

is^ TRUE,^ the^

jump^ to^ coil^ reference address tells the processor to jump forward and execute thetarget rung.  The jump to address label specifies the target rung to jump to.  Using this instruction, a PLC can alter the order of execution ofthe control program to execute a rung that needs immediateattention.  This instruction may also be called a go to instruction.  Note: Care should be exercised when jumping over timers andcounters.  Jumping over timers and counters will cause the timing andcounting instructions not to be executed.

Figure Illustrating A Jump To Instruction

Go To Subroutine^ ^ Subroutines are generally located at the end of thecontrol program

and are^ sometimes located in an area specified by the PLC maker.  If a PLC does not have a reserved subroutine area,the user can create one by programming a dummyrung with direct control to another dummy rung atthe end of the programmed subroutines.  For proper programming documentation order, thesubroutine area should be located at the end of thecontrol program.

PLC With Assigned Subroutines AtThe End Of The Program

Label^ ^ A label (LBL) instruction identifies the ladder rung that is thetarget destination of a jump to or GOSUB instruction.^ ^ The label instruction reference number must match that of thejump to or GOSUB instruction with which it is used.^ ^ A label instruction does not contribute to logic continuity and,for all practical purposes, is always logically TRUE.^ ^ This instruction is always the first condition instruction in thereferenced rung.^ ^ A label instruction referenced by a unique address can only bedefined once in a program.

Return^ ^ A^ return^

(RET)^ instruction

terminates^

a^ ladder

subroutine and is programmed with no conditionalinputs.  When^ the^

control^ program

encounters

this

instruction, it returns to the main program, going tothe^ ladder^ rung

immediately^

following^ the^

GOSUB

instruction that initiated the subroutine.  Normal program execution continues from that point.  Each subroutine must have a return instruction.

Table Listing ArithmeticInstructions And Their Symbols

Arithmetic Instructions ^ Like other instructions, arithmetic instructions may be in either thebasic ladder format or the functional block format; however, operationin either format is essentially the same. Most arithmetic instructionsrequire^ three^

reference^ registers,

which^ define^ the

two^ operand

registers and the destination register of the operation.  Some instructions, such as multiplication and division, may use fourregisters.  Most^ arithmetic^ operations

in^ a^ PLC^ require

only^ single-precision arithmetic, meaning that the values of the operands and the result canbe held in one register each.  If operations dealing with larger numbers are required, a PLC mayoffer double-precision arithmetic instructions.  Double precision means that the system uses double the number ofregisters to hold the operands and result, because it must store largernumbers.  Example, a double-precision addition instruction would use a total ofsix registers, two for each operand and two for the result.

Arithmetic Instructions^ ^ Note: The ladder format may require other ladderdata^ transfer

instructions^

to^ obtain^ the

arithmetic

operands.  In functional block format, some manufacturers offerthe ability to “cascade” block functions.  Cascading is very useful when dealing with multiplearithmetic^ operations,

since^ one^

instruction^ will activate the next one when finished.  Other manufacturers allow arithmetic operations tobe performed in block form; that is, using blocks ofseveral^ contiguous

registers^ as^

the^ operands

and

storing the results in another block of registers.

Cascading Function Block

Addition ladder^ ^ The addition (ADD) ladder instruction adds the valuesstored in two referenced memory locations.^ ^ Different controllers access these values differently.^ ^ Some instruction sets use a get (GET) data transferinstruction to access the two operand register values,while others simply reference the two registers usingcontact symbols.^ ^ The processor stores the sum of the values in theregister referenced by the ADD coil.^ ^ If the addition operation is enabled only when certainrung conditions are TRUE, then the input conditionsshould be programmed before the addition rung.

Use Of A Get (GET) Data Transfer Instruction &Referencing The Two Registers Using Contact Symbols ^ If A closes, the contents of register X and register Y are added and stored inregister Z. ^ If A does not close, no addition is performed. ^ If contact A was omitted, the addition would be performed in every scan

Addition Functional Block

Addition Functional Block^ ^ A control line enables the operation of an addition block.^ ^ When^ the^ rung

conditions^ are^ TRUE,

the^ processor^ performs

the

addition function.  In the block shown in previous figure, register 1000 and register 1001can be preset values, storage registers, or I/O registers.  Each^ time^ an^ OFF-to-ON

transition^ enables

the^ control^ line,

the

instruction adds the values in these two registers and places the resultin register 2000.  The done, or enable, output coil indicates that the operation has beencompleted.  This output remains ON as long as the control line is TRUE.  An overflow of the addition operation energizes the overflow output ofthe block.  If the operation overflows, some PLCs will clamp, or store, the resultsat the maximum value that the register can hold.  Others will store the difference between the maximum count value andthe actual overflow value.