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

The text of a manual · part 33 of 45

Enhanced and Ethernet PLC-5 Programmable Controllers User Manual: Chapter 18 - Using Processor Input Interrupts

Pages 263 to 268 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 263

Chapter

18

Using Processor Input Interrupts

Using This Chapter For Information About

Using a Processor Input Interrupt

Go to Page

Using a processor input interrupt

18-1

Defining a processor input interrupt

18-5

Monitoring processor input interrupts

18-5

A processor input interrupt (PII) specifies when an event-driven input causes the controller to interrupt program execution and run a PII program file once to completion. Afterwards, the controller resumes executing the program file from where it was interrupted. Use PIIs only for inputs in the controller-resident chassis. You can use a processor input interrupt (PII) as an event-driven interrupt or in high-speed processing applications. For example, you may need to count inputs quickly to track production, such as in a canning line. Or, use a PII if your application calls for an immediate input update when a part is seen on a conveyor and you need to do an immediate output update to perform the next action. For example, when a part moving down a conveyor line is detected, you may need to stop it so the next piece can be added. Your PII program can contain immediate update instructions to complete high-speed control functions. As your ladder program is running and the input condition occurs, the controller interrupts program execution and runs the PII program file. Then, the controller resumes executing the program file from the point where it was interrupted.

1

Publication 1785-UM012D-EN-P - July 2005

Page 264

18-2

Using Processor Input Interrupts

Writing PII Ladder Logic Follow these rules when you write ladder logic for a PII. • Store the PII program in a ladder file. • Make sure the input condition (to cause the interrupt) doesn’t occur faster than the execution time of the PII program. If a second identical input condition occurs before the interrupt program has finished executing for the first input condition, a PII overlap occurs and the controller sets a minor fault bit at S:10/12. The timing for a PII is as follows:

–1 ms to switch to the PII task –PII ladder logic execution time –1 ms to return to executing the control program Since you need to allow at least 1 ms to run your PII logic, define a PII time of at least 3 ms to help prevent PII overlaps. • The controller’s watchdog timer continues to run while running a PII program. • A PII can detect an event within 100 µs; however, you must allow at least 3 ms between successive PII events.

PII Application Examples Two ways that you can use a PII program: Mode

Description

Counter

Using counter mode, you make use of the controller’s internal counter. You configure the PII with a preset value so that the hardware counts an input condition and then runs the PII when the preset equals the accumulated value. The PII ladder logic only needs to contain the output that you want to occur.

Bit transition Using bit-transition mode, you configure the PII to occur every time the input condition is true. For example, you want to count tablets as they leave the production line at a rate of 100 tablets per second. The machinery packs 100 tablets per package. Assume an optical switch detects each tablet.

Publication 1785-UM012D-EN-P - July 2005

Page 265

Using Processor Input Interrupts

18-3

As shown in the following figure, the PII program must: • count 100 tablets per group • set an output at the 100th tablet • reset the counter for the next group C4:0.CU U CTU COUNT UP Counter Preset Accum

CU C4:0 100

DN

Output

C4:0 DN C4:0 RES

Output

CLR CLEAR Destination

S:51

The output image bit remains set until the next count.

Block-Transfers in Processor Input Interrupts (PIIs) If the controller runs a PII 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 PII program (i.e., the PII is invoked and the block-transfer occurs immediately). The controller executes the block-transfer immediately, completes the remaining rungs in the PII, then resumes execution of the ladder program. You can use the PII for a block-transfer to remote I/O. Remote block-transfer instructions in a PII cause the controller to resume executing user programs, while waiting for the block-transfer to complete. If you want the PII to run to completion before returning to your main logic program, include a UID and UIE instruction pair in your PII program file. Place the block-transfer instruction inside of a UID/UIE pair.

Publication 1785-UM012D-EN-P - July 2005

Page 266

18-4

Using Processor Input Interrupts

IMPORTANT

When the controller runs an PII 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.

PII configuration changes are not put into effect until the controller goes from program to run or test mode.

