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

The text of a manual · part 28 of 45

Enhanced and Ethernet PLC-5 Programmable Controllers User Manual: Chapter 13 - Programming Considerations, pages 227 to 234

Pages 227 to 234 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 227

Programming Considerations

13-9

To ensure that the received BTR data table file has been properly updated before you use the data, do the following: 1. Enable the input conditions of the BTR rung. 2. Wait for the BTR done bit to be set. 3. Allow time for housekeeping to force and send the changed data from the block-transfer data buffer to the block-transfer data table file. BTR.DN detected

BTR data valid OTL

BT10:0

BTR DN detected OTE)

DN If BTR data is not valid BTR data valid /

BTR Rack 01 Group 4 Module 0 Control Block BT10:0 Data File N9:0 Length 6 N Continuous

BTR data valid any logic accessing the BTR data or copy data to another file

BTR data valid OTU) [END OF FILE] After the BTR done bit is set, the valid data in the BT data buffer is copied to the BTR data table file during housekeeping.

41401

To ensure that the intended BTW data table file was properly transferred, do the following: 1. Change the data in the block-transfer output data table. 2. Allow time for housekeeping to force and send the changed data from the block-transfer output data table file to the block-transfer data buffer. 3. Enable the BTW

Publication 1785-UM012D-EN-P - July 2005

Page 228

13-10

Programming Considerations

4. Ensure that data does not change in the block-transfer data table output file until the BTW is complete. BT10:1

BTW data valid OTU

DN BTW data valid BT10:1 EN false-to-true transition

EN

BTW

/

Rack 01 Group 4 Module 0 Control Block BT10:1 Data File N11:0 Length 6 N Continuous

DN) ER)

BTW instruction must be above this logic BT10:1 / EN any logic that modifies the BTW output file data

BTW data valid OTL) [END OF FILE]

Using Special Programming Routines

41402

Use your design specification to determine if you need one or more of the following special programming routines: • power-up routines • fault-driven routines (necessary to safely manage equipment faults) • time-driven interrupt routines (selectable timed interrupts) • event-driven interrupt routines (controller input interrupts) The following table explains when to use these programming features.

Publication 1785-UM012D-EN-P - July 2005

Page 229

Programming Considerations

13-11

Deciding When to Use Special Routines If a Portion of Logic Should Execute Immediately on detecting conditions that require a startup Immediately on detecting a major fault

Example

Use

Restart the system after Power-Up Routine the system has been shut down Shut down plant floor Fault Routine devices safely upon detecting a major fault or

At a specified time interval

Send critical status to a supervisory controller via DH+ after detecting a major fault Monitor machine position Selectable Timed every 250ms and Interrupt (STI) calculate the average rate-of-change or Take a measurement and compare it with a standard every 1.0 seconds

Immediately when an event occurs

Eject a faulty bottle from Controller Input a bottling line Interrupt (PII)

Priority Scheduling for Interrupts and MCPs

By Doing the Following: Create a separate file for a controlled start-up procedure for the first time you start a program or when you start a program after system down time. The controller executes the power-up routine to completion. Create a separate file for a controlled response to a major fault. The first fault detected determines which fault routine is executed. The controller executes the fault routine to completion. If the routine clears the fault, the controller resumes the main logic program where it was interrupted. If not, the controller faults and switches to program mode.

Create a separate program file and specify the interrupt time interval. The controller interrupts the main logic program at the specified interval, runs the STI to completion, then resumes the main logic program where it left off. The controller interrupts the main logic program at the specified interval and runs the STIs. When a block-transfer instruction to remote I/O is encountered in an STI, the controller resumes execution of lower priority programs (main logic program) until the block-transfer is completed. When this occurs and you want your STI to run to completion before returning to the main logic program, use UID and UIE instructions in your STI program file. Create a separate program file and specify 16 inputs of an input word in the I/O rack. When the event(s) occurs, the controller interrupts the main logic program, runs the PII to completion, then resumes the main logic program where it left off. When a block-transfer instruction to remote I/O is encountered in a PII, the controller resumes execution of lower priority programs (main logic program) until the block-transfer is completed. When this occurs and you want your PII to run to completion before returning to the main logic program, use UID and UIE instructions in your PII program file.

