Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 39 of 55

Hand-Held Terminal (Catalog Number 1747-PT1) User Manual: 25 - Control Instructions

Pages 333 to 344 of 486, from Hand-Held Terminal (Catalog Number 1747-PT1) User Manual

The original document is the PDF (1.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 1747-PT1

Page 333

Chapter

A–B

25

Control Instructions This chapter covers the following control instructions. Instructions for Use with fixed, SLC 5/01, and SLC 5/02 processors: • Jump to Label (JMP) and Label (LBL) • Jump to Subroutine (JSR) and Subroutine (SBR) • Return from Subroutine (RET) • Master Control Reset (MCR) • Temporary End (TND) • Suspend (SUS) Instructions for use with SLC 5/02 processors only: The following instructions apply to the Selectable Timed Interrupt (STI) function, discussed in chapter 30. • Selectable Timed Disable (STD) • Selectable Timed Start (STS) • Selectable Timed Enable (STE) The following instruction applies to Selectable Timed interrupts and I/O Event–Driven interrupts, discussed in chapters 30 and 31. • Interrupt Subroutine (INT)

Control Instructions Overview

The following general information applies to control instructions. Control instructions allow you to change the order that the processor scans/solves your ladder diagram rungs. Normally, the processor solves from left to right on each rung, and from top to bottom of the ladder diagram (rung 0 to the END statement). With control instructions, you can tell the processor to skip certain rungs (JMP), scan certain groups of rungs (SBR), end the scan (TND, SUS), or stop/interrupt the scan to do something else (STI interrupts, Interrupt Subroutine interrupts). Typically, control instructions are used to minimize scan time, create a more efficient program, and/or troubleshoot a problem in a program.

25–1

Page 334

Chapter 25 Control Instructions

Jump to Label (JMP)

Jump to Label

JMP

Output Instruction

HHT Ladder Display:

(JMP)

HHT Zoom Display: (online monitor mode)

ZOOM on JMP –(JMP)– NAME: JUMP TO LABEL LABEL: 1

2.3.0.0.2

EDT_DAT F1

Ladder Diagrams and APS Displays:

F2

F3

F4

F5

1 (JMP)

When the rung condition for this output instruction is true, the processor jumps forward or backward to the corresponding label instruction (LBL) and resumes program execution at the label. More than one JMP instruction can jump to the same label. The Jump (JMP) and its corresponding Label (LBL) must be in the same program file. When rungs of logic are “jumped over” or skipped, the processor does not scan/evaluate them, meaning that outputs, timers, etc. are left in their last state. The outputs are not de–energized (turned off). Important: Be careful when using the JMP instruction to move backward or loop through your program. If you loop too many times, you may cause the watchdog timer to time out and fault the processor. Use a counter, timer, or the “program scan” register (system status register, word S:3, bits 0–7) to limit the amount of time you spend looping inside of JMP/LBL instructions.

Entering Parameters Enter a decimal label number from 0 to 999. You can place up to 1000 labels in your program or subroutine file.

25–2

Page 335

Chapter 25 Control Instructions

Label (LBL)

Label

HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

LBL

Input Instruction

LBL

ZOOM on LBL –|LBL|– NAME: LABEL LABEL: 1

2.3.0.0.1

EDT_DAT F1

Ladder Diagrams and APS Displays:

F2

F3

F4

F5

1 [LBL]

This input instruction is the target of the JMP instruction having the same label number. You must program this instruction as the first instruction of a rung. The Jump (JMP) and its corresponding Label (LBL) must be in the same program file. This instruction has no control bits. It is always evaluated as true or logic 1. You can program multiple jumps to the same label by assigning the same label number to multiple JMP instructions, but assigning the same label number to two or more labels causes a compiler error. Important: 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 will always be evaluated as though the MCR zone is true, regardless of the true state of the “Start MCR” instruction.

Entering Parameters Enter a decimal label number from 0 to 999. You can place up to 1000 labels in your program or subroutine file.

25–3

Page 336

Chapter 25 Control Instructions

Jump to Subroutine (JSR)

Jump to Subroutine

JSR

Output Instruction

HHT Ladder Display:

(JSR)

HHT Zoom Display: (online monitor mode)

ZOOM on JSR –(JSR)– NAME: JUMP TO SUBROUTINE FILE: 3

2.3.0.0.2

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: JSR JUMP TO SUBROUTINE SBR file number 3

The Jump to Subroutine (JSR), Subroutine (SUB), and Return (RET) are used in conjunction, as shown on the following page. When rung conditions for a JSR instruction are true, the processor 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). When the processor does not jump to the subroutine (JSR rung false), the SBR rungs are not scanned or evaluated, meaning outputs, timers, etc. are left in their last state (if an OTE is on, it stays on). They are not de–energized. Your main program should account for this and turn off/reset/de–energize output instructions as required. You must program each subroutine in its own program file by assigning a unique file number (3–255).