Design Considerations Consider the following guidelines when planning PIIs. • Do not use 2-slot addressing when using PIIs. • Do not use 1771-IG or -IGD, 8- and 16-point TTL modules for the PII. Use the 1771-IQ16 input module instead. Since the module’s input delay filter is selectable, you can set the delay to 0 or about 200 ms. • Avoid using a block-transfer module in the controller-resident rack with a PII configured because you could miss an input pulse while a block-transfer of data is in progress. However, if you need to use block-transfers, make sure that a PII input pulse is at least 400 ms, which causes the block-transfer not to affect the PII. • Online editing affects the performance of a PII routine. A PII cannot interrupt the controller while it is managing its memory due to the online edits being made. The PII input must be on for an amount of time slightly greater than the actual time required to complete the online edits. If not, the PII does not execute. • Clear S:51 in one of two ways:

– using a CLR instruction (see ²) – placing a MOV (move) instruction on the last rung in the PII file. Move a 0 into S:51 to reset the PII bits before finishing the PII file. IMPORTANT

Publication 1785-UM012D-EN-P - July 2005

If S:51 is not cleared, a PII overlap bit is set on that status page, causing a minor fault.

Page 267

Using Processor Input Interrupts

Defining a Controller Input Interrupt

18-5

To define a PII, use the controller configuration screen in your programming software.

In this PII Configuration Field Preset

Status File Address

Do the Following Enter a preset value to determine how many conditions you want to occur before the interrupt. Valid range is 0 - 32,767.

S:50

If you want the interrupt to occur every time, enter a 0 or 1. File number

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

S:46

This is the only PII parameter that you can change while the controller is in RUN mode. Module group

Enter the assigned rack number and I/O group number of the input to monitor (e.g., 21 for rack 2, group 1). Do not enter the address. (Only for inputs in the controller-resident chassis).

S:47

If the input word number specified is not in the local rack or if there is not an input module in the slot addressed, a minor fault bit (S:10/11) is set at mode transition. Bit mask

Each module group (specified in S:47) has a control bit that is used to monitor the input bit.

S:48

• To monitor the bit, enter a 1. • To ignore the bit, enter a 0.

Compare value

Each module group (specified in S:47) has a bit that is used when controlling a PII through bit transition.

S:49

• For a false to true transition to count (bit trigger), enter a 1. • For a true to false transition to count (event trigger), enter a 0.

IMPORTANT

If you change the PII configuration while in run mode, you must toggle the mode to program, then back to run mode for the change to take effect.

Publication 1785-UM012D-EN-P - July 2005

Page 268

18-6

Using Processor Input Interrupts

Monitoring Controller Input Interrupts

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

Status File Address

This PII Field

Stores

Events since last interrupt

Displays the number of PII events (the input conditions that caused the interrupt) since the last interrupt.

S:52

PII changed bits

Displays the bit transitions that caused the interrupt. You can use this information to condition other rungs in your ladder program.

S:51

If one of these bits is already set (i.e., a previous interrupt set the bit), the controller sets a minor fault (S:10/2) to indicate a possible PII overlap. If you want to monitor this overlap, make sure the last rung in your PII program clears this return mask in the status file. Last scan time

Displays the current or last scan time through the PII.

S:55

Max observed scan Displays the maximum value that was displayed in the last time scan field.

S:56

Word not in local rack

S:10/11

This box is checked if the input word number specified is not on the local rack or if there is not an input module in the slot addressed.

No command blocks This box is checked if no command blocks exist to get the PII. You can use the controller’s internal counter or bit transition to execute the PII.

S:10/13

User routine overlap This box is checked if a set condition exists in the PII return mask or changed bits (possibly set by a previous interrupt) before completing the currently executing PII routine. PII changed bits are retentive. It may be necessary to place a MOV instruction on the last rung in the PII file. Move 0 in S:51 to reset the PII bits before finishing the PII file. If this is not done, a PII overlap bit will be set on that status page, causing this minor fault.

S:10/12

Use S:51/0-15 within the PII file because these bits are: • mapped from the actual input module being used for the PII • retentive For the PII routine to execute properly, do not use the addresses of the input module’s bits within the PII routine.

Publication 1785-UM012D-EN-P - July 2005