PLC-5 controllers prioritize when fault routines, interrupts, and main control programs are executed. This prioritization is called “scheduling.” The PLC-5 controller considers some scheduling tasks to be of greater importance than others. The scheduling priority of each task is as follows (from highest to lowest): 1. Fault Routine 2. Controller Input Interrupt (PII) 3. Selectable Timed Interrupt (STI) 4. Main Control Program (MCP)

Publication 1785-UM012D-EN-P - July 2005

Page 230

13-12

Programming Considerations

This scheduling determines what controls the program execution path. For example, if a PII is currently executing, it cannot be interrupted by an STI until the PII is completed (since the PII has scheduling priority over the STI). If an MCP is executing and a fault routine is called, however, the MCP’s execution will be interrupted because fault routines have priority over the MCPs. IMPORTANT

You can temporarily override this priority scheduling by using the UID and UIE instructions. These instructions can be interrupted by a fault routine (see page 13-14).

Fault routines, PIIs, and STIs are interrupt driven. They can execute at any time except during run-time edit operations. MCPs, however, are executed to completion from first user program to last.

Program Execution States User programs in the PLC-5 controller are always in one of the following five states: completed, ready, executing, waiting, or faulted.

Publication 1785-UM012D-EN-P - July 2005

Page 231

Programming Considerations

13-13

Completed State Program has completed execution or has not yet started execution

Ready State Program would be executing if it were of a higher priority; all programs pass through this state; there can be several programs in this state at any given time

Waiting State Program is ready for execution but is waiting for some event to occur (such as an input to transition or a timer to complete)

Rescheduling Operation

Waiting State While block-transfer to remote rack occurs, a rescheduling operation is performed and lower-priority programs are executed (unless all other executions are prohibited by a UID/UIE zone around the block-transfer.

Executing State Program is executing; only one program can be in this state at one time

Has a new program with a higher priority become ready? (e.g., an MCP, STI, PII)

Rescheduling Operation

Rescheduling Operation

Yes

No

Does the program fault?

Yes

Faulted State A run-time error has occurred within the program

No Program counter is adjusted to point to next instruction Yes

Does the program request a remote block transfer? (STI and PII routines only) Does an appropriate fault routine choose to clear the fault? No Completed State Program has completed execution or has not yet started execution

Yes

No

All active user programs are aborted and processor enters faulted state

Publication 1785-UM012D-EN-P - July 2005

Page 232

13-14

Programming Considerations

Influencing Priority Scheduling Use the UID (user interrupt disable) and UIE (user interrupt enable) instructions to influence user program scheduling. They can be used to protect important portions of ladder logic that must be executed through to completion. The UID/UIE instructions are designed to be used in pairs. For example:

I:012

I:012

I:012

O:013

01

02

03

02

Program can be interrupted

UID I:012

I:012

O:013

01

04

02

I:012

I:012

O:013

04

02

03

Program cannot be interrupted

I:012 03

UIE

Program can be interrupted

After a UID instruction has executed, interrupts are postponed. The interrupt program is placed in the ready state. After a UIE instruction has executed, any user programs that are currently in the ready state are checked for priority. If the ready program is of a higher priority than the currently executing program, the executing program returns to the ready status while the interrupt program begins executing. While the controller is executing within a UID/UIE zone, the executing program cannot be interrupted except by a fault routine. For more information on programming UID or UIE instructions, see the PLC-5 Programming Software Instruction Set Reference, publication 1785-6.1.

Publication 1785-UM012D-EN-P - July 2005

Page 233

Programming Considerations

Defining and Programming Interrupt Routines

13-15

For information about configuring and programming these routines, see the appropriate chapter:

For Information About

See Chapter

Power-up routines

14

Fault routines

15

Main control programs (MCPs)

16

Selectable timed interrupts (STIs) 17 Controller input interrupts (PIIs)

18

Publication 1785-UM012D-EN-P - July 2005

Page 234

13-16

Programming Considerations

Notes

Publication 1785-UM012D-EN-P - July 2005