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

The text of a manual · part 49 of 55

Hand-Held Terminal (Catalog Number 1747-PT1) User Manual: 30 - Understanding Selectable Timed Interrupts – SLC 5/02 Processor Only

Pages 421 to 430 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 421

Chapter

A–B

30

Understanding Selectable Timed Interrupts – SLC 5/02 Processor Only This chapter applies to the SLC 5/02 processor only. It covers the following topics: • STI operation • STI parameters • STD and STE instructions • STS instruction • INT instruction

STI Overview

The STI (selectable timed interrupt) function can be used with the SLC 5/02 processor only. This 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.

Basic Programming Procedure for the STI Function To use the STI function with your main program file: • Create a subroutine file (range is from 3 to 255) and enter the desired ladder rungs. This is your STI subroutine file. Creating a subroutine file is discussed in chapter 7.

• Enter the STI subroutine file number in word S:31 of the status file. (See page 30–4.) A file number of zero disables the STI function.

• Enter the setpoint (the time between successive interrupts) in word S:30 of the status file (see page 30–4). The range is 10 to 2550 milliseconds (entered in 10ms increments). A setpoint of zero disables the STI function. Important: The setpoint value must be a longer time than the execution time of the STI subroutine file, or a minor error (overrun bit S:5/10) will occur.

Operation

After you download your program and enter the Run mode, the STI begins operation as follows: • The STI timer begins timing. • At timeout, the main program scan is interrupted and the specified STI subroutine file is scanned; simultaneously, the STI timer is reset. • When the STI subroutine scan is completed, scanning of the main program file resumes at the point where it left off. • The cycle repeats. 30–1

Page 422

Chapter 30 Understanding Selectable Timed Interrupts – 5/02 Processor Only

STI Subroutine Content For identification of your STI subroutine, include an INT instruction as the first instruction. This identifies the subroutine as an interrupt subroutine versus a normal subroutine. The STI subroutine will contain the rungs of your application logic. You can program any instruction inside the STI subroutine except a TND, REF, or SVC instruction. IIM or IOM instructions are needed in an STI subroutine if your application requires immediate update of input or output points. End the STI subroutine with an RET instruction. JSR stack depth is limited to 3. That is, you may call other subroutines to a level 3 deep from an STI subroutine.

Interrupt Occurrences STI interrupts can occur at any point in your program, but not necessarily at the same point on successive interrupts. Interrupts can only occur between instructions in your program, inside the I/O scan (between slots), or between the servicing of communications packets. STI execution time adds directly to the overall scan time. STI interrupts can occur: Input Scan

Between slot updates

Program Scan

Between instruction executions

Output Scan

Between slot updates

Communication

Between communication packets

Processor Overhead

Events in the processor operating cycle

Interrupt Latency The interrupt latency (interval between the STI timeout and the start of the interrupt subroutine) is 3.7 milliseconds max. for the SLC 5/02 series B processor, and 2.4 milliseconds max. for the SLC 5/02 series C and later. During the latency period, the processor is performing operations that cannot be disturbed by the STI interrupt function.

30–2

Page 423

Chapter 30 Understanding Selectable Timed Interrupts – 5/02 Processor Only

Interrupt Priorities Interrupt priorities are as follows: 1. Fault routine 2. STI subroutine 3. I/O interrupt subroutine (ISR) An executing interrupt can only be interrupted by an interrupt having higher priority.

Status File Data Saved Data in the following words is saved on entry to the STI subroutine and re-written upon exiting the STI subroutine. • S:0 Arithmetic flags • S:13 and S:14 Math register • S:24 Index register

30–3

Page 424

Chapter 30 Understanding Selectable Timed Interrupts – 5/02 Processor Only

STI Parameters