Nesting Subroutine Files Nesting subroutines allow you to direct program flow from the main program to one subroutine and then on to another subroutine. The following rules apply when nesting subroutines: • With fixed and SLC 5/01 processors, you can nest subroutines up to 4 levels. • With SLC 5/02 processors, you can nest subroutines up to 8 levels. If you are using an STI subroutine, I/O event–driven interrupt subroutine, or user fault routine, you can nest subroutines up to 3 levels from each.

25–4

Page 337

Chapter 25 Control Instructions

The example below illustrates jumping to successive subroutines, then returning in reverse order. Main Program 90 JSR

Level 1 Subroutine File 90

Level 2 Subroutine File 91

Level 3 Subroutine File 92

SBR

SBR

SBR

91 JSR

92 JSR

RET

RET

RET

Example of Nesting Subroutine to Level 3

Note: Runtime errors (error codes 0025, 0026, 0027, and 0030) occur if more than the allowable levels of subroutines are called (subroutine stack overflow) or if more returns are executed than there are call levels (subroutine stack underflow). Also, do not execute a JSR to a subroutine that is already active in the subroutine stack. Update critical I/O in subroutines using immediate input (IIM) and/or immediate output (IOM) instructions, especially if your application calls for nested or relatively long subroutines. Otherwise, the processor does not update I/O until it reaches the end of the main program after executing subroutines.

Entering Parameters File – This is the SBR (subroutine) file number. Assign a decimal number from 3 to 255.

25–5

Page 338

Chapter 25 Control Instructions

Subroutine (SBR)

Subroutine HHT Ladder Display: (online monitor mode) HHT Zoom Display:

SBR

Input Instruction

SBR ZOOM on SBR –|SBR|– NAME: SUBROUTINE

2.3.0.0.1

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: SBR SUBROUTINE

This instruction serves as a label or identifier of a program file as a regular subroutine file (SBR label) versus an interrupt subroutine (INT label). The target subroutine is identified by the file number that you entered in the JSR instruction. This instruction has no control bits. It is always evaluated as true. The instruction must be programmed as the first instruction of the first rung of a subroutine.

Return from Subroutine (RET)

Return from Subroutine HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

RET

Output Instruction

(RET) ZOOM on RET –(RET)– NAME: RETURN

2.3.0.0.2

EDT_DAT F1

Ladder Diagrams and APS Displays: RET RETURN

25–6

F2

F3

F4

F5

Page 339

Chapter 25 Control Instructions

This output instruction marks the end of subroutine execution or the end of the subroutine file. It causes the processor to resume execution in the main program file at the instruction following the JSR instruction where it exited the program. If a sequence of nested subroutines is involved, the instruction causes the processor to return program execution to the previous subroutine. The rung containing the RET instruction may be conditional if this rung precedes the end of the subroutine. In this way, the processor omits the balance of a subroutine only if its rung condition is true. Without an RET instruction, the END statement (always present in the subroutine) automatically returns program execution to the JSR instruction in your calling ladder program. SLC 5/02 processors: Use the RET instruction to terminate execution of the STI subroutine (chapter 30), I/O event-driven interrupt subroutine (chapter 31), and the user fault routine (chapter 29).

Master Control Reset (MCR)

Master Control Reset HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

MCR

Output Instruction

(MCR) ZOOM on MCR –(MCR)– 2.3.0.0.2 NAME: MASTER CONTROL RESET

EDT_DAT F1

Ladder Diagrams and APS Displays:

F2

F3

F4

F5

(MCR)

The master control reset instruction is an output instruction, used in pairs. It lets the processor enable or inhibit a zone of a ladder program according to your application logic. Instruction parameters do not exist for the MCR. You start the zone with a conditioned MCR instruction. When the MCR rung is false, all non–retentive outputs in the zone are disabled. The processor scans all output instructions within the zone as if they were false. When the MCR rung is true, outputs act according to their rung logic as if the zone did not exist. You end the zone with an unconditioned MCR instruction. You cannot nest MCR zones. Important: 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 will always be evaluated as though the MCR zone is true, regardless of the true state of the “Start MCR” instruction. 25–7

Page 340

Chapter 25 Control Instructions

!

