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

The text of a manual · part 27 of 70

SLC 500 Instruction Set Reference Manual, pages 261 to 270

Pages 261 to 270 of 694

The original document is the PDF (7.2 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-L514

Page 261

Understanding Interrupt Routines

11-29

Latency periods are: • SLC 5/02 interrupts are serviced within 2.4ms maximum. • SLC 5/03 and higher processors: If an interrupt occurs while the processor is performing a multi-word slot update and your interrupt subroutine accesses that same slot, the multi-word transfer finishes to completion prior to performing the interrupt subroutine slot access. The Interrupt Latency Control bit (S:33/8) functions: • when the bit is set (1) interrupts are serviced within the interrupt latency time. • when S:33/8 is clear (0), user interrupts occur between rungs and I/O slot updates. The default state is cleared (0). To determine the interrupt latency with S:33/8 clear, you must calculate the execution time of each and every rung in your program.

Interrupt Priorities Interrupt priorities are as follows.

Table 11.4 Interrupt Priorities SLC 5/02 Processor

SLC 5/03 and Higher Processors

1. Fault Routine

1. Fault Routine

2. STI Subroutine

2. Discrete Input Interrupt (DII)

3. I/O Interrupt Subroutine (ISR)

3. STI Subroutine 4. 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 DII subroutine, an executing STI subroutine, or another executing I/O interrupt subroutine. If an I/O interrupt occurs while the fault routine, DII, or STI subroutine is executing, the processor waits until the higher priority interrupts are scanned to completion. The I/O interrupt subroutine is then scanned.

Publication 1747-RM001G-EN-P - November 2008

Page 262

11-30

Understanding Interrupt Routines

TIP

SLC 5/02 specific: 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. SLC 5/03 and higher processors: The I/O pending bit is always set when the interrupt occurs. You can examine the state of these bits within your higher priority interrupt routines.

If a major fault occurs while executing the I/O interrupt subroutine, execution immediately switches to the fault routine. If the fault was recovered by the fault routine, execution resumes at the point that it left off in the I/O interrupt subroutine. Otherwise, the fault mode is entered. If a DII interrupt occurs while executing the I/O interrupt subroutine, execution immediately switches to the DII subroutine. When the DII subroutine is scanned to completion, execution resumes at the point that it left off in the I/O interrupt subroutine. If the STI timer expires while executing the I/O interrupt subroutine, execution immediately switches to the STI subroutine. When the STI subroutine is scanned to completion, execution resumes 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 is scanned first. For example, if slot 2 (ISR 20) and slot 3 (ISR 11) request interrupt service at the same instant, the processor first scans ISR 20 to completion, then ISR 11 to completion.

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 Publication 1747-RM001G-EN-P - November 2008

The I/O interrupt parameters below have status file addresses. They are described here.

Page 263

Understanding Interrupt Routines

11-31

• ISR Number - Specifies the subroutine file number that will be executed when an I/O interrupt is generated by an I/O module. The ISR Numbers are not part of the status file, but they are part of the I/O configuration for each slot in the SLC system. • I/O Slot Enables (Words S:11 and S:12) - 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. Changes made to these bits using the Data Monitor function take effect at the next end of scan. • I/O Interrupt Pending Bits (Words S:25 and S:26) - 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 a DII, STI, or fault routine. SLC 5/02 specific: 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). SLC 5/03 and higher processors: This bit is set if interrupt service is requested at the time a higher or equal priority interrupt is executing (fault routine, DII, STI, or other ISR). • I/O Interrupt Enables (Words S:27 and S:28) - 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. SLC 5/02 specific: Changes made to these bits using the data monitor function or ladder instruction take effect at the next end of scan. SLC 5/03 and higher processors: Changes made to these bits using the data monitor function or ladder instruction take effect immediately.

Publication 1747-RM001G-EN-P - November 2008

Page 264

11-32

Understanding Interrupt Routines

