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

The text of a manual · part 50 of 55

Hand-Held Terminal (Catalog Number 1747-PT1) User Manual: 31 - Understanding I/O Interrupts – SLC 5/02 Processor Only

Pages 431 to 440 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 431

Chapter

A–B

31

Understanding I/O Interrupts – SLC 5/02 Processor Only This chapter applies to the SLC 5/02 processor only. It covers the following topics: • I/O interrupt operation • I/O interrupt parameters • IID and IIE instructions • RPI instruction • INT instruction

I/O Overview

The I/O event-driven interrupt function can be used with the SLC 5/02 processor only. This function allows a specialty I/O module to interrupt the normal processor operating cycle in order to scan a specified subroutine file. Interrupt operation for a specific module is described in the user’s manual for the module. I/O event-driven interrupts cannot be accomplished using standard discrete I/O modules.

Basic Programming Procedure for the I/O Interrupt Function • Specialty I/O modules which create interrupts should be configured in the lowest numbered I/O slots. When you are configuring the specialty I/O module slot with the HHT, select the ADV_SET and INT_SBR function keys and program the “ISR” (interrupt subroutine) program file number (range 3–255) that you want the I/O module to execute. Configuring I/O is discussed in chapter 6.

• Create the subroutine file that you have specified in the I/O module slot configuration. Creating a subroutine file is discussed in chapter 4.

31–1

Page 432

Chapter 31 Understanding I/O Interrupts – 5/02 Processor Only

Operation

When you download your program and enter the Run mode, the I/O interrupt begins operation as follows: • The specialty I/O module determines that it needs servicing and generates an interrupt request to the SLC processor. • The processor is interrupted from what it is doing, and the specified interrupt subroutine file (ISR) is scanned. • When the ISR scan is completed, the specialty I/O module is notified. This informs the specialty I/O module that it is allowed to generate a new interrupt. • The processor resumes normal operation from where it left off.

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

Interrupt Occurrences I/O 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. ISR execution time adds directly to the overall scan time. I/O 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

31–2

Page 433

Chapter 31 Understanding I/O Interrupts – 5/02 Processor Only