The following parameters are associated with the STI function. These parameters have status file addresses. They are described here and also in chapter 27. Word S:31 STI file number – This can be any number from 3 to 255. A value of zero disables the STI function. An invalid number will generate fault 0023. Word S:30 Setpoint – This is the time between the starting point of successive scans of the STI file. It can be any value from 10 to 2550 milliseconds. (You enter a value of 1– 255, which results in a 10–2550 ms setpoint.) A value of zero disables the STI function. An invalid time will generate fault 0024. Bit S:2/0 Pending bit – Read only. This bit is set when the STI timer has timed out while the STI file is either being scanned or is disabled. This bit will not be set if the STI timer expires while executing the user fault routine. This bit is reset upon the start of the STI routine, execution of an STS instruction, powerup, and exit from the Run mode. Bit S:2/1 Enable bit – The default value is 1 (set). When a file number between 3 and 255 is present in word S:31 and a setpoint value between 1 and 255 is present in word S:30, a set enable bit allows scanning of the STI file. If the bit is reset by an STD instruction, scanning of the STI file no longer occurs. If the bit is set by an STE or STS instruction, scanning is again allowed. The enable bit only enables/disables the scanning of the STI subroutine. It does not affect the STI timer. The STS instruction affects both the enable bit and the STI timer. The default state is enabled. If this bit is set/reset using the STE, STD, or STS instruction, enable/disable takes effect immediately. If this bit is set or reset by the user program or communications, it will not take effect until the next end of scan. Bit S:2/2 Executing bit – Read only. This bit is set when the STI file is being scanned and cleared when the scan is completed. The bit is also cleared on powerup and entry into the Run mode. Bit S:5/10 Overrun bit – Read/write. This minor error bit is set whenever the STI timer expires while the STI routine is executing or disabled while the pending bit is set. When this occurs, the STI timer continues to operate at the rate present in word S:30. If the overrun bit becomes set, take the corrective action your application dictates, then clear the bit.

30–4

Page 425

Chapter 30 Understanding Selectable Timed Interrupts – 5/02 Processor Only

Enter and monitor STI parameters at the status file displays under EDT_DAT. Parameters are pointed out in the displays that follow.

A

Status File Arithmetic Flags S:0 Z:0 V:0 C:0 S2:0 Proc Status 0000 0000 0000 0000 S2:1 Proc Status 0000 0000 0000 0001 S2:2 Proc Status 0000 0000 0000 0010 S2:0/0 = 0 PRG ADDRESS NEXT FL PREV FL NEXT PG PREV PG F1

B C D

F3

F4

F5

Status File S2:5 Minor Fault 0000 0000 0000 0000 S2:6 Fault Code 0000H Desc: No Error S2:29 Err File: 0 Indx Cross File: No S2:24 Index Reg: 0 Single Step: No S2:5/0 = 0 PRG ADDRESS NEXT FL PREV FL NEXT PG PREV PG F1

E F G, H, I

F2

F2

F3

F4

F5

Status File Selectable Timed Interrupt S2:31 Subroutine File: 0 S2:30 Frequency [x10mS]: 0 Enabled: 1 Executing: 0 Pending: 0 S2:31 = 0 PRG ADDRESS NEXT FL PREV FL NEXT PG PREV PG F1

F2

F3

F4

F5

A – Word S:2. Bits 0, 1, and 2 are the STI pending, enabled, and executing bits respectively. These bits also appear in the “Selectable Timed Interrupt” display. See G, H, I. B – Word S:5. Bit S:5/10 is the STI overrun bit. C – Fault code. STI and other fault codes appear here. D – Fault description. A textual description of the fault code. E – Word S:31, the STI subroutine file number. F – Word S:30, the STI setpoint or frequency. G – STI enabled bit S:2/1. Also appears in the first status file display. See A. H – STI executing bit S:2/2. Also appears in the first status file display. See A. I – STI pending bit S:2/0. Also appears in the first status file display. See A.

30–5

Page 426

Chapter 30 Understanding Selectable Timed Interrupts – 5/02 Processor Only

STD and STE Instructions