• I/O Interrupt Executing (Word S:32) - This word contains the slot number of the specialty I/O module that generated the currently executing ISR. This value is cleared upon completion of the ISR, run mode entry, or upon power up. You can interrogate this word inside of your DII or STI subroutine or fault routine if you wish to know if these higher priority interrupts have interrupted an executing ISR. You may also use this value to discern interrupt slot identity when multiplexing two or more specialty I/O module interrupts to the same ISR.

I/O Interrupt Disable (IID) and I/O Interrupt Enable (IIE)

Use these instructions together to create a zone in your main ladder program file or subroutine file in which I/O interrupts cannot occur. Both instructions take effect immediately upon execution. You must specify a subroutine to be executed upon receipt of such an interrupt.

IID I/O Interrupt Disable Slots 0 IIE I/O Interrupt Enable Slots 0

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

These instructions are generally used in pairs to prevent I/O interrupts from occurring during time-critical or sequence-critical portions of your main program or subroutine. The I/O Event-Driven Interrupt function is used with specialty I/O modules capable of generating an interrupt.

•

•

SLC 5/02 specific: 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. SLC 5/03 and higher processors: 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 immediately.

IID Operation 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. Interrupt subroutines of the affected slots are not able to execute when an interrupt request is made. Instead, the corresponding I/O pending bits (S:25/1 through S:26/14) are set. The ISR is not 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.

Publication 1747-RM001G-EN-P - November 2008

Page 265

Understanding Interrupt Routines

11-33

IIE Operation 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. Interrupt subroutines of the affected slots 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 executes immediately.

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.

IIE IID Example 5 The following program will demonstrate a IIE and a IID. S:1 First Pass IIE I/OInterrupt Enable Slots 1-2,7

0000

15

Any Bit B3:0

Any Bit B3:2

0001

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 are serviced upon execution of rung 12. The lowest numbered slot is serviced first when multiple pending bits are set.

0

0

Any Bit B3:0

Any Bit B3:2

0002 1

0 IID I/OInterrupt Disable Slots 1-2,7

0003

ISR execution will not occur between IID and IIE instructions.

Any Bit B3:0

Any Bit B3:1

2

2

Any Bit B3:2

0004

Any Bit B3:0

0 Any Bit B3:2

0005 3

0 IIE I/OInterrupt Enable Slots 1-2,7

0006

Any Bit B3:0

Any Bit B3:2

0007 4

0

Any Bit B3:0

Any Bit B3:2

5

0

0008

0009

END

Publication 1747-RM001G-EN-P - November 2008

Page 266

11-34

Understanding Interrupt Routines

This instruction resets the pending status of the specified slots and informs the corresponding I/O modules that you have aborted their interrupt requests. This instruction is not required to configure a basic I/O interrupt application.

Reset Pending Interrupt (RPI) RPI Reset Pending Interrupt Slots 0

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

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).

•

Entering Parameters Enter the I/O slot numbers (1 to 30) involved.

Table 11.5 I/O Slot Numbers

Interrupt Subroutine (INT)

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

•

Publication 1747-RM001G-EN-P - November 2008

Slot #

Slot Indicated

6 indicates slot 6

6,8 indicates slots 6 and 8

6 to 8 indicates slots 6, 7, and 8

1 to 30 indicates all slots

Use the INT instruction in I/O event-driven interrupt subroutines (ISRs) and STIs for identification purposes. Use of this instruction is optional. 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 ISR.

Page 267

Chapter

12

SLC Communication Instructions

This chapter contains general information about the SLC communication instructions. Each of the instructions includes information on: • what the instruction symbol looks like. • how to use the instruction.

Table 12.1 Communication Instructions

1

Instruction Mnemonic

Instruction Name

Purpose

Page

SVC

Service Communications

The SVC instruction interrupts the program scan to execute the service communication portion of the operating cycle.

12-3

MSG

Message Read/Write

This instruction transmits data from one node to another on the communication network.

12-5

CEM

ControlNet Explicit Message

This instruction transmits CIP generic commands to other ControlNet nodes via the 1747-SCNR.

12-45

DEM