ATTENTION: If you start instructions such as timers or counters in an MCR zone, instruction operation ceases when the zone is disabled. Reprogram critical operations outside the zone if necessary. The TOF timer will activate when placed inside of a false MCR zone. The MCR instruction is not a substitute for a hard-wired master control relay. We recommend that your programmable controller system include a hard-wired master control relay and emergency stop switches to provide emergency I/O power shut down. Emergency stop switches can be monitored but should not be controlled by the ladder program. Wire these devices as described in the installation manual.

Temporary End (TND)

Temporary End HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

TND

Output Instruction

(TND) ZOOM on TND –(TND)– NAME: TEMPORARY END

2.3.0.0.2

EDT_DAT F1

Ladder Diagrams and APS Displays:

F2

F3

F4

F5

(TND)

This instruction, when its rung is true, stops the processor from scanning the rest of the program file, updates the I/O, services communications, 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. You can use this instruction to progressively debug a program, or conditionally omit the balance of your current program file or subroutines. When used in a subroutine, this instruction does not function the same as an END or RET (which causes the processor to resume operation in the previous file). The processor stops where it is, updates I/O, services communications, and goes to the beginning of the main program. 25–8

Page 341

Chapter 25 Control Instructions

Important: Use of this instruction inside a nested subroutine or interrupt subroutine terminates execution of all nested subroutines.

Suspend (SUS)

Suspend

SUS

Output Instruction

HHT Ladder Display:

(SUS)

HHT Zoom Display: (online monitor mode)

ZOOM on SUS –(SUS)– NAME: SUSPEND SUS ID: 1

2.3.0.0.2

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: SUS SUSPEND Suspend ID

1

This instruction, when the rung is true, places the controller in the Suspend Idle mode. The suspend ID is placed in word 7 (S:7) of the status file. The suspend file (program or subroutine number identifying where the executed SUS instruction resides) is placed in word 8 (S:8) of the status file. All outputs are de-energized. This instruction can be used to trap and identify specific conditions for program debugging and system troubleshooting.

Entering Parameters SUSPEND ID – an integer in the range of –32,768 to 32,767 that is entered when the instruction is programmed. When the SUS instruction is executed, the programmed ID as well as the program file ID from which the SUS instruction executed is placed in the system status file.

25–9

Page 342

Chapter 25 Control Instructions

Selectable Timed Interrupt (STI)

SLC 5/02 Processors Only Selectable Timed Disable Selectable Timed Enable Selectable Timed Start HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

STD STE STS (STD)

Output Instruction Output Instruction Output Instruction

(STE)

(STS)

ZOOM on STD –(STD)– 2.6.0.0.1 NAME: SELECTABLE TIMED DISABLE

EDT_DAT F1

F2

F3

F4

F5

ZOOM on STE –(STE)– 2.3.0.0.2 NAME: SELECTABLE TIMED ENABLE

EDT_DAT F1

F2

F3

F4

F5

ZOOM on STS –(STS)– 2.9.0.0.1 NAME: SELECTABLE TIMED START FILE: 2 2 TIME: 30 30

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: STD SELECTABLE TIMED DISABLE

STE SELECTABLE TIMED ENABLE

STS SELECTABLE TIMED START File Time (x10 ms)

2 30

The Selectable Timed Interrupt function allows you to interrupt the scan of the main program file automatically, on a periodic basis, in order to scan a specified subroutine file.

25–10

Page 343

Chapter 25 Control Instructions

Important: The information here is for reference only and is optional. Program these instructions using the information appearing in chapter 30.

Selectable Timed Interrupt Disable and Enable (STD, STE) These instructions are generally used in pairs. The purpose is to prevent the STI from occurring during a portion of the ladder program.

Selectable Timed Interrupt Start (STS) The Selectable Timed Start (STS) function is used to initiate or restart the STI function. Instruction parameters are the STI file number and the STI setpoint.

Interrupt Subroutine (INT)

SLC 5/02 Processors Only Interrupt Subroutine HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

INT

Input Instruction

INT ZOOM on INT –|INT|– NAME: I/O INTERRUPT

2.3.0.0.1

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: INT INTERRUPT SUBROUTINE

This instruction serves as a label or identifier of a program file as an interrupt subroutine (INT label) versus a regular subroutine (SBR label). It can be used to identify Selectable Timed interrupts or I/O event–driven interrupts. This instruction has no control bits and is always evaluated as true. The instruction must be programmed as the first instruction of the first rung of the subroutine. 25–11

Page 344

This page is a scan with no text; see it in the PDF.