Interrupt Latency The interrupt latency (interval between the detection of an interrupt request from the specialty I/O module 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 I/O interrupt function.

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. The I/O interrupt cannot interrupt an executing fault routine, an executing STI subroutine, or another executing I/O interrupt subroutine. If an I/O interrupt occurs while the fault routine or STI subroutine is executing, the processor will wait until the higher priority interrupts are scanned to completion. Then the I/O interrupt subroutine will be scanned. Note: It is important to understand that the I/O Pending bit associated with the interrupting slot remains clear during the time that the processor is waiting for the fault routine or STI subroutine to finish. If a major fault occurs while executing the I/O interrupt subroutine, execution will immediately switch to the fault routine. If the fault was recovered by the fault routine, execution will resume at the point that it left off in the I/O interrupt subroutine. Otherwise, the fault mode will be entered. If the STI timer expires while executing the I/O interrupt subroutine, execution will immediately switch to the STI subroutine. When the STI subroutine is scanned to completion, execution will resume at the point that it left off in the I/O interrupt subroutine. If two or more I/O interrupt requests are detected by the processor at the same instant, or while waiting for a higher or equal priority interrupt subroutine to finish, the interrupt subroutine associated with the specialty I/O module in the lowest slot number will be scanned first. For example, if slot 2 (ISR 20) and slot 3 (ISR 11) request interrupt service at the same instant, the processor will first scan ISR 20 to completion, then ISR 11 to completion.

31–3

Page 434

Chapter 31 Understanding I/O Interrupts – 5/02 Processor Only

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

I/O Interrupt Parameters

The I/O interrupt parameters below have status file addresses. They are described here and also in chapter 27.

S:11 and S:12 I/O Slot Enables – Read/Write. These words are bit mapped to the 30 I/O slots. Bits S:11/1 through S:12/14 refer to slots 1 through 30. Bits S:11/0 and S:12/15 are reserved. The enable bit associated with an interrupting slot must be set when an interrupt occurs. Otherwise a major fault will occur. See chapter 27 for more details. Changes made to these bits using the EDT_DAT function take effect at the next end of scan. S:27 and S:28 I/O Interrupt Enables – Read/Write. These words are bit mapped to the 30 I/O slots. Bits S:27/1 through S:28/14 refer to slots 1 through 30. Bits S:27/0 and S:28/15 are reserved. The enable bit associated with an interrupting slot must be set when the interrupt occurs to allow the corresponding ISR to execute. Otherwise the ISR will not execute and the associated I/O slot interrupt pending bit will be set. Changes made to these bits using the EDT_DAT function take effect at the next end of scan. S:25 and S:26 I/O Interrupt Pending Bits – Read only. These words are bit mapped to the 30 I/O slots. Bits S:25/1 through S:26/14 refer to slots 1 through 30. Bits S:25/0 and S:26/15 are reserved. The pending bit associated with an interrupting slot is set when the corresponding I/O slot interrupt enable bit is clear at the time of an interrupt request. It is cleared when the corresponding I/O event interrupt enable bit is set, or when an associated RPI instruction is executed. The pending bit for an executing I/O interrupt subroutine remains clear when the ISR is interrupted by an STI or fault routine. Likewise, the pending bit remains clear if interrupt service is requested at the time that a higher or equal priority interrupt is executing (fault routine, STI, or other ISR).

31–4

Page 435

Chapter 31 Understanding I/O Interrupts – 5/02 Processor Only

You can enter and monitor parameters at the status file displays, under EDT_DAT. Parameters are pointed out in the displays below. A

Status File S2:11 & S2:12 I/O Slot Enables 1 2 3 0 0 0 0 1111 1111 1111 1111 1111 1111 1111 1111 Slot = 0 S2:11/0 = 1 PRG ADDRESS NEXT FL PREV FL NEXT PG PREV PG F1

B

F2

F3

F4

F5

Status File S2:27 & S2:28 I/O Interrupt Enables 1 2 3 0 0 0 0 0000 0000 0000 0000 0000 0000 0000 0000 S2:27/0 = 0 PRG ADDRESS NEXT FL PREV FL NEXT PG PREV PG F1

C

F2

F3

F4

F5

Status File S2:25 & S2:26 I/O Interrupt Pending 1 2 3 0 0 0 0 0000 0000 0000 0000 0000 0000 0000 0000 S2:25/0 = 0 PRG ADDRESS NEXT FL PREV FL NEXT PG PREV PG F1

F2

F3

F4

F5

A – Words S:11 and S:12. I/O slot enable bits. B – Words S:27 and S:28. I/O interrupt enable bits. C – Words S:25 and S:26. I/O interrupt pending bits.

31–5

Page 436

Chapter 31 Understanding I/O Interrupts – 5/02 Processor Only

IID and IIE Instructions

The IID and IIE instructions are used to create zones in which I/O interrupts cannot occur. These instructions are not required to configure a basic I/O interrupt application. I/O Interrupt Disable I/O Interrupt Enable HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

IID IIE (IID)

Output Instruction Output Instruction

(IIE)

ZOOM on IID –(IID)– 2.4.0.0.1 NAME: I/O INTERRUPT DISABLE 1 2 3 0 0 0 0 0100 1111 1111 1111 1111 1111 1111 1111

EDT_DAT F1

F2

F3

F4

F5

ZOOM on IIE –(IIE)– 2.0.0.0.1 NAME: I/O INTERRUPT ENABLE 1 2 3 0 0 0 0 0011 0000 0000 0000 0000 0000 0000 0001

EDT_DAT F1

F2

F3

Ladder Diagrams and APS Displays: IID I/O INTERRUPT DISABLE Slots: 2,3

IIE I/O INTERRUPT ENABLE Slots: 2,3

31–6

F4

F5

Page 437

Chapter 31 Understanding I/O Interrupts – 5/02 Processor Only

IID I/O Interrupt Disable – When true, this instruction clears the I/O interrupt enable bits (S:27/1 through S:28/14) corresponding to the slots parameter of the instruction (slots 1, 2, 7 in the following example). Interrupt subroutines of the affected slots will not be able to execute when an interrupt request is made. Instead, the corresponding I/O pending bits (S:25/1 through S:26/14) will be set. The ISR will not be executed until an IIE instruction with the same slot parameter is executed, or until the end of the scan during which you use a programming device to set the corresponding status file bit. Use this instruction together with an IIE instruction to create a zone in your main ladder program file or subroutine file in which I/O interrupts cannot occur. The IID instruction takes effect immediately upon execution. Setting/clearing the I/O interrupt enable bits (S:27 and S:28) with a programming device or standard instruction such as MVM takes effect at the END of the scan only. Parameter – Enter a 0 (reset) in a slot position to indicate a disabled I/O interrupt. IIE I/O Interrupt Enable – When true, this instruction sets the I/O interrupt enable bits (S:27/1 through S:28/14) corresponding to the slots parameter of the instruction (slots 1, 2, 7 in the following example). Interrupt subroutines of the affected slots will regain the ability to execute when an interrupt request is made. If an interrupt was pending (S:25/1 through S:26/14) and the pending slot corresponds to the IIE slots parameter, the ISR associated with that slot will execute immediately. Use this instruction together with the IID instruction to create a zone in your main ladder program file or subroutine file in which I/O interrupts cannot occur. The IIE instruction takes effect immediately upon execution. Setting/clearing the I/O interrupt enable bits (S:27 and S:28) with a programming device or standard instruction such as MVM takes effect at the END of the scan only. Parameter – Enter a 1 (set) in a slot position to indicate an enabled I/O interrupt.

31–7

Page 438

Chapter 31 Understanding I/O Interrupts – 5/02 Processor Only

IID/IIE Zone Example In the program below, slots 1, 2, and 7 are capable of generating I/O interrupts. The IID and IIE instructions in rungs 6 and 12 are included to avoid having I/O interrupt ISRs execute as a result of interrupt requests from slots 1, 2, or 7. This allows rungs 7 through 11 to execute without interruption.

The first pass bit S:1/15 and the IIE instruction in rung 0 are included to insure that the I/O interrupt function is initialized following a power cycle. You should include a rung such as this any time your program contains an IID/IIE zone or an IID instruction. The IID instruction in rung 6 clears the I/O interrupt enable bits associated with slots 1, 2, and 7 (S:27/1, S:27/2, and S:27/7). The IIE instruction in rung 12 sets these same bits. If an I/O interrupt is detected by the processor while the processor is executing rungs 7–11, the interrupt will be marked as pending (S:25/1, S:25/2, and/or S:25/7 will be set). All interrupts marked as pending will be serviced upon execution of rung 12 (the lowest numbered slot is serviced first when multiple pending bits are set).

0

1

Program File 2 S:1 ] [ 15

] [

IIE I/O INTERRUPT ENABLE Slots: 1,2,7

( )

] [

2 3 4 5

IID I/O INTERRUPT DISABLE Slots: 1,2,7

6

HHT Ladder Display: When the cursor is on the IIE instruction, the enabled slots are indicated here by 1s. IIE:0110 0001... ] [

2.0.0.0.2 (IIE) ( )

ISR execution will not occur 7 between IID 8 and IIE instructions 9

] [

] [

( )

] [

] [

( )

10 11

IIE

RUN MODE

FORCE

EDT DAT

SEARCH

F1

F2

F3

F4

I/O INTERRUPT ENABLE Slots: 1,2,7

12 F5

When the cursor is on the IID instruction, the disabled slots are indicated here by 0s.

13

] [

( )

] [

14 IID:0001 1110...

2.6.0.0.1

15 16

(IID) ( ) RUN MODE

FORCE

EDT DAT

SEARCH

F1

F2

F3

F4

31–8

F5

17

END

Page 439

Chapter 31 Understanding I/O Interrupts – 5/02 Processor Only

RPI Instruction

The RPI instruction is used to purge unwanted I/O interrupt requests. This instruction is not required to configure a basic I/O interrupt application. Reset Pending Interrupt

RPI

Output Instruction

HHT Ladder Display:

(RPI)

HHT Zoom Display: (online monitor mode)

ZOOM on RPI –(RPI)– 2.0.0.0.1 NAME: RESET PENDING INTERRUPT 1 2 3 0 0 0 0 0000 0000 0000 0000 0000 0000 0000 0001

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: RPI RESET PENDING INTERRUPT Slots: 1–30

RPI Reset Pending Interrupt – When true, this instruction clears the I/O pending bits (S:25/1 through S:26/14) corresponding to the slots parameter of the instruction. In addition, the processor notifies the specialty I/O modules in those slots that their interrupt request was aborted. Following this notice, the slot may once again request interrupt service. This instruction does not affect the I/O slot interrupt enable bits (S:27/1 through S:28/14). Parameter: Enter a 0 (reset) in a slot position to indicate that the pending status of an I/O interrupt is reset (aborted). HHT Ladder Display: When the cursor is on the RPI instruction, the slots having reset Pending I/O Interrupt bits are indicated here by 0s. RPI:0000 0000... ] [

2.0.0.0.2 (RPI) ( )

RUN MODE

FORCE

EDT DAT

SEARCH

F1

F2

F3

F4

F5

31–9

Page 440

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