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

The text of a manual · part 32 of 45

Enhanced and Ethernet PLC-5 Programmable Controllers User Manual: Chapter 17 - Using Selectable Timed Interrupts

Pages 259 to 262 of 388, from Enhanced and Ethernet PLC-5 Programmable Controllers User Manual

The original document is the PDF (5.1 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 1785-L20B and Allen-Bradley 1785-L40B

Page 259

Chapter

17

Using Selectable Timed Interrupts

Using This Chapter For Information About

Using a Selectable Timed Interrupt

Go to Page

Using a selectable timed interrupt

17-1

Defining a selectable timed interrupt

17-3

Monitoring selectable timed interrupts

17-4

A selectable timed interrupt (STI) tells the controller to periodically interrupt program execution (due to elapsed time) to run an STI program once to completion. Then, the controller resumes executing the original program file from where it was interrupted. For example, you might want to use an STI to periodically update analog values for a process control loop or send machine data to a host at scheduled intervals.

Writing STI Ladder Logic Follow these guidelines when you write ladder logic for an STI. • Store the STI program in its own ladder file. • Make sure that the interrupt interval you specify (in status word S:30) is longer than the execution time of the STI program. If it is not, an STI overlap can occur and the controller sets a minor fault bit at S:10/2. • Note that the controller’s watchdog timer continues to run while the controller runs an STI program. IMPORTANT

1

If the interrupt occurs during the execution of an instruction, the controller stops executing the instruction, scans the interrupt file once to completion, and then resumes executing the instruction. In effect, STI execution is transparent to program execution time unless you specify too short an interval. An interval that is too short can cause the watchdog timer to time out or cause excessively long program scans.

Publication 1785-UM012D-EN-P - July 2005

Page 260

17-2

Using Selectable Timed Interrupts

Online editing affects the performance of an STI routine. The STI cannot interrupt the controller while it is managing its memory due to the online edits being made. The STI input must be on for an amount of time slightly greater than the actual time required to complete the online edits. If not, the STI does not execute.

STI Application Example Periodically check the status of PLC-5 family controllers on the DH+ communication link. Compare the status of each controller with a file of reference data (see rungs below). Set a bit if a mismatch is found. Perform this comparison once every 800 ms. Assume that another active step retrieves status data from the PLC-5 controllers with a MSG instruction and loads it into a temporary source file (N5:10). R6:0 / DN

FSC FILE SEARCH/COMPARE Control Length Position Mode Expression #N5:0 <> #N5:10

EN R6:0 10 0 ALL

R6:0

O:000

FD

00

DN ER

Block-Transfers in Selectable Timed Interrupts (STIs) If the controller runs an STI that contains block-transfer instructions, the controller performs these block-transfers immediately on completing any block-transfers currently in the active buffer, ahead of block-transfer requests waiting in the queue. You can program “immediate” block-transfers to a local I/O chassis using the STI program (i.e., the STI is invoked and the block-transfer occurs immediately). The controller executes the block-transfer immediately, completes the remaining rungs in the STI, then resumes execution of the ladder program. Set the .TO bit on any block-transfer instruction destined for the same slot as the block-transfer in the STI. These block-transfers only try to execute once so as not to keep the STI from completing.

Publication 1785-UM012D-EN-P - July 2005

Page 261

Using Selectable Timed Interrupts

17-3

The block-transfers in an STI should only be between the controller and local I/O. Remote block-transfer instructions in an STI cause the controller to resume executing the user program while waiting for the block-transfer to complete. If you want the STI to run to completion before returning to your main logic program, include an UID and UIE instruction pair in your STI program file. Place the block-transfer instruction inside of a UID/UIE pair. ATTENTION

Defining a Selectable Timed Interrupt

When the controller runs an STI with a block-transfer instruction to a remote chassis, the MCP resumes processing while waiting for the block-transfer to complete unless a UIE/UID instruction pair is used.

To configure a selectable timed interrupt, you must specify:

In this Field Do the Following Setpoint

Status File

Enter the time interval between interrupts (1 to 32767 ms).

S:30

If you are not using or want to disable an STI, enter zero. Important: Remember to specify an interrupt time longer than the STI file execution time. If you do not, the controller sets a minor fault (S:10, bit 2). File number

Enter the number of the program file that contains the STI program.

S:31

If you are not using an STI, enter zero.

Publication 1785-UM012D-EN-P - July 2005

Page 262

17-4

Using Selectable Timed Interrupts

For example, you could enter a 7 in S:31 and a 15 in S:30. This causes the controller to execute ladder file 7 every 15 ms. You can use only one STI at any one time. However, you can enable or disable the interrupt, change to a different interrupt file, or change the time between interrupts. Use ladder logic to change the values in word S:30 and word S:31 as needed. ATTENTION

IMPORTANT

Monitoring Selectable Timed Interrupts

STI programs lengthen the program scan by an amount equal to the interrupt delay multiplied by the number of times the interrupt occurs during a program scan.

If you disable the STI through ladder logic (write a 0 to S:30), it could take the controller up to 100 ms to re-enable the STI. If you disable the STI (write a 0 to S:31), the controller uses the value in S:30 to determine how often to check for a non-zero value in S:31.

Use the controller status screen in your programming software to monitor STIs.

In this Field Do the Following

Publication 1785-UM012D-EN-P - July 2005

Status File

Last scan time

This field displays the time it took for the current or last scan of the STI.

S:53

Maximum scan time

This field displays the longest time that was ever displayed in the Last scan field for the specific STI.

S:54

STI Overlap

This box is checked if an STI overlap occurs. This condition results if the interrupt interval you specify for the setpoint is shorter than the execution time of the STI program.

S:10/2