The STD and STE instructions are used to create zones in which STI interrupts cannot occur. These instructions are not required to configure a basic STI interrupt application. Selectable Timed Disable Selectable Timed Enable HHT Ladder Display:

HHT Zoom Display: (monitor mode)

STD STE (STD)

Output Instruction Output Instruction

(STE)

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

Ladder Diagrams and APS Displays: STD SELECTABLE TIMED DISABLE

STE SELECTABLE TIMED ENABLE

STD Selectable Timed Disable – This instruction, when true, will reset the STI enable bit and prevent the STI subroutine from executing. When the rung goes false, the STI enable bit remains reset until a true STS or STE instruction is executed. The STI timer continues to operate while the enable bit is reset. STE Selectable Timed Enable – This instruction, upon a false-true transition of the rung, will set the STI enable bit and allow execution of the STI subroutine. When the rung goes false, the STI enable bit remains set until a true STD instruction is executed. This instruction has no effect on the operation of the STI timer or setpoint. When the enable bit is set, the first execution of the STI subroutine can occur at any fraction of the timing cycle up to a full timing cycle later.

30–6

Page 427

Chapter 30 Understanding Selectable Timed Interrupts – 5/02 Processor Only

STD/STE Zone Example In the program below, the STI function is in effect. The STD and STE instructions in rungs 6 and 12 are included in the ladder program to avoid having STI subroutine execution at any point in rungs 7 thru 11. The STD instruction (rung 6) resets the STI enable bit and the STE instruction (rung 12) sets the enable bit again. The STI timer increments and may time out in the STD zone, setting the pending bit S:2/0 and overrun bit S:5/10. The first pass bit S:1/15 and the STE instruction in rung 0 are included to insure that the STI function is initialized following a power cycle. You should include this rung any time your program contains an STD/STE zone or an STD instruction. Program File 2 0

S:1 ] [ 15

1

] [

STE SELECTABLE TIMED ENABLE

( )

] [

2 3 4 5

STD SELECTABLE TIMED DISABLE

6

STI interrupt execution will not occur between STD and STE.

7

] [

] [

( )

] [

] [

( )

8 9 10 11

STE SELECTABLE TIMED ENABLE

12 13

] [

( )

] [

14 15 16 17

END

30–7

Page 428

Chapter 30 Understanding Selectable Timed Interrupts – 5/02 Processor Only

STS Instruction

The STS instruction can be used to condition the start of the STI timer upon entering the Run mode – rather than starting automatically. It can also be used to set up or change the file number or setpoint/frequency of the STI routine that will be executed when the STI timer expires. This instruction is not required to configure a basic STI interrupt application.

Selectable Timed Start

STS

Output Instruction

HHT Ladder Display:

(STS)

HHT Zoom Display: (monitor mode)

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

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: STS SELECTABLE TIMED START File Time (x10 ms)

3 30

STS Selectable Timed Start Immediately – The STS instruction requires you to enter two parameters, the STI file number and the STI setpoint. Upon a true execution of the rung, this instruction will enter the file number and setpoint/frequency in the status file (S:31, S:30), overwriting the existing data. At the same time, the STI timer is reset and begins timing; at timeout, the STI subroutine execution occurs. When the rung goes false, the STI function remains enabled at the setpoint and file number you’ve entered in the STS instruction.

30–8

Page 429

Chapter 30 Understanding Selectable Timed Interrupts – 5/02 Processor Only

INT Instruction

The Interrupt Subroutine (INT) instruction is used in selectable timed interrupt subroutines and I/O event–driven interrupt subroutines to distinguish the subroutine as an interrupt subroutine versus a regular subroutine. Use of the instruction is optional. Interrupt Subroutine HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

INT

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

Interrupt Subroutine – This instruction has no control bits and is always evaluated as true. When used, the INT should be programmed as the first instruction of the first rung of the interrupt subroutine.

30–9

Page 430

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