DeviceNet Explicit Message

This instruction transmits CIP generic commands to other DeviceNet nodes via the 1747-SDN.

12-52

EEM

EtherNet/IP Explicit Message

This instruction transmits CIP generic commands to other EtherNet/IP nodes via channel 1.

12-58

Publication 1747-RM001G-EN-P - November 2008

Page 268

12-2

SLC Communication Instructions

About the Communication Instructions

Use the SVC instruction to enhance communication performance of your processor. Use the various message instructions to send and receive data from other processors and devices. In this chapter you will find a general overview preceding each type of instruction. • Service Communication instruction for SLC 5/02 and higher processors. • General message instruction for the SLC 5/02 and higher processors. • ControlNet Explicit Message instruction for the SLC 5/03 and higher processors (requires series C, FRN 10 or higher OS firmware). • DeviceNet Explicit Message instruction for the SLC 5/03 and higher processors (requires series C, FRN 10 or higher OS firmware). • Ethernet/IP Explicit Message instruction for the SLC 5/05 processor (requires series C, FRN 10 or higher OS firmware).

Publication 1747-RM001G-EN-P - November 2008

Page 269

SLC Communication Instructions

Service Communications (SVC) SVC SERVICE Channel Channel

SLC 5/03 and higher

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

Use an SLC 5/02 Processor

The SVC instruction is an output instruction that has no programming parameters. When it is evaluated as true, the program scan is interrupted to execute the service communications part of the operating cycle. The scan then resumes at the instruction following the SVC instruction. Use this instruction to enhance the communication performance of your SLC 5/02 processor.

COMMUNICATIONS 0 1

•

12-3

•

You are not allowed to place an SVC instruction in an STI interrupt, I/O interrupt, or user fault subroutine.

•

Output Instruction

Use SLC 5/03 and Higher Processors When using SLC 5/03 and higher processors, the SVC instruction operates as described above. These processors also allow you to select a specific communication channel (0, 1, or both) to be serviced. You are not allowed to place an SVC instruction in a Fault, DII, STI, or I/O Event subroutine. • SLC 5/03 processor – channel 0 is RS-232/DF1 Full-duplex, DF1 Half-duplex (master or slave), DF1 Radio Modem, DH-485, Modbus Remote Terminal Unit (RTU) Master(1), or ASCII – channel 1 is DH-485 • SLC 5/04 processor – channel 0 is RS-232/DF1 Full-duplex, DF1 Half-duplex (master or slave), DF1 Radio Modem, DH-485, Modbus RTU Master(1), or ASCII – channel 1 is DH+ • SLC 5/05 processor – channel 0 is RS-232/DF1 Full-duplex, DF1 Half-duplex (master or slave), DF1 Radio Modem, DH-485, Modbus RTU Master(1), or ASCII – channel 1 is Ethernet

(1)

SLC 5/03, SLC 5/04, SLC 5/05 OS Series C FRN 11 and above

Publication 1747-RM001G-EN-P - November 2008

Page 270

12-4

SLC Communication Instructions

The following status bits let you customize or monitor communications servicing. Table 12.2 Status Bits for Customizing Communication Servicing Channel 1

Channel 0(1)

S:2/5

Incoming Command Pending Bit

S:33/0

Incoming Command Pending Bit

S:2/6

Message Reply Pending Bit

S:33/1

Message Reply Pending Bit

S:2/7

Outgoing Message Command Pending Bit

S:33/2

Outgoing Message Command Pending Bit

S:2/15

Communications Servicing Selection Bit

S:33/5

Communications Servicing Selection Bit

S:33/6

Message Servicing Selection Bit

S:33/7(1) Message Servicing Selection Bit (1)

SLC 5/03 and higher processors only.

Channel Servicing Whether you select a channel to be serviced by the SVC instruction or not, that channel is still serviced normally at the end of the scan.

TIP

Publication 1747-RM001G-EN-P - November 2008

You may program the SVC instruction unconditionally across the rungs. This is the normal programming technique for the SVC instruction.