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

The text of a manual · part 31 of 45

Enhanced and Ethernet PLC-5 Programmable Controllers User Manual: Chapter 16 - Using Main Control Programs

Pages 253 to 258 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 253

Chapter

16

Using Main Control Programs

Using This Chapter For Information About

Selecting Main Control Programs

Go to Page

Selecting main control programs

16-1

Understanding how the controller interprets MCPs

16-2

Configuring MCPs

16-3

Monitoring MCPs

16-5

You can have as many as 16 control programs active at one time. Each of these programs is called a “main control program” (MCP). You can define one MCP for each particular machine or function of your process. This lets you separate sequential function charts (SFCs), ladder logic, and structured text to better modularize your process and make troubleshooting easier. Consider Using this Technique

If You are

SFC defining the order of events in the process

Ladder Logic

• more familiar with ladder logic than with programming languages such as BASIC • performing diagnostics

Structured Text

• more familiar with programming languages such as BASIC than with ladder logic • using complex mathematical algorithms • using program constructs that repeat or “loop” • creating custom data-table monitoring screens

A main control program can be an SFC numbered 1-999; it can also be a ladder or structured-text program numbered 2-999 in any program file. You can use any mix of SFC, ladder, and structured-text programs to define 16 main control programs. One data table is used by all MCPs (i.e., you do not have a separate data table for each MCP).

1

Publication 1785-UM012D-EN-P - July 2005

Page 254

16-2

Using Main Control Programs

Understanding How the Controller Interprets MCPs

The MCPs are scheduled to execute in the order in which you specify on the Crocessor Configuration screen. You can configure: • an I/O image update and housekeeping after each MCP is completed (default parameter), or • the controller to skip the I/O scan and run the next MCP After the last MCP is completed, all MCPs are then repeated in the same order. Note that the watchdog setpoint covers one scan of all MCPs. The figure below shows how the controller interprets MCPs when an I/O image update is specified to occur after each MCP is completed.

MCP A

MCP B

I/O image update and housekeeping

I/O image update and housekeeping

I/O pre-scan performed on transition from program to run mode

MCP P ...

I/O image update and housekeeping

Important: Mode changes to program or remote program can occur between the execution of MCPs.

By disabling I/O scans between MCPs, you can gain 2-3 ms of program-scan time per disabled I/O scan. The controller updates your I/O when it reaches the next I/O scan command, which can be: • an enabled I/O scan between MCPs, and/or • the end of a pass through the entire MCP list. The controller always performs an I/O scan after a pass through the MCP list. The follwing figure shows how the controller skips I/O scans and moves to the next MCP.

MCP A MCP B

MCP C MCP D

I/O image update and housekeeping

I/O image update and housekeeping

I/O pre-scan performed on transition from program to run mode

Publication 1785-UM012D-EN-P - July 2005

...

MCP xx MCP xx I/O image update and housekeeping

Important: Mode changes to program or remote program can occur between the execution of MCPs.

Page 255

Using Main Control Programs

16-3

If the MCP is a

The Following Occurs:

Ladder-logic program

1.All rungs are executed - from the first rung to the last, with all timers, counters, jumps, and subroutines active. 2.After the END instruction in the ladder program, the controller initiates an I/O update - reading local inputs, writing local outputs, reading remote buffers, and writing remote outputs to the buffer. 3.The controller starts the next MCP.

Structured-text program 1.Code is executed normally. 2.After the last instruction in the program, the controller initiates an I/O update. 3.The controller starts the next MCP. SFC

1.Only the active steps are scanned, and transitions from those active steps are examined. 2.After one complete pass through the active steps, the controller initiates an I/O update. 3.The controller starts the next MCP.

Configuring MCPs

You configure MCPs on the controller configuration screen in your programming software.

Publication 1785-UM012D-EN-P - July 2005

Page 256

16-4

Using Main Control Programs

In this Field

Do the Following

Status File

Program file

Specify the program file numbers for MCPs A-P and the order in which the S:80-S:127 MCPs should be run. This configuration is read before the MCP is executed; if you make a change to the configuration screen regarding an MCP, that change takes effect on the next execution of the MCP. You can change the MCP information on the Controller Configuration screen or through ladder logic. If you specify an MCP file that does not exist or is not a ladder-logic program, structured-text program, or SFC file, a major fault is logged in the status file. A minor fault is also logged if all MCP program files are set to zero. You can have the same program file number specified more than once as an MCP. For example, you may want a program to execute frequently and have a higher priority over other programs. If you do not want to use multiple main programs, program an SFC (program file 1), ladder-logic program (program file 2), or structured-text program (program file 2) and the controller will execute your main program. You do not need to make any entries on the Controllerr Configuration screen (the controller automatically enters the first configured program file number in the first MCP entry).

Disable

By setting or resetting the bit in these fields, you tell the controller to skip over S:79 the MCP until the bit is reset. If an MCP program file is inhibited, the controller skips the file and goes to the next program file. ATTENTION: If you disable an MCP, outputs remain in the state that they were in during the last scan (i.e., all actions remain active). Make sure that you consider any outputs that might be controlled within that MCP before disabling it. Otherwise, injury to personnel or damage to equipment may result. Disable an MCP if you temporarily want to hold a machine state, regardless of transitions (for example, in machine fault conditions). Disabling an MCP also can help improve scan time; if you know you don’t need to run one of your MCPs every scan, you can disable it until you need it. To set and reset the bits for Main Control Programs A-P, cursor to the appropriate field and type 1 to disable (skip) this MCP or 0 to enable (scan) this MCP. If the disable bit is set for all the MCP program files (which indicates that all control programs are to be skipped), a minor fault is logged in the controller status file.

Skip I/O update

A 1 in this field tells the controller to skip the I/O scan after this MCP. The default 0 tells the controller to perform the I/O scan after the corresponding MCP. To specify the I/O bit, cursor to the appropriate field and enter 0 or 1.

Publication 1785-UM012D-EN-P - July 2005

S:78

Page 257

Using Main Control Programs

IMPORTANT

Monitoring MCPs

16-5

If you plan to use SFC subcharts, make sure you define something for MCP A - even an empty ladder file is sufficient. If a MCP is undefined, the controller faults on the second SFC scan with major fault code 71 SFC subchart is already executing.

The program scan times for each MCP are stored in the controller status file, including the previous and maximum scan time. The status file also stores the cumulative scan time, S:8 (the scan time for one complete pass through all MCPs) and the maximum cumulative scan time, S:9.

Publication 1785-UM012D-EN-P - July 2005

Page 258

16-6

Using Main Control Programs

Notes

Publication 1785-UM012D-EN-P - July 2005