You are on page 1of 9

9/10/2017 Program Structure: High Level Program Layout Contact and Coil

Contact and Coil | Nearly In Control

RSLogix 5000 Tutorial
TwinCAT 3 Tutorial
Patterns of Ladder Logic Programming



A A+ A++

Sponsored Links

Research Smarter
Semantic Scholar is
improving the way
researchers nd
scienti c publications.


Home Automation
Industrial Automation


Arduino Ladder Logic
Beckhoff Open Source (GitHub)
Got TwinCAT (ru)
Harold On Controls
One Robotics Company Blog
SoapBox Automation 1/9
9/10/2017 Program Structure: High Level Program Layout Contact and Coil

SoapBox Core
TwinCAT 3.1 What's New


Log in
Entries RSS
Comments RSS

Program Structure: High Level Program Layout

This is part of an RSLogix 5000 Tutorial.

In a ControlLogix (or CompactLogix) processor, your logic is divided into tasks, which are then divided into
programs. These terms will be very familiar to you if you have a good understanding of real time operating systems, but
might be confusing to you if you just graduated from a SLC 500.

In this tutorial Im just going to setup something that mimics what youll be used to from the PLC/5 or SLC 500 world.
Well create one continuous task. There can only be one continuous task, and its the lowest priority task in the
controller. That means the motion, communications (with I/O, etc.), user defined periodic tasks and event tasks will all
preempt the continuous task when they run. The continuous task runs all of its programs, and then it starts again
(continuously, you might call it). Its quite normal to put most or all of your logic in the continuous task.

While I wont get into creating them here, periodic tasks are scheduled to run at a pre-defined period, such as every
100 ms. Event tasks are scheduled to run at specific times, like on startup.

When you look at your controller organizer tree, youll see a Tasks folder that looks like this by default:

RSLogix 5000 has already created a continuous task called MainTask for you. Note the little circular arrow on
MainTask that means its a continuous task. Inside MainTask, its created a program called MainProgram, and it has
one ladder logic routine called MainRoutine inside. It also has a place for program specific tags. These are tags that are
only visible to logic inside of this program.

Programs are the main way to organize your project on a macro level. If you were programming an assembly line with 5
cells, it would make sense to put the logic for each cell into its own program. Likewise, if you were just programming a
single cell with 5 stations, it would make sense to put each station into its own program. This is a decision you have to
make based on your own needs. Its also normal to move non-control logic, like communications, HMI interfacing,
mapping inputs, and mode selection into their own programs so they dont clutter the control logic.

Lets start by changing the name of MainProgram to our first program, MapInputs. Right click on the MainProgram
and select Properties from the context menu: 2/9
9/10/2017 Program Structure: High Level Program Layout Contact and Coil

That will display the Program Properties dialog box. You can edit the name here (highlighted below). Change it to
MapInputs, then click OK:

Once youve clicked OK, youll see the program name has changed in the controller organizer: 3/9
9/10/2017 Program Structure: High Level Program Layout Contact and Coil

Now we want to add the following other programs to this task: Faults, Global, and WashingMachine. Lets start
by adding Faults. Right click on MainTask, and click New Program:

That will display the New Program Dialog. Enter the name Faults in the Name field, and click OK:

Repeat the same process for two more new programs: Global and WashingMachine. When youve finished, you should
see this in your controller organizer: 4/9
9/10/2017 Program Structure: High Level Program Layout Contact and Coil

Thats all there is to adding programs. Id like to show you one more thing before we move on to laying out the routines:
you can rearrange the programs within a task, or even remove or add programs to a task. Start by right clicking in
MainTask in the controller organizer and clicking Properties:

That will open the Task Properties Dialog. Click on the Program/Phase Schedule tab (highlighted at the top of the image
below): 5/9
9/10/2017 Program Structure: High Level Program Layout Contact and Coil

The listbox on the right is the list of programs that are assigned to the task. You can select programs in this light and use
the Move up and down arrows (highlighted) to change the order in which the programs are executed inside this
continuous task. The programs will show up in the controller organizer in this same order (which is intuitive).

You can also remove programs from execution using the Remove button below the listbox. This is a useful feature, for
instance, if you want to disable execution of the MapInputs routine while youre bench-testing the program without real
I/O attached. Then you can just toggle your input bits and watch the program execute.

In the next part of the tutorial, were going to get into how to layout routines in a logical way within each program.

Wecon-PLC&HMI&IPC Automation - Global

Distributors Wanted
good Market and nancial support, better training products and solution



SE April 28, 2010 at 7:21 pm

Thank you. A++ info for experienced or beginner. 6/9
9/10/2017 Program Structure: High Level Program Layout Contact and Coil

Snehal September 27, 2010 at 3:22 am

Thanks a lot. Wonderful job

thanks a lot November 6, 2010 at 4:40 pm

good job

Marcos November 14, 2011 at 8:52 am

Excellent, continue

Korda Mentu March 26, 2012 at 5:16 pm

Event tasks are scheduled to run at specific times, like on startup.

Actually they are not scheduled at all. The trigger for an even task can be hardware driven or software driven with
no basis in time. Thats what the periodic tasks are for.

While an Event task can be made to run if configured for EVENT Instruction and then put on the end of a rung
with an XIC of the S:FS tag, this isnt typically done.

Frank March 12, 2013 at 9:09 pm

Wonderful and clear explanation! I will keep going on to learn. Thanks a lot!

Tejesh . G September 7, 2013 at 5:32 am

Dear sir,
Pls make a ladder diagram logic for high level controll in Rs Logix 5000 7/9
9/10/2017 Program Structure: High Level Program Layout Contact and Coil

When the High level input reaches then it should generate a output in Auto to close the gate.

CevinMoses March 30, 2015 at 10:41 am

I appreciate how a lot of this is not washing machine specific, but is more of a common layout for most
applications. Out of curiosity, what is the Global task used for?

Author comment by Scott Whitlock March 30, 2015 at 8:27 pm

@CevinMoses You are correct that this is a layout that supports a larger system. The CompactLogix processor
is actually quite capable of running a whole assembly cell, or even a small assembly line by itself. Typically an
automation cell will be broken into stations, possibly numbered in order, like Station 1, Station 2, or possibly by
operation like OP10, OP20, etc. You also might have more functional names like Load Station, Weld Station,
and Unload Station.

The idea of the Global program is to be a place to put stuff that affects the whole cell or whole line, such as
interfacing with the Controller real-time clock, interfacing with a cell safety system, or monitoring utilities such as
air, water, fuses, etc.

Leave a Reply
Name* Mail* (will not be published) Website
Your Comment

Submit Comment

Find it!

Search... Go 8/9
9/10/2017 Program Structure: High Level Program Layout Contact and Coil

Theme Design by

Tag Cloud

.net agile allen-bradley beckhoff complexity controlsoverload coordinated-motion copyright custom deep-
thoughts dry-principle estimation frustrations future g-scale garden-railroad helping hmi innovation internal-state
ladder-logic motion-control motivation plc productivity project-management quality review risk
rockwell-automation rslogix-5000 security sequencer shrinkwrap snap standards stuxnet troubleshooting tutorial
twincat vb6 vendors voting wiring x10

June 2017
April 2017
March 2017
February 2017
January 2017
April 2016
February 2016
January 2016
November 2015
October 2015
September 2015
May 2015

To top 9/9