Vous êtes sur la page 1sur 202

RSLogixt 5000

Level 2:
Basic Ladder Logic
Programming

Student Manual

Important User Information


This documentation, whether, illustrative, printed, online or electronic (hereinafter Documentation) is intended for
use only as a learning aid when using Rockwell Automation approved demonstration hardware, software and firmware.
The Documentation should only be used as a learning tool by qualified professionals.
The variety of uses for the hardware, software and firmware (hereinafter Products) described in this Documentation,
mandates that those responsible for the application and use of those Products must satisfy themselves that all necessary
steps have been taken to ensure that each application and actual use meets all performance and safety requirements,
including any applicable laws, regulations, codes and standards in addition to any applicable technical documents.
In no event will Rockwell Automation, Inc., or any of its affiliate or subsidiary companies (hereinafter Rockwell
Automation) be responsible or liable for any indirect or consequential damages resulting from the use or application of
the Products described in this Documentation. Rockwell Automation does not assume responsibility or liability for
damages of any kind based on the alleged use of, or reliance on, this Documentation.
No patent liability is assumed by Rockwell Automation with respect to use of information, circuits, equipment, or
software described in the Documentation.
Except as specifically agreed in writing as part of a maintenance or support contract, equipment users are responsible for:

properly using, calibrating, operating, monitoring and maintaining all Products consistent with all Rockwell
Automation or third--party provided instructions, warnings, recommendations and documentation;

ensuring that only properly trained personnel use, operate and maintain the Products at all times;
staying informed of all Product updates and alerts and implementing all updates and fixes; and
all other factors affecting the Products that are outside of the direct control of Rockwell Automation.
Reproduction of the contents of the Documentation, in whole or in part, without written permission of Rockwell
Automation is prohibited.
Throughout this manual we use the following notes to make you aware of safety considerations:
Identifies information about practices or circumstances
that can cause an explosion in a hazardous environment,
which may lead to personal injury or death, property
damage, or economic loss.

Identifies information that is critical for successful


application and understanding of the product.

Identifies information about practices or circumstances


that can lead to personal injury or death, property
damage, or economic loss. Attentions help you:
identify a hazard
avoid a hazard
recognize the consequence

Important User Information


Labels may be located on or inside the drive to alert
people that dangerous voltage may be present.

Labels may be located on or inside the drive to alert


people that surfaces may be dangerous temperatures.

Comment Form

Email: ratps@ra.rockwell.com
or Fax:

440.646.4425

Page 1 of
Date:

Contact Information:
Name:
Company and Location:
Phone:

Email:

Comments (include lesson title, if applicable):


Course or Product Name (Important):

Page 2

Table of Contents

Introduction
Course Overview
Course Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Who Should Attend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Agenda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Meeting Course Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Student Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Hands-On Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Certificate Candidates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configuration and Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ControlLogix/RSLogix 5000 Curriculum Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Application Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Drafting Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

I
I
II
II
II
III
III
III
III
IV
IV
V

Starting a Ladder Diagram for an RSLogix 5000 Project


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Project Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Divide a Project into Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Use IF - THEN Statements to Clarify Program Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . .
Use Non-Retentive Outputs When Possible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Non-Retentive Output Best Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Use Retentive Outputs When Possible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating a Subroutine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demonstration Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1--1
1--1
1--1
1--1
1--2
1--3
1--4
1--6
1--6
1--7
1--8
1--8

Exercise: Starting a Ladder Diagram for an RSLogix 5000 Project


Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1--9
1--11
1--11
1--13
1--13
1--15
1--16
1--16
1--16
1--16

ii

Table of Contents

Testing a Ladder Diagram in an RSLogix 5000 Project


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AFI (Always False) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AFI Instruction Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NOP (No Operation) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NOP Instruction Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MCR (Master Control Reset) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demonstration Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2--1
2--1
2--1
2--1
2--1
2--3
2--3
2--4
2--5
2--5

Exercise: Testing a Ladder Diagram in an RSLogix 5000 Project


Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2--7
2--8
2--9
2--9
2--9
2--11
2--12
2--12
2--12
2--14

Programming Timer Instructions in an RSLogix 5000 Project


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Timer Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Timer Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TON (Timer On Delay) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TOF (Timer Off Delay) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RTO (Retentive Timer On Delay) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RES (Reset) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demonstration Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3--1
3--1
3--1
3--1
3--2
3--2
3--3
3--4
3--5
3--6
3--6

Exercise: Programming Timer Instructions in an RSLogix 5000 Project


Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3--7
3--8
3--9
3--10
3--12
3--12
3--13

Table of Contents

iii

Programming Compare Instructions in an RSLogix 5000 Project


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Compare Instruction Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
EQU Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GEQ, GRT, LEQ, LES, and NEQ Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LIM Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demonstration Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4--1
4--1
4--1
4--1
4--2
4--3
4--3
4--6
4--6

Exercise: Programming Compare Instructions in an RSLogix 5000 Project


Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4--7
4--9
4--10
4--10

Programming Move Instructions in an RSLogix 5000 Project


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MOV (Move) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MOV Instructions with One-Shot Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CLR (Clear) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demonstration Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5--1
5--1
5--1
5--1
5--2
5--3
5--4
5--4

Exercise: Programming Move Instructions in an RSLogix 5000 Project


Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5--5
5--7
5--8
5--8

Programming Math Instructions in an RSLogix 5000 Project


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Math Instruction Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ADD (Add) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SUB (Subtract) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MUL (Multiply) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DIV (Divide) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MOD (Modulo) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NEG (Negate) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6--1
6--1
6--1
6--1
6--2
6--2
6--3
6--3
6--5
6--6

iv

Table of Contents

ABS (Absolute Value) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


SQR (Square Root) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Arithmetic Status Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demonstration Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6--6
6--7
6--7
6--7
6--8

Exercise: Programming Math Instructions in an RSLogix 5000 Project


Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6--9
6--11
6--12
6--12

Programming Counter Instructions in an RSLogix 5000 Project


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Counter Instruction Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Counter Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CTU (Count Up) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CTD (Count Down) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RES (Reset) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demonstration Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7--1
7--1
7--1
7--1
7--1
7--3
7--4
7--4
7--6
7--6

Exercise: Programming Counter Instructions in an RSLogix 5000 Project


Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7--7
7--8
7--9
7--10
7--12
7--12
7--13

Handling Expressions in an RSLogix 5000 Project


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMP (Compare) and CPT (Compute) Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMP (Compare) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CPT (Compute) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Expression Order of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demonstration Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8--1
8--1
8--1
8--1
8--1
8--3
8--4
8--4
8--4

Table of Contents

Exercise: Handling Expressions in an RSLogix 5000 Project


Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8--5
8--7
8--8
8--8

Documenting and Searching Ladder Logic Using RSLogix 5000 Software


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Documenting a Project Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Search Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Searching for and Replacing a Project Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Match Whole Word Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Searching by Cross-Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bookmark Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demonstration Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9--1
9--1
9--1
9--1
9--3
9--3
9--3
9--4
9--4
9--5
9--5

Exercise: Documenting and Searching Ladder Logic Using RSLogix 5000 Software
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9--7
9--9
9--10
9--10

Programming a Procedure in an RSLogix 5000 Project


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Overview of a Sequencer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example: Sequencer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Organizing Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example: Run Equipment While a Step Is Active . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example: Start Equipment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example: Wait for a Change in the Equipment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Identifying Transition Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example: Transition Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10--1
10--1
10--1
10--1
10--2
10--3
10--3
10--3
10--4
10--4
10--4
10--5

Exercise: Programming a Procedure in an RSLogix 5000 Project


Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10--7
10--9
10--10
10--10

vi

Table of Contents

Separating the Procedure from Equipment Control in an RSLogix 5000 Project


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Levels of Control Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Separate the Procedure from Equipment Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example: Separating the Procedure from Equipment Control . . . . . . . . . . . . . . . . . . . . . . . . .
Divide the Equipment into Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Identify the Command That You Must Give to a Section to Operate It . . . . . . . . . . . . . . . . . . . . . .
Identify the Status Information You Need to Operate a Section . . . . . . . . . . . . . . . . . . . . . . . . . .
Program the Equipment Control to Act on the Commands and Return the Status . . . . . . . . . . . . .
Set Up a Sequencer to Give the Commands and Read the Status . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demonstration Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11--1
11--1
11--1
11--1
11--2
11--2
11--3
11--4
11--4
11--5
11--6
11--7
11--8
11--8

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000


Project
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11--9
11--10
11--11
11--12
11--13
11--14
11--15
11--18
11--20
11--20
11--20
11--21
11--22

Copying and Filling an Array in an RSLogix 5000 Project


What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When You Will Do This . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating a Single Dimension Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example: Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Array Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Copy (COP) and File Fill (FLL) Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Heres How . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demonstration Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12--1
12--1
12--1
12--1
12--1
12--2
12--3
12--5
12--5

Table of Contents

vii

Exercise: Copying and Filling an Array in an RSLogix 5000 Project


Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Did You Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12--7
12--9
12--10
12--10

Appendices
I/O Wiring Diagrams
Slot 0 -- 1756-OB16D Digital Output Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Slot 2 -- 1756-IB16D Digital Input Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Slot 4 -- 1756-OB16D Output Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Slot 7 -- 1756-OF6VI Analog Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Slot 8 -- 1756-IF6VI Analog Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

A--1
A--2
A--3
A--4
A--5

ControlLogix Workstation I/O Device Assignments


Local I/O Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

B--2

viii

Table of Contents

Course Overview

Course Overview

Course Purpose

This course is a skill-building course that provides you with a basic


understanding of RSLogix 5000 ladder logic instructions and
terminology. This course also provides you with the resources and
hands-on practice required to program basic ladder logic instructions
for any Logix5000 controller.
You will have an opportunity to use RSLogix 5000 software to
perform basic software tasks to meet the requirements of a given
functional specification. In addition to using ladder logic, you will be
introduced to ladder logic techniques, established standards, and
common rules for programming ladder logic.
Reference: All Logix5000 systems use the same control engine;
therefore, tasks are similar. You will see applicable references for
other systems.

Who Should Attend

Programmers who have little or no working experience with


controllers and are responsible for programming Logix5000
controllers using RSLogix 5000 software, and who need to learn
how to draft ladder logic for any application should attend this
course.
Activity: Introduce yourself, say the company you work for, and tell
the instructor and others what you hope to take away from this
course.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


Ovwsb56r

II

Course Overview

Prerequisites

To successfully complete this course, the following prerequisites are


required:
Completion of the RSLogix 5000 Level 1: ControlLogix System
Fundamentals course (Course No. CCP146) or equivalent
experience

Ability to perform basic Microsoft Windows tasks:


-- Use a mouse
-- Browse for files
-- Open, close, size, and move windows
Question: Is everyone comfortable with these skills?

Agenda

This course consists of the following lessons:


Day 1

Starting a Ladder Diagram


Testing a Ladder Diagram
Programming Timer Instructions
Programming Compare Instructions
Programming Move Instructions
Programming Math Instructions

Day 2

Programming Counter Instructions


Handling Expressions in an RSLogix 5000 Project
Documenting and Searching Ladder Logic Using RSLogix 5000
Software

Programming a Procedure
Separating the Procedure from Equipment Control
Copying and Filling an Array

Meeting Course Objectives

The following course structure is generally used to help you


understand the content and activities:
One lesson is devoted to each task.

Typical lesson includes most or all of these sections:


-- What You Will Learn -- lesson objectives
-- Before You Begin -- preparatory material
-- Heres How -- demonstration of procedures
-- Exercise -- opportunity to perform new skills, often in a
hands-on lab environment
-- How Did You Do? -- where to go for feedback on
performance
-- Answers -- answers to exercises
E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


Overview

Course Overview

Student Materials

III

To enhance and facilitate your learning experience, the following


materials are provided as part of the course package:
Student Manual:
-- Contains the topical outlines and exercises
-- Used to follow presentations, take notes, and work through
exercises
RSLogix 5000 and Logix5000 Procedures Guide:

-- Provides the steps required to complete basic RSLogix 5000


software tasks that are common to all Logix5000 hardware
platforms
Logix5000 Documentation Reference Guide:

-- Provides a searchable, electronic resource


-- Contains frequently referenced technical documentation
Reference: Your instructor will show you these job aids now.

Hands-On Exercises

Throughout this course, you will have the opportunity to practice the
skills you have learned through a variety of hands-on exercises:
Exercises focus on the skills introduced in each lesson.

Exercises are performed on a ControlLogix workstation:


-- The skills taught in this course can be applied to all
Logix5000 platforms.
-- You can perform these tasks on the specific platform used in
your plant.

Certificate Candidates

If you are a candidate for a Certificate Exam, you must:


Take notes

Ask questions for clarification


Follow along with demonstrations using the job aids
Complete all labs

Tip "

The Certificate Exam questions are scenario-- based and may require
you to understand information from all of these areas.
To study for the exam, you must keep all class materials and your
written notes.

Configuration and
Programming Examples

The configuration and programming examples shown in this course


are intended solely for purposes of example.
You will have different requirements associated with your
application. You must verify that the necessary steps have been
taken to meet all performance and safety requirements.
Reference: See the Important User Information in your Student
Manual for more details.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


Ovwsb56r

IV

Course Overview

ControlLogix/RSLogix
5000 Curriculum Map

After completing this training, you may be interested in one or more


of the following courses:
RSLogix Level 3: Project Development [CCP143, 4 days]
DeviceNet and RSNetWorx Configuration and Troubleshooting
[CCP164, 3 days]
ControlNet and RSNetWorx Configuration and Troubleshooting
[CCP173, 3 days]
Reference: See the curriculum map in the front of your Student
Manual for a complete listing of available ControlLogix/RSLogix
5000 courses.

Application Overview

To gain real-world programming experience, you will be given a


functional specification for a fictitious iron process. You will use the
specification for many of the hands-on exercises and test it using a
hardware workstation.

Skip Car

Coke Loaded on
the Conveyor

Raw Material
Loaded in the
Blast Furnace

Blast Furnace
Coke and Other
Raw Material
Loaded in the
Scale Car
Conveyor Taking
Coke to Stockhouse

Iron
Trough

Scale Readout
Molten Iron
Hot Metal Car

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


Overview

Course Overview

The following lists steps in the iron process:


Coke is the main ingredient in the iron making process. A
conveyor transfers it from the coke station to the stockhouse.
The stockhouse is where all raw material for the iron making
process is segregated in storage bins and stored until it is
transferred to the furnace top.
The raw material is accurately weighed by a scale car and then
delivered to the furnace top by a skip car using a pulley system.
The molten iron is unloaded (tapped) from the furnace bottom,
channeled through an iron trough, and loaded into a
refractory-lined railroad car (hot metal car) for transportation to
the steel-making facility.

Drafting Practices
There are many correct ways to program ladder logic:
Your answer may be different from the provided example.

Your answer may be different from those written by other


students.

If your ladder logic project meets the requirements of the


functional specification, it will be considered correct.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


Ovwsb56r

VI

Course Overview

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


Overview

Lesson

Starting a Ladder Diagram for an


RSLogix 5000 Project
What You Will Learn

After completing this lesson, you should be able to:


Understand project organization
Divide a project into subroutines

Use IF -- THEN statements to clarify program requirements


Use non-retentive and retentive outputs when possible
Create subroutines
When You Will Do This
You will perform these tasks in the following situations:
Create ladder logic structure that is easier to read

Logically organize a project that facilitates troubleshooting


Code a program that incorporates efficient scan time

Before You Begin

Project Organization
These containers are available to organize an RSLogix 5000 project:
Task: Provides scheduling and priority information for a set of
one or more programs.

Tag: An area of controller memory where data from I/O devices,


messages, networking, faults, etc., is stored.
Program: A set of related routines and tags.
Mention that each routine uses a
specific programming language, such as
ladder logic, function block diagram,
sequential function chart, or structured
text.

Routine: A set or sequence of executable code.


-- MainRoutine: Executes automatically when the controller

Tell the students that the MainRoutine


executes first in a program.

By default, there is one main task, program, and routine created in


each new project:

triggers the associated task and program.

Automatically Created by Default.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


STLsb56r

1--2

Starting a Ladder Diagram for an RSLogix 5000 Project

Divide a Project into Subroutines


Subroutine: A routine that is called by another routine:
Is called by a JSR (Jump to Subroutine) instruction in the main
routine or another subroutine (conditioned or unconditioned)

Returns to the other routine when complete or if a condition is


met

Subroutines

Discuss why it is important to divide a


project into subroutines.

Guideline

Use a subroutine for each section of equipment that


does a relatively independent activity.

Suppose the packaging section of a plant uses three stations to finish


the packaging of its product, like this:
Station 2: Close the
Flaps of the Box

Station 1: Fill the Box


with Packing Material

Station 3: Tape the Box

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


STLsb56r

Starting a Ladder Diagram for an RSLogix 5000 Project

1--3

In that case, use a separate subroutine for each station:


Closure Routine

Filler Routine

Taper Routine

Use IF - THEN Statements to Clarify Program Requirements


Before you program a routine in the software, clarify its
requirements on paper. One way to do that is to write the
requirements as IF THEN statements. Each statement becomes a
rung of the routine.

Mention that OSHA requires that


normally-closed Stop contactors should
be used, which would then change this
comparison to = on. Our classroom
demos do not have normally closed
pushbuttons to use for Stop.
Condition to
check

Action to take

IF Part_detection_photoeye = on THEN Air_valve = on

Use AND & OR for


multiple conditions

Use =, <, and > symbols for states


and values

IF Start_pushbutton = on AND Stop_pushbutton = off THEN Water_pump = on


Use parentheses for clarity

IF (Start_pushbutton = on OR jog_pushbutton = on) AND Stop_pushbutton = off


THEN Conveyor_motor = on

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


STLsb56r

1--4

Starting a Ladder Diagram for an RSLogix 5000 Project

Activity: As a group, determine which of the IF -- THEN


statements would work for the following applications:

Answer: IF Low Level switch = on OR


Fill Valve = on) AND High Level switch =
off THEN fill Valve = on

Answer: IF Furnace Temperature is


>100 OR (IF High Temperature alarm
light = on AND Alarm Acknowledge =
off) THEN High Temperature alarm light
= on

An operator tells you that you need to fill a tank if the Low Level
switch is on. Once the tank starts filling, the low level switch will
turn off but the tank needs to continue to fill until a High Level
switch closes.

IF Low Level switch = on THEN Fill valve = on

If Low Level switch = on AND High Level switch = off


THEN Fill valve

IF Low Level switch = on OR Fill Valve = on) AND High


Level switch = off THEN fill Valve = on

An application requires that you turn on a High Temperature alarm


light if the temperature in a furnace goes above 100 degrees. Once
the alarm is turned on, it must stay on until an Alarm Acknowledge
pushbutton is closed.

IF Furnace Temperature is > 100 OR (IF High Temperature


alarm light = on AND Alarm Acknowledge = off) THEN High
Temperature alarm light = on

(IF Furnace Temperature is < 100 OR IF alarm light = on)


AND Alarm Acknowledge = off THEN High Temperature
alarm light = on

If Furnace Temperature > 100 THEN High Temperature alarm


light = on

If Alarm Acknowledge pushbutton = on THEN High


Temperature alarm light = off

Use Non-Retentive Outputs When Possible


Prescan: A special scan of all the routines in the controller:
The controller does a prescan when it changes from Program
mode to Run mode or powers up directly into Run mode.

During the prescan, the controller executes all instructions in

prescan mode. The prescan initializes the instruction and data and
prepares it for normal execution.

Non-Retentive Output Instruction: An output instruction that


automatically resets its data when either of the following conditions
occur:
The controller goes to Run mode or powers up in Run mode
(prescan).

The rung goes false.


E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


STLsb56r

Starting a Ladder Diagram for an RSLogix 5000 Project

1--5

The Output Energize (OTE) instruction is a non-retentive output


instruction:

The bit turns off after a power


cycle.
The bit turns off if the rung
goes false.
The bit turns on if the rung
goes true.

Explain that this is an example of logic


with a feedback seal-in. It is better to
use both logic (output instruction tag)
and hard-wired sensor input whenever
available.

Seal-in logic is a way to keep a non-retentive output on even if initial


conditions go false. You use at least two conditions to control the
output:
One condition starts (turns on) the output.
Another condition stops (turns off) the output.

Activity: As a group, determine the following using the graphic


above:

Rev. June 2012

Which condition creates the seal-in and which condition(s)


activate the output?

What happens if the output is on and you change from Run


mode to Program mode and then back to Run mode?

E 2012 Rockwell Automation, Inc. All rights reserved.


STLsb56r

1--6

Starting a Ladder Diagram for an RSLogix 5000 Project

Non-Retentive Output Best Practices


A best practice is to use non-retentive outputs instead of retentive
outputs when possible. Non-retentive outputs have several
advantages:
The logic is easier to read. All the conditions for the output are on
one rung. You do not have to look somewhere else to see the
conditions that turn off the output.
The logic is easier to debug and troubleshoot. When you latch an
output, it stays on even after conditions go false. Because of this,
it takes longer to find and fix problems with the logic.
The output is automatically reset to a safe state during start-up or
power loss. We have assumed that off is the safe state for the
output.

Use Retentive Outputs When Possible


Retentive Output Instruction: An output instruction that keeps its
data value during a power loss, during a change to Run mode, or
when the rung goes false.
Require additional logic to reset.
Can be reset by using S:FS (Status First Scan BOOL) logic.
The Output Latch (OTL) instruction is a retentive output instruction.
It typically requires an Output Unlatch (OTU) instruction to reset it:

The bit does not change after a


power cycle.
The bit does not change if the
rung goes false.
The bit turns on if the rung
goes true.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


STLsb56r

Starting a Ladder Diagram for an RSLogix 5000 Project

1--7

Creating a Subroutine
Explain that the easiest way to call a
subroutine is to call it all the time without
any conditions.

Use a Jump To Subroutine (JSR) instruction to execute or call a


subroutine. There are two ways to call a subroutine:
Conditional: JSRs have input logic that must be met before the
ladder code in the subroutine is scanned.
Unconditional: JSRs have no input logic and are always scanned
while the processor is running.

Conditional JSR

Unconditional JSR

In controlling any output instruction, there needs


to be a correctly addressed output instruction in
the ladder logic and the controller must scan its
logic.
Placing code in a conditional subroutine means
the subroutines ladder logic is only scanned when
the JSRs input conditions are met.

Mention that multiple JSRs on a rung


conserves controller memory, saves time
during documentation and saves on
rungs.

Rev. June 2012

There are two different styles for programming JSRs:


One JSR per rung or
Multiple JSRs on a rung

E 2012 Rockwell Automation, Inc. All rights reserved.


STLsb56r

1--8

Starting a Ladder Diagram for an RSLogix 5000 Project

Heres How
IMPORTANT: To meet IACET CEU
requirements and fully prepare
certificate students for the final exam,
you must demonstrate all lesson
objectives using the proper job aids.

To perform the following tasks:


Understand project organization
Divide a project into subroutines

Use IF -- THEN statements to clarify program requirements


Use non-retentive and retentive outputs when possible
Create subroutines
Activity: As your instructor demonstrates these procedures, follow
along.

Demonstration Checklist
Use the steps below and the information
on the Demonstration Checklist to help
guide you during the demonstration:
1. Use STL_1756R_DEM1.acd for the
demonstration.
2. Create the subroutine and enter a
JSR instruction to call the routine.

Pay attention to these critical aspects of the demonstration:


-

Did your instructor point out the project components in


the Controller Organizer?

Why would you want to use a retentive output


instruction?

What are the advantages of using non-retentive outputs?

Did your instructor show you the following?


- Where to create a subroutine
- Which instruction calls the subroutine
- How to get help for an instruction

3. Show pressing F1 for help with an


instruction.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


STLsb56r

Exercise: Starting a Ladder Diagram for an RSLogix 5000 Project

1--9

Exercise: Starting a Ladder


Diagram for an RSLogix 5000
Project
Exercise A

Practice dividing a project into subroutines.


Before you get started, watch the animated simulation of the iron
process:
1. Open the CCP151_1756R_DEM1.exe file.
2. Click Start in the lower-left corner of the window.
Turn the page to start the exercise.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


STLe56R

1--10

Exercise: Starting a Ladder Diagram for an RSLogix 5000 Project

Context:
You are responsible for programming the materials delivery
equipment of the iron process:

Coke Conveyor
Stockhouse
Scale
Scale Car

Skip Car

Part

Description

Coke Conveyor

Coke is one of the materials in the iron process. A coke


conveyor automatically refills the stockhouse when coke is
low. A separate conveyor refills the stockhouse with iron
pellets.

Stockhouse

The stockhouse stores coke and iron pellets for the


furnace. When the furnace needs materials, the
stockhouse fills a scale car with a specific weight of coke
and iron pellets.

Scale

A scale measures the weight of the scale car.

Scale Car

When the scale car reaches the target weight, it moves the
materials to a skip car and dumps them in. Then it returns
to the stockhouse for more materials.

Skip Car

The skip car lifts the materials to the furnace and dumps
them in.

Directions:
1. How many subroutines would you likely use?

E 2012 Rockwell Automation, Inc. All rights reserved.

1
2
3
4
5
6
Rev. June 2012
STLe56R

Exercise: Starting a Ladder Diagram for an RSLogix 5000 Project

1--11

2. Write a name for each subroutine in the following table, and then
write a brief description of what the subroutine does. You do not
need to complete all the rows:
Routine Name

Description

How Did You Do?

Turn to the Answers section.

Exercise B

Practice using IF -- THEN statement:


1. Is this statement OK:
IF Limit_switch THEN Motor

OK
Not OK

If Not OK, what is missing:

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


STLe56R

1--12

Exercise: Starting a Ladder Diagram for an RSLogix 5000 Project

2. Is this statement OK:


IF Part_count < 5 OR Override_pushbutton = on
AND System_OK bit = on THEN Pusher_valve = on

OK
Not OK

If Not OK, what is missing:

3. Is this statement OK:


IF Motor 5 = on and Aux_Contact = on THEN Running_light =
on

OK
Not OK

If Not OK, what is missing:

4. Write this requirement as an IF THEN statement:


The gate that feeds coke turns on (opens) when a photoeye
detects a car in the loading position. The scale weight also needs
to be less than 2.5 K for the gate to turn on and stay on. The gate
that feeds iron pellets also needs to turn on (open) under those
conditions.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


STLe56R

Exercise: Starting a Ladder Diagram for an RSLogix 5000 Project

1--13

5. Write this requirement as an IF THEN statement:


A low-level photoeye turns on when material in a hopper is low.
At that point, a filler conveyor needs to turn on and refill the
hopper. When the hopper is full, a high-level photoeye turns on.
The filler conveyor must not fill the hopper past that point.

How Did You Do?

Turn to the Answers section.

Exercise C

In this exercise, you practice programming some of the equipment of


the iron process using non-retentive outputs.
Use these workstation devices to represent the equipment of the iron
process:
Coke_High

Pellet_Gate_Out

Coke_Conveyor_Out

Start
System_Command
Coke_Gate_Out
Stop
Coke_Low

Car_Position

Weight_Target

When you see underlined text, refer to the related procedure or


information in your job aid.
Directions:
1. Open the STL_1756R_C1.acd project file.
The project already has the I/O modules that you need.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


STLe56R

1--14

Exercise: Starting a Ladder Diagram for an RSLogix 5000 Project

2. Create the required routines:


- Coke_Conveyor
- Stockhouse
- Skip_Car
3. Create the following tags as program-scoped tags:
Tag Name

Alias For

Workstation Device

Start

Local:2:I.Data.0

DI0

Coke_High

Local:2:I.Data.1

DI1

Stop

Local:2:I.Data.8

DI8

Coke_Low

Local:2:I.Data.9

DI9

Car_Position

Local:2:I.Data.12

DI12

Weight_Target

Local:2:I.Data.13

DI13

System_Command

Local:0:O.Data.0

DO0

Coke_Gate_Out

Local:0:O.Data.1

DO1

Coke_Conveyor_Out

Local:0:O.Data.3

DO3

Pellet_Gate_Out

Local:0:O.Data.4

DO4

MainRoutine
4. Program the MainRoutine to meet these requirements:

Unconditionally calls all the subroutines of the program.


Turns on the System_Command light to show that the system
is on. The light:

- Turns on when you press the Start pushbutton.


- Stays on even after the Start pushbutton turns off.
- Turns off when the Stop pushbutton turns on.
Coke_Conveyor Routine
5. Program the Coke_Conveyor routine to meet these requirements:

E 2012 Rockwell Automation, Inc. All rights reserved.

Turns on the Coke_Conveyor output whenever coke gets low


in the stockhouse. The Coke_Conveyor output:
Turns on only if the System_Command light is on.
Turns on when the Coke_Low limit switch is on.
Stays on even after the Coke_Low limit switch turns off.
Turns off when the Coke_High limit switch turns on.

Rev. June 2012


STLe56R

Exercise: Starting a Ladder Diagram for an RSLogix 5000 Project

1--15

Stockhouse Routine
6. Program the Stockhouse routine to meet these requirements:

Coke_Gate and Pellet_Gate are on (open) when all of these


conditions are true:

- The Car_Position photoeye is on, which means the scale car is


in position for loading.
- The Weight_Target input is off, which means the scale is not
filled to the target weight.
- The System_Command light is on.
7. Save your project.
8. Download the project to slot 1 of your workstation.
9. Test the project and make sure it meets all the requirements.
Check off each requirement once it is met.

How Did You Do?

Rev. June 2012

Turn to the Answers section.

E 2012 Rockwell Automation, Inc. All rights reserved.


STLe56R

1--16

Exercise: Starting a Ladder Diagram for an RSLogix 5000 Project

Answers

Exercise A
1. Three:

-- Coke conveyor: It runs or stops independent from the


operation of the cokehouse.
-- Stockhouse: We considered the weighing and transporting
of materials as one activity. You could have broken them
out into separate activities (subroutines).
-- Skip car: It runs relatively independent from the operation
of the other equipment.
2. These routines would serve as a good starting point:
Routine Name

Description

Coke_Conveyor

Refills the stockhouse with coke whenever it gets


low.

Stockhouse

Measures set weights of coke and iron pellets and


delivers them to the skip car.

Skip_Car

Delivers coke and iron pellets to top of the furnace.

Exercise B
1. Not OK. It needs the states of the limit switch and motor.
2. OK.
3. OK.
4. IF Car position photoeye = On and Scale weight < 2.5 K THEN
Coke gate = On AND Pellet gate = On
5. IF (Low level photoeye = On OR Filler_Conveyor = On) AND
High level photoeye = Off THEN Filler_Conveyor = On

Exercise C
2. The following graphic shows the routines in the Controller
Organizer:

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


STLe56R

Exercise: Starting a Ladder Diagram for an RSLogix 5000 Project

1--17

4. The following graphic shows one way to program the


MainRoutine:

Rev. June 2012

Rung 0

Calls the Coke_Conveyor routine all the time.

Rung 1

Calls the Stockhouse routine all the time.

Rung 2

Calls the Skip_Car routine all the time.

Rung 3

Uses seal-in logic to turn on the System_Command output. Start


turns on the output. The output seals in Start. Stop turns off the
output.

E 2012 Rockwell Automation, Inc. All rights reserved.


STLe56R

1--18

Exercise: Starting a Ladder Diagram for an RSLogix 5000 Project

5. The following graphic shows one way to program the


Coke_Conveyor routine:

Rung 0

Coke_Conveyor_Out is the output bit that turns on the conveyor.


The rung uses seal-in logic. The Coke_Low limit switch is the
start input. The Coke_High limit switch is the stop input. The
conveyor keeps running even after the coke level goes above the
Coke_Low limit switch and the switch turns off.
6. The following graphic shows one way to program the
Stockhouse routine:

Rung 0

E 2012 Rockwell Automation, Inc. All rights reserved.

When all three conditions are true, both gates turn on (open) and
start filling coke and pellets.

Rev. June 2012


STLe56R

Lesson

Testing a Ladder Diagram in an


RSLogix 5000 Project
What You Will Learn

After completing this lesson, you should be able to:


Program an AFI (Always False) instruction
Program a NOP (No Operation) instruction

Program a MCR (Master Control Reset) instruction


When You Will Do This
You will perform these tasks in the following situations:
Isolate your tests to specific sections of code or specific
equipment
Test possible causes of a problem to isolate the root cause

Divide a routine into areas of modal need


Disable sections of code based on process/machine conditions

Before You Begin

AFI (Always False) Instruction


An AFI instruction forces a rung false regardless of input conditions.
Use it as a temporary instruction while you test and debug your
code.

Mention that after machine or process


field modifications certain rungs may no
longer apply and AFI instructions may
have been left in.

Make sure to remove the AFI instructions from


your code when you are done testing. Otherwise,
the controller will not respond to its programmed
input conditions.

AFI Instruction Examples


To use an AFI instruction to disable one output in a rung, place the
instruction in front of the output you want to disable.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


TSTsb56r

2--2

Testing a Ladder Diagram in an RSLogix 5000 Project

To use an AFI instruction to disable a rung to prevent an output from


turning on, place the instruction in the main path.

When the instruction is placed in the rung first, the controller will
solve this rung faster.
To use an AFI instruction to disable a path on a rung, place the
instruction in the path you want to disable.

Use the steps below to help guide


you during the demonstration:
1. Use the TST_1756R_DEM1.acd
file for your demonstration.
2. Show how the code executes. Now
add the AFI instruction before the
instructions on rung 2. Execute the
code.
3. Explain that if simply disabling a
rung, place the AFI instruction at the
beginning of the rung.

Activity: As your instructor demonstrates, notice the key points:

Where you place the AFI instruction?

What is the last thing to do when you are done testing?

What happens to the outputs on the rung with the AFI


instruction?

4. Now place the AFI instruction before


the Pump_01 output.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


TSTsb56r

Testing a Ladder Diagram in an RSLogix 5000 Project

2--3

NOP (No Operation) Instruction


A NOP instruction functions as a placeholder. It can be placed
anywhere on a rung. When enabled, it performs no operation. When
disabled, it performs no operation.
NOP Instruction Examples
A NOP instruction can be used to describe a section of code or add
additional comments to a project file.

Mention that the fault logic could be


spread all throughout a project.

A NOP instruction can be used to create a diagnostic rung. This rung


is usually at the beginning of a routine and is used to determine if
any fault bits are set.

Mention that a cross-reference search


will be covered in a later lesson.

This rung can show which fault bits have been set. From here, you
can perform a cross-reference search to quickly go to the fault.

Use the steps below to help guide


you during the demonstration:

Activity: As your instructor demonstrates, notice the key points:

1. On rung 1, add the NOP instruction


on a branch under On. Execute the
code.
2. Point out that the use of an NOP
instruction is highly recommended
because it is easy to search for.
3. Explain that the NOP instruction only
flags the shorted input branch leg
used to bypass On.

Rev. June 2012

Where you place the NOP instruction?

What is the last thing to do when you are done testing?

What happens to the outputs on the rung with the NOP


instruction?

E 2012 Rockwell Automation, Inc. All rights reserved.


TSTsb56r

2--4

Testing a Ladder Diagram in an RSLogix 5000 Project

MCR (Master Control Reset) Instruction


A pair of MCR instructions are useful when disabling multiple rungs
of important code.
Use a MCR instruction as a critical means of disabling process or
machine code during operational phases of a project.

Use the steps below to help guide


you during the demonstration:
1. On rung 1, add the MCR instruction
on a branch under the On OTE.
2. Add the second MCR instruction on
rung 3.
3. Mention that some paper mills use
MCR zones.

E 2012 Rockwell Automation, Inc. All rights reserved.

Activity: As your instructor demonstrates, notice the key points:

Where you place the MCR instruction?

What is the last thing to do when you are done testing?

What happens to the outputs on the rung with the MCR


instruction?

Rev. June 2012


TSTsb56r

Testing a Ladder Diagram in an RSLogix 5000 Project

Heres How
IMPORTANT: To meet IACET CEU
requirements and fully prepare
certificate students for the final exam,
you must demonstrate all lesson
objectives using the proper job aids.

2--5

To perform the following tasks:


Program an AFI (Always False) instruction
Program a NOP (No Operation) instruction

Program a MCR (Master Control Reset) instruction

Demonstration Checklist
You should have already demonstrated
the AFI, NOP, and MCR instructions.

Pay attention to these critical aspects of the demonstration:

Rev. June 2012

Did your instructor explain why it is important to remove


AFI, NOP, or MCR instructions after you have completed
testing your project?

Did your instructor show you the following?


- Where to create a(n) AFI, NOP, or MCR instruction
- How to create a(n) AFI, NOP, or MCR instruction
- How to get help for an instruction

E 2012 Rockwell Automation, Inc. All rights reserved.


TSTsb56r

2--6

Testing a Ladder Diagram in an RSLogix 5000 Project

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


TSTsb56r

Exercise: Testing a Ladder Diagram in an RSLogix 5000 Project

2--7

Exercise: Testing a Ladder Diagram


in an RSLogix 5000 Project
Exercise A

Practice using AFI instructions to test sections of a simulated iron


process.
Before you get started, watch the animated simulation of the iron
process:
1. Open the CCP151_1756R_DEM1.exe file.
2. Click Start in the lower-left corner of the window.
Use these workstation devices to represent the equipment of the iron
process:
Coke_High

Pellet_Gate_Out

Coke_Conveyor_Out

Start
System_Command
Coke_Gate_Out
Stop
Coke_Low

Car_Position

Weight_Target

When you see underlined text, refer to the related procedure or


information in your job aid.
Directions:
1. Open the TST_1756R_A1.acd project file.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


TSTe56r

2--8

Exercise: Testing a Ladder Diagram in an RSLogix 5000 Project

2. Verify that the following tags are in the Main Program Scoped
Tags list:
Tag Name

Alias For

Workstation Device

Start

Local:2:I.Data.0

DI0

Coke_High

Local:2:I.Data.1

DI1

Stop

Local:2:I.Data.8

DI8

Coke_Low

Local:2:I.Data.9

DI9

Car_Position

Local:2:I.Data.12

DI12

Weight_Target

Local:2:I.Data.13

DI13

System_Command

Local:0:O.Data.0

DO0

Coke_Gate_Out

Local:0:O.Data.1

DO1

Coke_Conveyor_Out

Local:0:O.Data.3

DO3

Pellet_Gate_Out

Local:0:O.Data.4

DO4

3. Suppose you do not want the coke conveyor to run when you
turn on the system (System_Command = On). Place an AFI
instruction so that it disables all the coke conveyor logic.
4. Suppose you want to test the scale car without filling it with
material. Place an AFI instruction so that it prevents the coke or
pellet gates of the stockhouse from turning on. Make sure the AFI
instruction does not disable the execution of the stockhouse
routine.
5. Download the project to slot 1 of your workstation.
6. Put the controller in Run mode.
7. Press the Start pushbutton and make sure that the
System_Command light turns on.
8. Open the Coke_Conveyor routine.
9. Use the workstation devices and try to turn on
Coke_Conveyor_Out. Can you turn it on?

10. Open the Stockhouse routine.


11. Use the workstation devices and try to turn on the coke and pellet
gates. Can you turn them on?

12. Remove all the AFI instructions from the project.


13. Save the project and close RSLogix 5000 software.

How Did You Do?


E 2012 Rockwell Automation, Inc. All rights reserved.

Turn to the Answers section.


Rev. June 2012
TSTe56r

Exercise: Testing a Ladder Diagram in an RSLogix 5000 Project

Exercise B

2--9

Practice using NOP instructions to test sections of a simulated iron


process.
When you see underlined text, refer to the related procedure or
information in your job aid.
Directions:
1. Open the TST_1756R_B1.acd project file.
2. Suppose you want only the Stockhouse to run without the System
Command (no Start command). Modify the program to manually
move the car into position and observe the reaction of the system
to see if it will stop filling when its target weight is reached.
3. Download the project to slot 1 of your workstation.
4. Put the controller in Run mode.
5. Open the Stockhouse routine.
6. Observe the Coke_Gate_Out and Pellet_Gate_Out outputs on the
workstation. What state are they in?

7. Use the workstation and try to turn off the Coke_Gate_Out and
Pellet_Gate_Out outputs. Can you turn the outputs off?

8. Remove the NOP instruction from the project.


9. Save the project and close RSLogix 5000 software.

How Did You Do?

Turn to the Answers section.

Exercise C

Practice using MCR instructions to disable sections of a simulated


iron process.
When you see underlined text, refer to the related procedure or
information in your job aid.
Directions:
1. Open the TST_1756R_C1.acd project file.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


TSTe56r

2--10

Exercise: Testing a Ladder Diagram in an RSLogix 5000 Project

2. Suppose you want to hold all outputs in the Coke_Conveyor and


Stockhouse subroutines in an off state while the system is idle
(System_Command = low = 0). This helps with safety as it
assures the Start pushbutton must be made before the controller
can turn on any non-retentive outputs.
Hint: We first create a zone of consecutive rungs of ladder by
moving the rungs from the Coke_Conveyor and Stockhouse
subroutines to the MainRoutine. This has already been done for
you.
3. Program two MCR instructions to define the zone disabling all
outputs until the Start pushbutton is pressed.
4. Download the project to slot 1 of your workstation.
5. Put the controller in Run mode.
6. Open the MainRoutine. On the workstation, press the Start
pushbutton and operate the system to see if it runs normally. Does
the system run as expected?

7. Press the Stop pushbutton.


8. Go offline.
9. In the MainRoutine, place an NOP branch around the Coke_Low
and Coke_High input instructions. Place a second NOP branch
around the Car_Position and Weight_Target input instructions.
10. Download the project and put the controller in Run mode.
11. Observe the Coke_Conveyor_Out, Coke_Gate_Out, and
Pellet_Gate_Out outputs on the workstation. What are the states
of the outputs when Command_System is on, and why are they
reacting this way?

12. Observe the same three outputs on the workstation. What are the
states of the outputs when System_Command is off, and why are
they reacting this way?

13. Go offline.
14. Remove all NOP and MCR instructions from the project.
E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


TSTe56r

Exercise: Testing a Ladder Diagram in an RSLogix 5000 Project

2--11

15. Save the project and close RSLogix 5000 software.

How Did You Do?

Rev. June 2012

Turn to the Answers section.

E 2012 Rockwell Automation, Inc. All rights reserved.


TSTe56r

2--12

Exercise: Testing a Ladder Diagram in an RSLogix 5000 Project

Answers

Exercise A
3. Place the AFI instruction in front of the JSR instruction that
calls the routine. This prevents the controller from calling the
routine.

4. Place the AFI instruction in front of the rung that turns on the
gates. This keeps the rung always false and the gates always off
(closed).

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


TSTe56r

Exercise: Testing a Ladder Diagram in an RSLogix 5000 Project

2--13

9. The output should stay off even with Coke_Low = On,


Coke_High = Off, and System_Command = On.
11. The outputs should stay off even with Car_Position = On,
Weight_Target = Off, and System_Command = On.

Exercise B
2. Place a branch around System_Command on the rung that
controls Coke_Gate_Out and Pellet_Gate_Out. Then place an
NOP instruction on that branch.
This will command Coke_Gate_Out and Pellet_Gate_Out to
open (turn ON) when a car is in place until the target weight is
reached. After the weight is reached, Coke_Gate_Out and
Pellet_Gate_Out will both close (turn OFF).

6. Both Coke_Gate_Out and Pellet_Gate_Out are on when the car


is in place and the target weight has not been reached. They
both turn OFF when the target weight is reached.
7. No, the Stop and Start buttons no longer control
Coke_Gate_Out and Pellet_Gate_Out.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


TSTe56r

2--14

Exercise: Testing a Ladder Diagram in an RSLogix 5000 Project

Exercise C
3. After the MCR instructions have been added, your MainRoutine
should look similar to the grahic below:

6. Yes, the system runs normally.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


TSTe56r

Exercise: Testing a Ladder Diagram in an RSLogix 5000 Project

2--15

9. After the two NOP branches have been added, the MainRoutine
should look similar to the following graphic:

11. When the Start pushbutton activates System_Command, it also


activates the MCR zone to scan normally. With the two NOP
branches providing a true path to the three outputs, they all turn
on.
12. When the Stop pushbutton de-activates System_Command, it
also de-activates the MCR zone normal scan. In this case, the
first MCR scans breaking logical continuity of every rung, until
it finds the second MCR (no inputs on this MCR rung). The two
NOP branches are superfluous since the rungs are false in this
state, so all outputs turn off.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


TSTe56r

2--16

Exercise: Testing a Ladder Diagram in an RSLogix 5000 Project

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


TSTe56r

Lesson

Programming Timer Instructions in


an RSLogix 5000 Project
What You Will Learn

After completing this lesson, you should be able to program timer


instructions in an RSLogix 5000 project.

When You Will Do This


You will perform this task in the following situations:
Turn an output on or off
Track the total running time of a process

Before You Begin


Mention that timer instructions are
output instructions.

Timer Instructions
Timer instructions control operations based on time and are used
when any of the following actions need to occur:
After a timed delay, trigger an outcome to take place
Cause an event to occur for a specified length of time

Time the duration of an event


Question: What type of application would require a timer?
Example: A TON instruction turns on a
motor 10 seconds after start is enabled
for safety reasons.
Example: A TOF instruction keeps a fan
running for one minute after stopping a
motor.
Note that an RTO is similar to a TON
except after timing it retains the
accumulated value until it is reset.

There are four types of timer instructions:


TON (Timer On Delay): Used to time for a specific interval
after the timer is enabled.
TOF (Timer Off Delay): Used to time for a specific interval
after a timer is disabled.
RTO (Retentive Timer On Delay): Used to accumulate time.

RES (Reset): Used to reset a timer.


Activity: As a group, determine the timer types for the following
situations:

Answers:
TON
RTO

Rev. June 2012

You need to turn on a photo jammed alarm if a part is in front


of a photo eye for more than 1 second.

You need to keep track of how long a machine is in cycle. It


may go in and out of cycle several times during the shift and
you want to know the total amount of time it was in cycle.
E 2012 Rockwell Automation, Inc. All rights reserved.
TIMsb56r

3--2

Programming Timer Instructions in an RSLogix 5000 Project

Timer Structure
A timer instruction has three operands:
Timer: The structure where information from the timer is stored.
Preset Value (.PRE): The number of units or time base to be
timed (valid range 0 through +2,147,483,647).
Accumulated Value (.ACC): The total time the timer has been
enabled in millisecond units.
Tag Name
Total Milliseconds the
Timer has Counted

In RSLogix 5000 software, show


the students how to right-click an
instruction and select Instruction
Help. Tell them that they also can use
the Documentation Reference Guide.
Tell the students that this is an example
of a TIMER structure within the Monitor
Tags window of RSLogix 5000 software.

How Long to Delay


Accumulate Time

Question: Where can you find more information on timer


instructions and their functionality?
Data associated with a timer instruction is stored in members of a
TIMER structure. All timers have the same five members:

Preset Value
Accumulated Value
Enable Bit
Timer Timing Bit
Done Bit

.PRE: The value (1 msec units) which the accumulated value

must reach before the instruction sets the .DN bit.


.ACC: The number of milliseconds that have elapsed since the
timer instruction was enabled.

Timer Status Bits: A function to tell the controller the status of


the timer instruction.

TON (Timer On Delay) Instruction


Note that when the .EN and .DN bits are
set (1), they are highlighted on the rung
in the ladder logic routine. This is true
with all types of timer and counter
instructions.

The rung conditions control the instruction. If the rung conditions are
true, the following occurs:
The .EN bit turns ON and the timer starts timing.

The .TT bit turns ON when the timer is timing. The timer is

enabled but not done and the accumulated value is incrementing.


When the accumulated value reaches the preset value, the timer
stops timing. The timer sets the .DN bit and resets the .TT bit.
E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


TIMsb56r

Programming Timer Instructions in an RSLogix 5000 Project

3--3

A TON instruction is used for a timer that needs to accumulate time


when it is true and reset when false:
If the rung conditions are . . .

The status bits are in


the following states . . .
.EN

Use the steps below to help guide


you during the demonstration:
1. Go online with the
TIM_1756R_DEM1.acd file.
2. In the TON routine, show the
students how the TON instruction
works and answer the Activity
questions.
3. Expand the tag TON_Demo in the
Monitor Tags window to see the
correlation between the tags and the
ladder logic.

.TT

Then . . .

.DN

TRUE and .ACC < .PRE

The timer is timing


and the .ACC
increments.

TRUE and .ACC = .PRE

The timer timed out


and the .ACC holds
the current value.

FALSE

The timer is reset and


the .ACC is 0.

Activity: As a group, determine the following as your instructor


demonstrates the TON instruction:

What happens when Pushbutton_DI1 is enabled?

What happens when the accumulated value equals the preset?

What happens if Rung 0 becomes false (0/open) after the timer


starts timing?

When will Red_Light_DO2 become enabled?

TOF (Timer Off Delay) Instruction


Mention that an overhead projector has
a timed off element. When the light bulb
is turned off, a cooling fan continues to
run for a specified amount of time, which
is representative of a TOF.

A TOF instruction is used for a timer that needs to time when it is


false and reset when true:
If the rung conditions are . . .

The status bits are in the


following states . . .
.EN

Rev. June 2012

.TT

Then . . .

.DN

FALSE and .ACC < .PRE

The timer is timing


and the .ACC
increments.

TRUE

The timer is reset and


the .ACC is 0.

FALSE and .ACC = .PRE

The timer timed out


and the .ACC holds
the current value.

E 2012 Rockwell Automation, Inc. All rights reserved.


TIMsb56r

3--4

Programming Timer Instructions in an RSLogix 5000 Project

The graphic below shows a TOF instruction:

Use the steps below to help guide


you during the demonstration:
1. In the TOF routine, demonstrate how
the instruction resets as soon as the
rung goes TRUE.
2. Point out that the .EN and .DN bits
are enabled simultaneously when
the switch is enabled. When the
switch is disabled, the .EN bit is
disabled, the .TT bit is enabled, and
the .DN bit remains enabled for the
specified length of the off delay
(preset value).

Activity: As a group, determine the following as your instructor


demonstrates the TOF instruction:

When does Red_Light_DO11 become enabled?

What happens to TOF_Demo.DN when the .DN bit is


disabled?

What happens when Switch_DI14 becomes false (0/open)?


What happens if Switch_DI14 becomes true (1/closed) after
the timer starts timing?

RTO (Retentive Timer On Delay) Instruction

? What is a retentive instruction?


Answer: An instruction that retains data
until it is reset, even after a power
failure.

An RTO instruction is a timer that accumulates time when it is true


and does not reset when it goes false. It has the ability to start and
stop without resetting (losing) its accumulated value:
If the rung conditions are . . .

The status bits are in the


following states . . .
.EN

Tip "
E 2012 Rockwell Automation, Inc. All rights reserved.

.TT

Then . . .

.DN

TRUE and .ACC < .PRE

The timer is timing


and the .ACC
increments.

TRUE and .ACC = .PRE

The timer timed out


and the .ACC holds
the current value.

FALSE

The timer is reset and


the .ACC is 0.

FALSE and .ACC = .PRE

The timer timed out


and the .ACC holds
the current value.

An RES (reset) instruction is needed to reset the RTO instructions


accumulated value and bits regardless of the state of the RTO rung.
Rev. June 2012
TIMsb56r

Programming Timer Instructions in an RSLogix 5000 Project

3--5

The graphic below shows an RTO instruction:

RES (Reset) Instruction


Mention that CTU and CTD instructions
are counter instructions that will be
taught in a later lesson.

An RES instruction is an output instruction used to reset timer and


counter instructions. It will typically reference either a TON, RTO,
CTU, or CTD instruction by its tag.
When an RES instruction is true, the accumulated value and the bits
of either a timer or counter instruction of the referenced tag data type
are cleared to 0 (reset). The following graphic shows an example of
an RES instruction referencing a timer instruction:

Never use an RES instruction to reset a TOF


instruction because the RES clears the status bits
as well as the accumulated value.

Use the steps below to help guide


you during the demonstration:
1. In the RTO routine, show and
explain what happens when
rung conditions are TRUE
and then when they are FALSE.
2. Show Switch_DI15 is disabled while
the timer is timing and when the
instruction times out, the RTO
retains the accumulated value.
3. Expand the tag RTO_Demo in the
Monitor Tags window during the
demonstration so students can see
the correlation between the tags and
the ladder logic.

Rev. June 2012

Activity: As a group, determine the following as your instructor


demonstrates the RTO and RES instructions:

When does Red_Light_DO5 become enabled?

When will the RTO instructions accumulated value and bits


be cleared?

What happens if Switch_DI15 is disabled after the timer starts


timing?

E 2012 Rockwell Automation, Inc. All rights reserved.


TIMsb56r

3--6

Programming Timer Instructions in an RSLogix 5000 Project

Heres How

To program timer instructions.

IMPORTANT: To meet IACET CEU


requirements and fully prepare
certificate students for the final exam,
you must demonstrate all lesson
objectives using the proper job aids.

Demonstration Checklist
You should have already demonstrated
the timer instructions.

Pay attention to these critical aspects of the demonstration:

E 2012 Rockwell Automation, Inc. All rights reserved.

Do you know which timer instruction to use when you


want the timer to begin timing when the rung goes false
and reset the accumulated time when the rung goes
true?

Do you know what happens to the status bits when rung


conditions are true for a TON instruction?

Did your instructor show you the following?


- Where to create a timer instruction
- How to get help for an instruction
- How to interpret true and false rung conditions for
TON, TOF, and RTO instructions

Rev. June 2012


TIMsb56r

Exercise: Programming Timer Instructions in an RSLogix 5000 Project

3--7

Exercise: Programming Timer


Instructions in an RSLogix 5000
Project
Exercise A

Practice programming timer instructions for an iron process.


Before you get started, watch the animated simulation of the iron
process:
1. Open the CCP151_1756R_DEM1.exe file.
2. Click Start in the lower-left corner of the window.
Use these workstation devices to represent the equipment of the iron
process:
Pellet_Gate_Out

Coke_High
Coke_Conveyor_Out

Start
System_Command
Coke_Gate_Out
Stop
Coke_Low

Car_Position

Tag Name

Rev. June 2012

Alias For

Workstation
Device

Start

Local:2:I.Data.0

DI0

Coke_High

Local:2:I.Data.1

DI1

Stop

Local:2:I.Data.8

DI8

Coke_Low

Local:2:I.Data.9

DI9

Car_Position

Local:2:I.Data.12

DI12

System_Command

Local:0:O.Data.0

DO0

Coke_Gate_Out

Local:0:O.Data.1

DO1

Coke_Conveyor_Out

Local:0:O.Data.3

DO3

Pellet_Gate_Out

Local:0:O.Data.4

DO4

E 2012 Rockwell Automation, Inc. All rights reserved.


TIMe56r

3--8

Exercise: Programming Timer Instructions in an RSLogix 5000 Project

When you see underlined text, refer to the related procedure or


information in your job aid.
Directions:
1. Open the TIM_1756R_A1.acd project file.
2. Replace the Weight_Target switch with the output bit of a timer.
Use the timer to simulate filling the scale car to the target weight:
- IF Coke_Gate_Out = On (coke gate open)
AND Pellet_Gate_Out = On (pellet gate open)
AND Car_Position is on (car at stockhouse)
THEN start timing (filling the car)
- It takes 90 seconds to fill the car to the target weight.
- The gates turn off (close) when the car reaches the target
weight, just like they do now.
- The timer holds the simulated weight until Car_Position turns
off (car leaves stockhouse).

How Did You Do?

E 2012 Rockwell Automation, Inc. All rights reserved.

Turn to the Answers section.

Rev. June 2012


TIMe56r

Exercise: Programming Timer Instructions in an RSLogix 5000 Project

Exercise B

3--9

Program a fault detection for the stockhouse gates. Sometimes when


a programmer is developing logic, it is beneficial to create some
temporary logic to simulate a machine or process function. This
simulation logic could be used to test a section of code before the
hardware is in place.
The Stockhouse routine of your project has logic that simulates the
feedback limit switches for the coke and pellet gates. Open the
routine and review the logic and comments.
To test and tell if a gate is faulted, you can use the outputs FB0 and
FB1 in the simulation logic. For example, if FB1 = on, that tells you
the gate is open.
When you see underlined text, refer to the related procedure or
information in your job aid.
Directions:
1. Open the TIM_1756R_B1.acd project file.
2. Add additional logic to the stockhouse routine to set a fault bit for
a gate if the gate does not fully open or fully close as
commanded:

The fault bit for the gate turns on if either of these conditions
are true for longer than 10 seconds:

- Gate = On And FB1 = Off


- Gate = Off And FB0 = Off

Once the fault bit turns on, it stays on. You must manually
turn it off by pressing the Stop button for 2 seconds.

If either of the gates fault, then both gates turn off. Use
existing tags Coke_Gate_Fault and Pellet_Gate_Fault.

3. Download the project to slot 1 of your workstation.


4. Put the controller in Run mode.
5. Press the Start pushbutton and make sure that the
System_Command light turns on.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


TIMe56r

3--10

Exercise: Programming Timer Instructions in an RSLogix 5000 Project

6. Test your code and make sure it meets requirements. Here are
some suggestions:
Use AFI instructions to test small sections of your code. For
example, first test the weigh scale simulation, and then test the
feedback simulation, and so on.
To simulate a faulted gate, set the preset for the
Coke_Gate_Open_Delay timer to something greater than 10
seconds.
Command the Coke Gate to open and wait 10 seconds. The
fault bit Coke_Gate FB1 should turn on, and both Coke gate
out and Pallet gate out should turn off.
Check off each requirement as you meet it.
7. Go offline.
8. Save the project.

How Did You Do?

E 2012 Rockwell Automation, Inc. All rights reserved.

Turn to the Answers section.

Rev. June 2012


TIMe56r

Exercise: Programming Timer Instructions in an RSLogix 5000 Project

Rev. June 2012

3--11

E 2012 Rockwell Automation, Inc. All rights reserved.


TIMe56r

3--12

Exercise: Programming Timer Instructions in an RSLogix 5000 Project

Answers

Exercise A
2. The boxes in the following graphic highlight the new code for
the weigh scale simulation:

Rung 0

The XIO instruction checks the done bit of the timer. If off, then
the simulated weight is less than the target weight. If on, then the
simulated weight is at the target weight.

Rung 1

The rung uses seal-in logic to start and reset a timer. The timer
simulates the filling of the scale car.
IF Coke_Gate_Out = on AND Pellet_Gate_Out = on AND
Car_Position = on, THEN the timer runs for 90 seconds.
Once the timer is done, the done bit seals in the gate
conditions. This lets the timer hold its time when the gates
close.
Car_Position turns off when the scale car leaves the
stockhouse. This resets the timer.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


TIMe56r

Exercise: Programming Timer Instructions in an RSLogix 5000 Project

3--13

Exercise B
2. The boxes in the following graphic highlight the new code for
the fault detection:

Rung 0

The gates turn on only if both of them are not faulted. They both
turn off if either of them fault while commanded on.

Rung 8

If Coke_Gate_Out = On And Coke_Gate_FB1 = Off


Or if Coke_Gate_Out = Off And Coke_Gate_FB0 = Off
After 10 seconds
Then Coke_Gate_Fault = On (latched)

Rung 9

Rev. June 2012

Same as rung 8.

E 2012 Rockwell Automation, Inc. All rights reserved.


TIMe56r

3--14

Exercise: Programming Timer Instructions in an RSLogix 5000 Project

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


TIMe56r

Lesson

Programming Compare
Instructions in an RSLogix 5000
Project
What You Will Learn

After completing this lesson, you should be able to program compare


instructions in an RSLogix 5000 project.

When You Will Do This


You will perform this task when you need to make a decision based
on a value, not a bit. Some examples are:
Turn on an alarm if a flow rate exceeds a certain level
Turn on an output when it is within a certain range

Reject a package if it is less than or greater than a certain weight

Before You Begin

Compare Instruction Overview


Source: The tag address or constant value on which a compare
operation is performed.

Tell students that compare instructions


can compare values of different types,
such as floating point (REAL)
Tip
and integer (INT).

Compare Instructions: An input instruction that compares a pair of


values by using an expression or a specific compare instruction.

"

Mention that a separate lesson covers


the CMP and CPT instructions.
This lesson does not cover the MEQ
instruction. There is rarely a need to use
that instruction.

A compare instruction executes faster and requires less memory if all


the operands of the instruction use the same optimal data type,
typically DINT or REAL.
There are seven compare instructions:
EQU (Equal to)

GEQ (Greater Than or Equal to)


GRT (Greater Than)
LEQ (Less Than or Equal to)
LES (Less Than)
NEQ (Not equal to)
LIM (Limit)

Question: Have you seen or used compare instructions in your


plants applications? What are some examples?

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


PCIsb56r

4--2

Programming Compare Instructions in an RSLogix 5000 Project

All compare instructions:


Compare Source A to Source B for some condition
Compare data from external sources or from internal addresses
(tags)

Compare two numbers or two strings of ASCII characters

Mention that that strings may come from


bar code readers.

ASCII characters are case-sensitive, which applies


to EQU, GEQ, GRT, LEQ, LES, and NEQ
instructions. For example, upper case A
(A=$41) is not equal to lower case a (a=$61).
Strings are not equal if any of their characters do
not match.

EQU Instruction
The EQU instruction, an input instruction, tests whether Source A is
equal to Source B.
For example, if the box counters accumulated value is equal to the
level count, then the rung-condition-out is set to true, as shown in the
following graphic:
Tag
Tag Value

10 is equal to 10, so the rung condition is true.

Use the steps below to help guide


you during the demonstration:
1. Go online with the
PCI_1756R_DEM1.acd file.

Activity: As your instructor demonstrates the EQU instruction,


notice that when the value in bottle_count_start matches the value in
bottle_count_end, the rung-condition-out is set to true.

2. Open the MainRoutine and review


how the EQU instruction functions.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCIsb56r

Programming Compare Instructions in an RSLogix 5000 Project

4--3

GEQ, GRT, LEQ, LES, and NEQ Instructions


The GRT instruction will check if the Source A value is greater than
the Source B value.
The LES instruction will check if the Source A value is less than the
Source B value.
For example, if the furnace temperature is greater than 375 degrees
or if the furnace temperature is less than 200 degrees then turn on the
temperature out-of-range alarm.

Use the steps below to help guide


you during the demonstration:
1. Explain what sets the rung condition
to TRUE.
2. Explain what sets the rung condition
to FALSE.
3. Point out that Source A is a fixed
value, while Source B varies
depending on the analog input.

Activity: As a group, determine the following as your instructor


demonstrates the LEQ instruction:

When is the rung-condition-out set to true?


When is the rung-condition-out set to false?

LIM Instruction
The LIM instruction, an input instruction, determines if the test value
is within the low limit to high limit range.
For example, if the oven temperature is between 358 and 364
degrees, then turn on the Temperature_OK bit.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


PCIsb56r

4--4

Programming Compare Instructions in an RSLogix 5000 Project

The following table outlines the function of a LIM instruction:


To make the rung
true when the
tested value is . . .

Then set the


low limit . . .

Between or equal to
either of the limits

Less than the


high limit

Outside or equal to
either of the limits

Mention that it doesnt make any


difference if the test value is
incrementing up, clockwise (as in this
example) or down counter-clockwise. As
long as the test value is between the
limits the instruction is logically true.

Higher than
the high limit

Example
High
limit

Low
limit

85

60

Rung is true when . . .

Tested Value

The value is equal to 85,


equal to 60, or between
the two
Tested
Value

Tested
Value

60

85

The tested value is 60 or


less, or 85 and above

The following list and graphic further explain the LIM instruction:
The LIM instruction starts at the low limit and increments
clockwise until it reaches the high limit.

The test values in the clockwise range from the high limit to the
low limit set the rung-condition-out to false.

The instruction is true if the test value is equal to or between the


low and high limit.

Low Limit High Limit

0
+1

(n+1)

(n+1)

+n

Low Limit

High Limit

+n

n = maximum value

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCIsb56r

Programming Compare Instructions in an RSLogix 5000 Project

4--5

Another way to configure the LIM instruction is to set the low limit
to a larger number than the high limit, as shown in the following
conditions and graphic:
The instruction starts at the low limit and increments clockwise
until it reaches the high limit.

The test values in the clockwise range from the high limit to the
low limit set the rung-condition-out to false.

The instruction is true if the test value is outside or equal to the


low and high limit.

Low Limit High Limit


1

0 +1
High Limit

Low Limit
(n+1)

+n

n = maximum value

Use the steps below to help guide


you during the demonstration:
1. Demonstrate how the
outputs turn on and off
by moving the POTs
on the workstation.
2. As you move a POT,
point out how the value
in its tag changes.

Activity: As a group, determine the following as your instructor


demonstrates the LIM instruction on rung 3:

When is the rung-condition-out set to true?


When is the rung-condition-out set to false?

3. Go to the tags monitor


and display the tag
Local:0:I.Ch0Data and
show the value change
there as you move
the POT.
4. Show where Coke_weight is an alias
to the analog value and point out
how the value changes there.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


PCIsb56r

4--6

Programming Compare Instructions in an RSLogix 5000 Project

Heres How

To program compare instructions.

IMPORTANT: To meet IACET CEU


requirements and fully prepare
certificate students for the final exam,
you must demonstrate all lesson
objectives using the proper job aids.

Demonstration Checklist
Your instructor should have already
shown you how each compare
instruction functions.
Pay attention to these critical aspects of the demonstration:

E 2012 Rockwell Automation, Inc. All rights reserved.

Do you know which compare instruction to use when you


want to test whether one value is between two values?

Did your instructor show you the following?


- Where to create a compare instruction
- How to get help for an instruction
- How to interpret true and false rung conditions for
compare instructions

Rev. June 2012


PCIsb56r

Exercise: Programming Compare Instructions in an RSLogix 5000 Project

4--7

Exercise: Programming Compare


Instructions in an RSLogix 5000
Project
Exercise A

Practice programming compare instructions for an iron process.


Before you get started, watch the animated simulation of the iron
process:
1. Open the CCP151_1756R_DEM1.exe file.
2. Click Start in the lower-left corner of the window.
Use these workstation devices to represent the equipment of the iron
process:
Weight

Pellet_Gate_Out

Start
System_Command
Coke_Gate_Out
Stop

Car_Position

Tag Name

Alias For

Workstation
Device

Start

Local:2:I.Data.0

DI0

Stop

Local:2:I.Data.8

DI8

Car_Position

Local:2:I.Data.12

DI12

System_Command

Local:0:O.Data.0

DO0

Coke_Gate_Out

Local:0:O.Data.1

DO1

Pellet_Gate_Out

Local:0:O.Data.4

DO4

Weight

Local:8:I.Ch0Data

AI0

When you see underlined text, refer to the related procedure or


information in your job aid.
Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


PCIe56r

4--8

Exercise: Programming Compare Instructions in an RSLogix 5000 Project

Directions:
1. Open the PCI_1756R_A1.acd project file.
Weigh Scale

2. Create a new programmed scoped tag with the following


information:
Tag Name
Weight

Alias For
Local:8:I.Ch0Data

Workstation
Device
AI0

3. On rung 0 of the StockHouse routine replace Sim_Fill_Time.DN


with analog input 0 of your workstation. Use the input to simulate
the weight read-out of the weigh scale:
- If the weight is less than 5000 kg AND the other conditions
are true, THEN:
Coke_Gate_Out = On
Pellet_Gate_Out = On
We have already added the analog input module to the I/O
configuration of the controller. Channel 0 is scaled to 0 to
10000 kg.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCIe56r

Exercise: Programming Compare Instructions in an RSLogix 5000 Project

4--9

Weigh Scale In Range Detection


4. Suppose that the weigh scale read-out must be between 1000 and
5500 kg whenever a scale car is on it (Car_Position = On).
Otherwise, the scale is out of calibration. Program the
StockHouse routine to signal that the weight is in range:
- Use the same analog input weight from step 3.
- Turn on a bit to show that the scale is in range. You do not
need to configure the bit to control a light on your
workstation.
5. Download the project to slot 1 of your workstation.
6. Put the controller in Run mode.
7. Press the Start pushbutton and make sure that the
System_Command light turns on.
8. Test your code and make sure it meets requirements. The
following are suggestions:
Turn AI0 on your workstation to change the weight on the
scale.
Check off each requirement as you meet it.
Watch the value in the weight tag as you move AI0 up and
down and make sure it is changing.
9. Go offline.
10. Save the project.

How Did You Do?

Rev. June 2012

Turn to the Answers section.

E 2012 Rockwell Automation, Inc. All rights reserved.


PCIe56r

4--10

Exercise: Programming Compare Instructions in an RSLogix 5000 Project

Answers

Exercise A
3. In the following graphic, the box highlights the new instruction
for the weigh scale:

Rung 0

The LES instruction lets the gates turn on (open) if the weight is
less than 5000 kg. When the weight reaches 5000 kg, the LES
instruction causes the gates to turn off (close).
4. The following graphic shows the instruction for the weigh scale
in range detection:

Rung 10

E 2012 Rockwell Automation, Inc. All rights reserved.

If Car_Position is on and Weight is between 1000 and 5500 kg,


Scale_In_Range turns on.
Rev. June 2012
PCIe56r

Lesson

Programming Move Instructions in


an RSLogix 5000 Project
What You Will Learn

After completing this lesson, you should be able to program move


instructions in an RSLogix 5000 project.

When You Will Do This


You will perform this task in the following situations:
Move values according to the needs of a ladder logic project
Clear values when the rung in condition is true

Before You Begin


An example where a move instruction
could be used is if a fault occurs on a
production line, the corresponding fault
code is moved to a display.

MOV (Move) Instruction


Move instructions are output instructions that copy a single variable
or constant values from one location to another. The data is moved
from a source to a destination.
The tag address or constant value on
which a move operation is performed.
The tag address where the data is stored
after an operation is performed.

The Source value remains unchanged with MOV


instructions.

Question: How are you using move instructions in your


applications?
MOV and CLR are the two most--used
move instructions. MVM is rarely used,
so we do not cover it in this course. BTD
is a move instruction for special cases.
This instruction is covered in a later
lesson.
Tip "

Rev. June 2012

Move instructions execute faster and require less memory if all the
operands of the instruction use the same optimal data type, typically
DINT or REAL.
Data types within move instructions can be mixed, but loss of
accuracy and rounding errors might occur, and the instruction will
take more time to execute.

E 2012 Rockwell Automation, Inc. All rights reserved.


PMVsb56r

5--2

Programming Move Instructions in an RSLogix 5000 Project

MOV Instructions with One-Shot Instructions


MOV instructions execute once each time the
instruction is scanned, as long as the
rung-condition-in is true. To evaluate the
expression only once, use a one-shot instruction to
trigger the instruction.

This example sets Recipe_Number to different values. The one-shot


(ONS) instructions limit the moves to only scan when the input goes
from off to on:

Use the steps below to help guide


you during the demonstration:
1. Go online to the controller with the
PMV_1756R_DEM1.acd file.
2. Demonstrate each of these points,
ask each point as a question, and
then have the students tell you what
they noticed.
3. Show students where to find the
analog inputs (potentiometers) on
the workstation.

E 2012 Rockwell Automation, Inc. All rights reserved.

Activity: As a group, determine the following as your instructor


demonstrates:

What happens to Recipe_Number if DI4 is pressed while DI0


is on?

How do you get Recipe_Number back to 77 if DI0 is already


on?

Rev. June 2012


PMVsb56r

Programming Move Instructions in an RSLogix 5000 Project

5--3

CLR (Clear) Instruction


A CLR instruction clears all the bits in the destination (Dest) tag.
When enabled, the CLR instruction, as in the following example,
clears all the bits of value_a to 0:

S:FS is a built-in keyword. It is on only for the first, normal scan of


the routines in the program. CLR instructions are often used with
S:FS to initialize data.
This example sets Recipe_Number equal to 0 during the first scan.

Use the steps below to help guide


you during the demonstration:
1. Change the Recipe_Number.
2. Change the controller from Run
mode to Program mode and then
back to Run mode.

Activity: As a group, determine the following as your instructor


demonstrates:

What action causes S:FS to turn on?


What is the state of S:FS the rest of the time?

3. Point out that Recipe_Number is


now 0.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


PMVsb56r

5--4

Programming Move Instructions in an RSLogix 5000 Project

Heres How

To program move instructions.

IMPORTANT: To meet IACET CEU


requirements and fully prepare
certificate students for the final exam,
you must demonstrate all lesson
objectives using the proper job aids.

Demonstration Checklist
You should have already demonstrated
the move instructions.

Pay attention to these critical aspects of the demonstration:

E 2012 Rockwell Automation, Inc. All rights reserved.

Did your instructor point out that the Source in a MOV


instruction can be a tag address or a constant value?

Do you know what the function of the S:FS is when used


in conjunction with a CLR instruction?

Did your instructor show you the following?


- How to get help for an instruction
- How to assign tags or a constant value to the Source
- How to assign tags to the destination

Rev. June 2012


PMVsb56r

Exercise: Programming Move Instructions in an RSLogix 5000 Project

5--5

Exercise: Programming Move


Instructions in an RSLogix 5000
Project
Exercise A

Practice using MOV and CLR instruction to simulate the weight


read-out of a weigh scale for an iron process.
Before you get started, watch the animated simulation of the iron
process:
1. Open the CCP151_1756R_DEM1.exe file.
2. Click Start in the lower-left corner of the window.
Use these workstation devices to represent the equipment of the iron
process:
Pellet_Gate_Out

Start
System_Command
Coke_Gate_Out
Stop

Car_Position

Tag Name

Alias For

Workstation Device

Start

Local:2:I.Data.0

DI0

Stop

Local:2:I.Data.8

DI8

Car_Position

Local:2:I.Data.12

DI12

System_Command

Local:0:O.Data.0

DO0

Coke_Gate_Out

Local:0:O.Data.1

DO1

Pellet_Gate_Out

Local:0:O.Data.4

DO4

When you see underlined text, refer to the related procedure or


information in your job aid.
Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


PMVe56r

5--6

Exercise: Programming Move Instructions in an RSLogix 5000 Project

Directions:
1. Open the PMV_1756R_A1.acd project file.
Weigh Scale Simulation
Make these changes and additions to simulate the operation of the
weigh scale as cars move on and off it.
2. Create a tag to store the simulated weight:
- Name: Sim_Weight
- Data type: DINT
- Scope: MainProgram
3. Program the read-out of the weigh scale for these situations:
- No car on scale:
IF first_scan = on OR Car_Position = off THEN
Sim_Weight = 0
- Empty car arriving on scale:
IF Car_Position goes from off to on THEN
Sim_Weight = 1000 (empty weight of car)
- Full car on scale:
IF Sim_Fill_Time.Dn = on THEN
Sim_Weight = 5000 (full weight of car)
4. Change the LES instruction to use Sim_Weight instead of Weight:

5. On your workstation, turn the Car_Position switch to off.


6. Download the project to slot 1 of your workstation.
E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PMVe56r

Exercise: Programming Move Instructions in an RSLogix 5000 Project

5--7

7. Put the controller in Run mode.


8. Press the Start pushbutton and make sure that the
System_Command light turns on.
9. Test your code and make sure it meets requirements. The
following are suggestions:
To simulate an empty scale car arriving on the scale, turn the
Car_Position switch to on.
When the scale car is full, turn the Car_Position switch to off.
This simulates the car leaving the scale.
Check off each requirement as you meet it.
10. Go offline.
11. Save the project.

How Did You Do?

Rev. June 2012

Turn to the Answers section.

E 2012 Rockwell Automation, Inc. All rights reserved.


PMVe56r

5--8

Exercise: Programming Move Instructions in an RSLogix 5000 Project

Answers

Exercise A
2. The following graphic shows the Sim_Weight tag:

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PMVe56r

Exercise: Programming Move Instructions in an RSLogix 5000 Project

5--9

3. The following graphic shows the weigh scale simulation:

Rev. June 2012

Rung 0

If this is the first scan or the car is not on the weigh scale, then
clear Sim_Weight.

Rung 1

When Car_Position turns on, the MOV instruction sets


Sim_Weight equal to 1000. This is the empty weight of the scale
car. The ONS instruction limits the move to the change of
Car_Position from off to on.

Rung 4

Sim_Full_Time.DN turns on after the gates have been open for


90 seconds. When Sim_Full_Time.DN turns on, the MOV
instruction sets Sim_Weight equal to 5000. This is the full weight
of the scale car.

E 2012 Rockwell Automation, Inc. All rights reserved.


PMVe56r

5--10

Exercise: Programming Move Instructions in an RSLogix 5000 Project

4. The following graphic shows how to use the Sim_Weight tag:

Rung 2

E 2012 Rockwell Automation, Inc. All rights reserved.

The LES instruction checks to see if Sim_Weight is less than


5000 kg.

Rev. June 2012


PMVe56r

Lesson

Programming Math Instructions in


an RSLogix 5000 Project
What You Will Learn

After completing this lesson, you should be able to program math


instructions in an RSLogix 5000 project.

When You Will Do This


You will perform this task when you need to perform an arithmetic
operation. Some examples are:
Convert a temperature reading
Convert raw data to/from engineering units

Convert process data for closed loop control and networking


Create a step counter that increments in units 1 or more each
occurrence

Before You Begin

Math Instruction Overview


Math instructions have the following components:
Source: The tag address or constant value on which the
mathematical operation is performed.

Mention that the source and destination


values function the same for compare,
math, and move instructions.

Destination (Dest): The tag address where the data is stored after
a mathematical operation is performed.

Mention that you can mix data Tip


types, but loss of accuracy and
rounding errors may occur and the
instruction may take more time to
execute.

Mention that the Help drop-down menu


is the online users manual in
RSLogix 5000 Software.

"

A math instruction executes faster and requires less memory if all the
operands of the instruction use the same optimal data type, typically
DINT or REAL.
Math instructions execute once each time the instruction is scanned
as long as the rung-condition-in is true. To evaluate the expression
only once, use a one-shot instruction to trigger the instruction.
There are eight math output instructions:
ADD (Add)

Rev. June 2012

SUB (Subtract)
MUL (Multiply)
DIV (Divide)
MOD (Modulo)
NEG (Negate)
ABS (Absolute Value)
SQR (Square Root)
E 2012 Rockwell Automation, Inc. All rights reserved.
PCMsb56r

6--2

Programming Math Instructions in an RSLogix 5000 Project

Question: Have you seen or used math instructions in your plants


applications? What are some examples?

ADD (Add) Instruction


The ADD instruction adds Source A to Source B and places the
result in the Dest (destination):
In the following graphic, when the ADD instruction is enabled,
Sand_weight and Water_weight are added.

The result is placed in the Dest (destination) tag address


SandWater_Mix.

SUB (Subtract) Instruction


The SUB instruction subtracts Source B from Source A and places
the result in Dest (destination):
In the following graphic, when the SUB instruction is enabled,
SandWater_Mix is subtracted from TopSoil_GravelMix.

The result is placed in the Dest (destination) tag address


Billable_Material.

Use the steps below to help guide


you during the demonstration:

Activity: As your instructor demonstrates the ADD and SUB


instructions, notice the key points:

1. Go online to the controller with


PCM_1756R_DEM1.acd file.

2. In the ADD_SUB_MUL_DIV
subroutine, demonstrate how rung 1
works.

The two Dest (destination) tags from the ADD instructions are
used in the SUB instruction Source A and Source B.

When the SUB instruction is enabled, SandWater_Mix is


subtracted from TopSoil_GravelMix.

The result is placed in the Dest (destination) tag address


Billable_Material.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCMsb56r

Programming Math Instructions in an RSLogix 5000 Project

6--3

MUL (Multiply) Instruction


Point out that this example uses two
words as the sources.

The MUL instruction multiplies Source A with Source B and places


the result in Dest (destination):
In the following graphic, when the MUL instruction is enabled,
Billable_Material and Total_Customers are multiplied.
The result is placed in the Dest (destination) tag address
Grand_Total.

In the ADD_SUB_MUL_DIV
subroutine, demonstrate how
rung 2 works.

Activity: As your instructor demonstrates the SUB and MUL


instructions, notice the key points:

The Dest (destination) tag from the SUB instruction is used in


the MUL instruction Source A.

When the MUL instruction is enabled, Billable_Material and


Total_Customers are multiplied.

The result is placed in the Dest (destination) tag address


Grand_Total.

DIV (Divide) Instruction


The DIV instruction divides Source A by Source B and places the
result in Dest (destination):
In the following graphic, when the DIV instruction is enabled, the
Source A tag, Total, is divided by the Source B tag, Years.
The result is placed in the Dest (destination) tag address
Yearly_Income.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


PCMsb56r

6--4

Programming Math Instructions in an RSLogix 5000 Project

Point out that in the DIV example, Total


and Years are DINTs and, therefore, the
destination is also a DINT.

If the destination is not a REAL, the instruction handles the


fractional portion of the result as follows:

Mention that if Source B (the divisor) =


0, then a minor fault will occur, such as a
program fault or arithmetic overflow.

Then the fractional


portion of the result . . .

If Source A . . .
And Source B are not
REALs

Truncates

Or Source B is a REAL

Rounds

Example
Source A
Source B
Destination
Source A
Source B
Destination

DINT
DINT
DINT
REAL
DINT
DINT

5
3
1
5.0
3
2

If Source B is equal to zero then the Dest (destination) is set as


follows:
And the
destination
is a . . .

If Source B is
zero and . . .

And the
result is . . .

All operands are


integers (SINT, INT,
or DINT)
At least one operand
is a REAL

Point out that numbers other than x.5


will round to the nearest number.
However, numbers that have x.5 will
round to the nearest even number. This
means that an x.5 number will
sometimes round up, i.e., 1.5 to 2, and
sometimes it will round down, i.e., 2.5 to
2. This is important to know since
rounding essentially will cause data to
be lost and inaccurate. Tell students the
same potential for error exists if values
are converted from DINT to REAL.

E 2012 Rockwell Automation, Inc. All rights reserved.

Then the
destination
is set to . . .
Source A

SINT, INT, or DINT


REAL

Positive
Negative
Positive

-1
0
1.$ (positive infinity)

Negative

-1.$ (negative infinity)

Potential rounding errors exist if a REAL value is


converted to a DINT value:

REAL (source)

DINT (result)

--2.5

--2

--1.6

--2

--1.5

--2

--1.4

--1

1.4

1.5

1.6

2.5

Rev. June 2012


PCMsb56r

Programming Math Instructions in an RSLogix 5000 Project

In the ADD_SUB_MUL_DIV
subroutine, demonstrate how
rung 3 works.

6--5

Activity: As your instructor demonstrates the ADD and DIV


instructions, notice the key points:

The Dest (destination) tag from the ADD instruction is used in


the DIV instruction Source A.

The DIV instruction Source A tag, Total, is divided by the


Source B tag, Years.

The result is placed in the Dest (destination) tag address


Yearly_Income.

MOD (Modulo) Instruction


Mention that if Source B (the divisor) =
0, then a minor fault will occur, such as a
program fault or arithmetic overflow.

The MOD instruction divides Source A by Source B and then places


the remainder in the Dest (destination):
In the following graphic, when the MOD instruction is enabled,
the Source A tag, TopSoil_GravelMix, is divided by the Source B
tag, SandWater_Mix.
The remainder is placed in Dest (destination) tag address Remain.

If Source B is equal to zero, then the Dest (destination) address is set


as follows:
If Source B is
zero and . . .

And the
destination
is a . . .

And the
result is . . .

All operands are


integers (SINT, INT,
or DINT)
At least one operand
is a REAL

In the MOD_SQR_NEG_ABS
subroutine, demonstrate how
rung 0 works.

Rev. June 2012

Then the
destination
is set to . . .
Source A

SINT, INT, or DINT


REAL

Positive
Negative
Positive

-1
0
1.$ (positive infinity)

Negative

-1.$ (negative infinity)

Activity: Follow along as your instructor demonstrates the MOD


instruction.

E 2012 Rockwell Automation, Inc. All rights reserved.


PCMsb56r

6--6

Programming Math Instructions in an RSLogix 5000 Project

NEG (Negate) Instruction


The NEG instruction changes the sign of the Source (to either
positive or negative, accordingly) and then places the result in the
Dest (Destination):
In the following graphic, when the NEG instruction is enabled,
coke_weight1 becomes a different tag value.
The new value is then placed in the Dest (destination) tag address
Coke_Weight.

By negating a negative value, the result is


positive. By negating a positive value, the result is
negative.

In the MOD_SQR_NEG_ABS
subroutine, demonstrate how
rung 2 works.

Activity: Follow along as your instructor demonstrates the NEG


instruction.

ABS (Absolute Value) Instruction


The ABS instruction takes the absolute value of the Source and
places the result in the Dest (destination):
In the following graphic, when the ABS instruction is enabled, it
calculates the absolute value of result_6.
The answer is placed in the Dest (destination) tag address
result_7.

In the MOD_SQR_NEG_ABS
subroutine, demonstrate how
rung 3 works.

E 2012 Rockwell Automation, Inc. All rights reserved.

Activity: Follow along as your instructor demonstrates the ABS


instruction.

Rev. June 2012


PCMsb56r

Programming Math Instructions in an RSLogix 5000 Project

6--7

SQR (Square Root) Instruction


The SQR instruction computes the square root of the Source, placing
the result in the Dest (destination):
In the following graphic, when the SQR instruction is enabled, it
calculates the square root of result_5.
The answer is placed in the Dest (destination) tag address
result_6.

Point out that in the SQR example,


Optimum_CokeWeight is a DINT and,
therefore, the destination, result_6, is
also a DINT.

If the destination is not a REAL, the instruction handles the


fractional portion of the result as follows:
If the Source is . . .

Then the fractional


portion of the result . . .

Not a REAL

Truncates

A REAL

Rounds

Example
Source

DINT

Destination
Source

DINT
REAL

1
3.0

Destination

DINT

If the Source is negative, the instruction takes the absolute value of


the Source before calculating the square root.
In the MOD_SQR_NEG_ABS
subroutine, demonstrate how
rung 1 works.

Activity: Follow along as your instructor demonstrates the SQR


instruction.

Arithmetic Status Flags


Tell students that there is also a set of
controller status flags that can be used
to monitor the status of the controller.
Also, tell students that they will learn
much more detailed information
concerning status flags in the next level
Logix5000 course, RSLogix 5000 Level
3: Project Development (CCP143).

Rev. June 2012

A set of arithmetic status flags can be accessed directly in relay


instruction operands.
These flags are not base tags and you cannot
create alias tags for them.

E 2012 Rockwell Automation, Inc. All rights reserved.


PCMsb56r

6--8

Programming Math Instructions in an RSLogix 5000 Project

Add that for on-the-job reference, the


status flags are listed in the
Documentation Reference Guide.

Heres How

Arithmetic status flags can be used to view the results of an


arithmetic operation after the execution of ladder logic, as outlined in
the following table:
To determine if the . . .

Examine
this status flag . . .

Using this
keyword . . .

Value you are storing cannot fit into the


destination because it is either greater
than the maximum value or less than
the minimum value for the destination

Overflow

S:V

Instructions destination value is zero [0]

Zero

S:Z

Instructions destination value is


negative

Sign (result is
negative)

S:N

Instruction generated a carry

Carry

S:C

To program math instructions.

IMPORTANT: To meet IACET CEU


requirements and fully prepare
certificate students for the final exam,
you must demonstrate all lesson
objectives using the proper job aids.

Demonstration Checklist
You should have already demonstrated
the math instructions.

Pay attention to these critical aspects of the demonstration:

E 2012 Rockwell Automation, Inc. All rights reserved.

When programming a DIV instruction, do you know what


the Destination is set to when Source B is zero and all
operands are DINTs?

What does a SQR instruction do if the Source is


negative?

Did your instructor show you the following?


- Where to create a math instruction
- How to get help for an instruction
- How to interpret true and false rung conditions for
ADD, SUB, MUL, DIV, MOD, NEG, ABS, and SQR
instructions

Rev. June 2012


PCMsb56r

Exercise: Programming Math Instructions in an RSLogix 5000 Project

6--9

Exercise: Programming Math


Instructions in an RSLogix 5000
Project
Exercise A

Practice using math instructions to perform math operations for a


simulated iron process.
Before you get started, watch the animated simulation of the iron
process:
1. Open the CCP151_1756R_DEM1.exe file.
2. Click Start in the lower-left corner of the window.
Use these workstation devices to represent the equipment of the iron
process:
Pellet_Gate_Out

Start
System_Command
Coke_Gate_Out
Stop

Car_Position

Tag Name

Alias For

Workstation
Device

Start

Local:2:I.Data.0

DI0

Stop

Local:2:I.Data.8

DI8

Car_Position

Local:2:I.Data.12

DI12

System_Command

Local:0:O.Data.0

DO0

Coke_Gate_Out

Local:0:O.Data.1

DO1

Pellet_Gate_Out

Local:0:O.Data.4

DO4

When you see underlined text, refer to the related procedure or


information in your job aid.
Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


PCMe56r

6--10

Exercise: Programming Math Instructions in an RSLogix 5000 Project

Directions:
1. Open the PCM_1756R_A1.acd project file.
Simulate a Fill Rate of 50 kg/second
Make these changes and additions to simulate the read-out of the
weigh scale at 50 kg/second:
2. Sometimes it is useful to set up a timer so that it automatically
resets when it is done and starts timing again. This is called a
free-running timer. To create a free-running timer, use the timers
.DN bit as an input condition for the timer.
Edit rung 3 so that it times for 1 second, resets, and times again
whenever the gates are open, like this:

3. Program the StockHouse routine to simulate a fill rate of


50 kg/second:
- IF gates = on (open) THEN
Sim_Weight increases by 50 kg/second
Number of Loads Calculation
4. The scale car holds 4000 kg of material. It dumps a total of
80,000 kg of material into the furnace.
Program the Stockhouse routine to calculate how many times you
have to load the scale car to fill the furnace to its target weight:
Perform the calculation once each time System_Command
turns on.
- Make sure you can enter different total weights without
editing the logic, depending on the recipe for the furnace.
- Store the result in a tag. We will use it in another lesson.
5. On your workstation, turn the Car_Position switch to off.

6. Download the project to slot 1 of your workstation.


E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCMe56r

Exercise: Programming Math Instructions in an RSLogix 5000 Project

6--11

7. Put the controller in Run mode.


8. Press the Start pushbutton and make sure that the
System_Command light turns on.
9. Test your code and make sure it meets requirements. The
following are some suggestions:
To simulate an empty scale car arriving on the scale, turn the
Car_Position switch to on.
When the scale car is full, turn the Car_Position switch to off.
This simulates the car leaving the scale.
Check off each requirement as you meet it.
10. Go offline.
11. Save the project.

How Did You Do?

Rev. June 2012

Turn to the Answers section.

E 2012 Rockwell Automation, Inc. All rights reserved.


PCMe56r

6--12

Exercise: Programming Math Instructions in an RSLogix 5000 Project

Answers

Exercise A
3. The following shows an example of simulating a fill rate of
50 kg/second:

Rung 3

The XIC of the .DN bit causes the timer to time, reset, and time
again whenever the gates are on (open).

Rung 4

Sim_Fill_Time.DN turns on for one scan every second that the


gates are open. When the bit turns on, the ADD instruction adds
50 kg to the weight. This simulates a fill rate of 50 kg/second.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCMe56r

Exercise: Programming Math Instructions in an RSLogix 5000 Project

6--13

4. The following shows one way to calculate the number of loads:

Rung 14

Rev. June 2012

IF System_Command turns on, THEN the DIV instruction


divides Weight_Total by Weight_Load and stores the answer in
Number_Of_Loads. The ONS instruction limits the operation to
one scan when System_Command turns on.

E 2012 Rockwell Automation, Inc. All rights reserved.


PCMe56r

6--14

Exercise: Programming Math Instructions in an RSLogix 5000 Project

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCMe56r

Lesson

Programming Counter Instructions


in an RSLogix 5000 Project
What You Will Learn

After completing this lesson, you should be able to program counter


instructions in an RSLogix 5000 project.

When You Will Do This


You will perform this task in the following situations:
Keep track of the number of parts in inventory
Count the number of parts to go into a box

Count how many times a certain incident occurs

Before You Begin

Counter Instruction Usage

Clarify that both of the counter


instructions count when they are
enabled. Compare this against the timer
instructions, in which the TON times
when enabled and the TOF times when
disabled.

Tip "

Counter instructions control operations based on the number of


events. There are three types of counter instructions:
CTU (Count Up): Increase a count when an event occurs

CTD (Count Down): Decrease a count when an event occurs


RES (Reset a Counter): Reset a CTU or CTD
In an RSLogix 5000 project, counters are used as output instructions.

Activity: As a group, determine the counter types for the following


situations:
Answers:
CTU
CTD

After 100 cars leave a car wash, turn on a Service Soon light.
As parts are taken out of inventory, decrement a value that
represents how many parts are still available.

Counter Structure
A counter instruction has three operands:
Counter: The structure where information from the counter is
stored.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


CNTsb56r

7--2

Programming Counter Instructions in an RSLogix 5000 Project

Preset Value (.PRE): The value which the accumulated value

Tip "

must reach before the instruction sets the .DN bit.


The maximum value for counting up is +2,147,483,647. The
minimum value for counting down is - 2,147,483,648.

Accumulated Value (.ACC): The number of of transitions the


instruction has counted. If accumulated = 50, that means 50
events have occurred.
Tag Name

How High to Count


Number of Times the
Counter Has Counted

Emphasize and make sure that students


understand that the COUNTER structure
stores status bits and the preset and
accumulated values for a counter
instruction.

Briefly mention that the .OV and .UN bits


are seldom needed when using
counters.

Data associated with a counter instruction is stored in members of a


COUNTER structure. The members each have their own tags and
hold preset, accumulated, and status bit data:

Preset Value
Accumulated Value
Count Up Bit
Count Down Bit
Done Bit
Overflow Bit
Underflow Bit

Counter Status Bits: A function to tell the controller the status


of the counter instruction:

Emphasize that all instruction Enable


bits (.EN, .CU, and .CD) are true when
ON = 1 when a rung is TRUE and false
when OFF = 0 when a rung is FALSE.

Counter Instruction Status Bit

Indicates

.CU (enable)

The count up instruction is enabled.

.CD (enable)

The count down instruction is enabled.

.DN (done)

.ACC >= .PRE

.OV (overflow)

The counter instruction has counted above the


upper limit of +2,147,483,647.

.UN (underflow)

The counter instruction has counted below the


lower limit of --2,147,483,648.

With counter instructions, the accumulated value continues


incrementing/decrementing even after the .DN bit is set (i.e., the
accumulated value can be greater than the preset value).

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


CNTsb56r

Programming Counter Instructions in an RSLogix 5000 Project

7--3

The table displays how to use the status bits:


If you want to . . .

And . . .

Then . . .

Trigger events based on


the count

You need to trigger at only


1 count

Set the counters .PRE to the


trigger value and examine
the counters .DN bit for ON.

Trigger events based on


the count

You need to trigger at more


than 1 count

Read the counters .ACC at


the required counts.

Change the value the


counter counts to

Write the new value to the


counters .PRE.

Reset the .ACC value to 0

Use an RES instruction.

Trigger the counter to


clear out the accumulated
value

Inform the operator that a


specific count has
exceeded the maximum
setpoint of +2,147,483,647

Use the .OV bit to set a 1 as


the XIC for a RES instruction.

Use a status bit within the


counter to control the
instructions actions

Ensure that your counter


never reaches the
minimum value of
--2,147,483,648

Use the .UN bit to clear the


accumulated value.

CTU (Count Up) instruction


A CTU instruction is used to count up by one every time the rung is
true and the instruction is enabled:

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


CNTsb56r

7--4

Programming Counter Instructions in an RSLogix 5000 Project

Use the steps below to help guide


you during the demonstration:
1. Go online with the
CNT_1756R_DEM1.acd file.
2. In the CTU_Routine, show the
students how the CTU instruction
works.
3 Expand the CTU_Demo tag in the
Monitor Tags window so the
students can see the correlation
between the tags and the ladder
logic.
4 Point out the importance of using an
RES instruction on a CTU
instruction, or the counter will
continue counting and the .DN bit
will remain set.
5 Set the .ACC value to
+2,147,483,647 and enable the
counter one more time to show that
the .ACC value goes to
--2,147,483,648 and that the .OV bit
turns on. Point out that the .OV bit
holds the .DN bit on.

Activity: As a group, determine the following as your instructor


demonstrates the CTU instruction:

What happens when Pushbutton_DI4 is enabled?

Once the .DN bit is set, how long will it stay set?

When will the accumulated value equal the preset value?


What happens when the accumulated value equals the preset
value?

CTD (Count Down) Instruction


A CTD instruction is used to count down by one every time the rung
is true and the instruction is enabled. It is usually used with a CTU
instruction but can be used separately:

The CTU and CTD instructions increment or decrement from the same total count.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


CNTsb56r

Programming Counter Instructions in an RSLogix 5000 Project

Use the steps below to help guide


you during the demonstration:
1. In the CTD_Routine, show the
students how the CTD instruction
works.
2 Mention that the CTD instruction is
typically used with a CTU instruction
that references the same counter tag
value.
3 Point out the importance of using an
RES instruction on a CTD
instruction, or the counter will
continue counting and the .DN bit
will remain disabled.
4. Mention that the .UN bit turns on if
the .ACC bit goes below
--2,147,483,648 and the .UN bit will
hold the .DN bit off.

7--5

Activity: As a group, determine the following as your instructor


demonstrates the CTD instruction:

What happens when Pushbutton_DI0 is enabled?


When will the accumulated value equal the preset value?
What happens when the accumulated value is less than the
preset value?

RES (Reset) Instruction

If a part is in front of a sensor causing


the counters .CU bit to go high and a
reset occurs while the .CU bit is high,
the counter will count that part again.
The reset rung should be conditioned to
ensure the .CU bit is off, ensuring that
there is no part in front of the sensor
before the reset occurs.

An RES instruction is used to reset timer and counter instructions. It


will typically reference either a TON, RTO, CTU, or CTD
instruction by its tag.

Explain that the counters can be


reset at any time (for instance,
before or after accumulated is
equal to, less than, or more than the
preset value).

Activity: Follow along as your instructor demonstrates the RES


instruction, and notice that when Reset_Counter_1_DI6 transitions
from false-to-true, counters CTU and CTD are reset.

Rev. June 2012

When an RES instruction is true, the accumulated value and the bits
of either a timer or counter instruction for the referenced tag data
type are cleared to 0 (reset):

E 2012 Rockwell Automation, Inc. All rights reserved.


CNTsb56r

7--6

Programming Counter Instructions in an RSLogix 5000 Project

Heres How

To program counter instructions.

IMPORTANT: To meet IACET CEU


requirements and fully prepare
certificate students for the final exam,
you must demonstrate all lesson
objectives using the proper job aids.

Demonstration Checklist
You should have already demonstrated
the counter instructions.

Pay attention to these critical aspects of the demonstration:

E 2012 Rockwell Automation, Inc. All rights reserved.

Do you know what happens to the status bits when rung


conditions are true for a CTU instruction?

Did your instructor show you the following?


- Where to create a counter instruction
- How to get help for an instruction
- How to interpret true and false rung conditions for
CTU, CTD, and RES instructions

Rev. June 2012


CNTsb56r

Exercise: Programming Counter Instructions in an RSLogix 5000 Project

7--7

Exercise: Programming Counter


Instructions in an RSLogix 5000
Project
Exercise A

Practice programming counter instructions to count parts and cartons


during a loading operation.
Context:
Part_Loaded_Photoeye

Carton_Full

Parts
Carton_In_Position_Photoeye

Carton

Parts travel along a conveyor and are loaded into cartons. When the
carton is full, it leaves the loading area and an empty carton replaces
it.
Use these workstation devices to represent the equipment of the part
loader:
Tag Name

Alias For

Workstation
Device

Part_Loaded_Photoeye

Local:2:I.Data.8

DI8

Carton_In_Position_Photoeye

Local:2:I.Data.12

DI12

Carton_Full

Local:0:O.Data.2

DO2

When you see underlined text, refer to the related procedure or


information in your job aid.
Directions:
1. Open the CNT_1756R_A1.acd project file.
2. Create a routine for the part loader.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


CNTe56r

7--8

Exercise: Programming Counter Instructions in an RSLogix 5000 Project

3. Program the part loader routine to meet the following


requirements:
- Every part that goes into a carton is counted. The
Part_Loaded_Photoeye turns on every time a part goes into a
carton.
- If a carton has 8 parts, the Carton_Full light turns on. This
signals that the carton is full.
- Every full carton is counted, up to 200,000 cartons.
- The part count is reset when the Carton_In_Position_Photoeye
changes from off to on. This means a new, empty carton is in
position for loading.
4. Download the project to slot 1 of your workstation.
5. Put the controller in Run mode.
6. Test your code and make sure it meets requirements. The
following are suggestions for testing:
To simulate that a carton is in the loading position, turn on
Carton_In_Position_Photoeye.
To simulate a part going into a carton, turn on
Part_Loaded_Photoeye.
To simulate a full carton leaving and an empty carton arriving,
turn Carton_In_Position_Photoeye off and then on again.
Check off each requirement as you meet it. You do not have
to verify that the carton counter counts up to 200,000. Verify
that it counts up.
7. Save the project.
8. Go offline.

How Did You Do?

E 2012 Rockwell Automation, Inc. All rights reserved.

Turn to the Answers section.

Rev. June 2012


CNTe56r

Exercise: Programming Counter Instructions in an RSLogix 5000 Project

Exercise B

7--9

Practice programming counter instructions to keep track of the


number of parts in a buffer.
Context:
Conveyor A
Buffer_Overflow

Buffer

Conveyor B
Buffer_Out_Photoeye

Buffer_In_Photoeye

A production sequence uses a buffer between two conveyors to keep


a steady flow of parts on the second conveyor:
The conveyors sometimes run at different speeds.

If Conveyor A runs too fast for too long, Conveyor B gets too
many parts.

If Conveyor A runs too slow for too long, Conveyor B runs out of
parts.
The buffer gives Conveyor A time to adjust its speed while
keeping Conveyor B full.

Use these workstation devices to represent the equipment of the part


loader:
Tag Name

Alias For

Workstation Device

Buffer_In_Photoeye

Local:2:I.Data.4

DI4

Buffer_Out_Photoeye

Local:2:I.Data.5

DI5

Buffer_Overflow

Local:0:O.Data.1

DO1

When you see underlined text, refer to the related procedure or


information in your job aid.
Directions:
1. Continue with the project file from the previous exercise.
2. Create a routine for the conveyor buffer.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


CNTe56r

7--10

Exercise: Programming Counter Instructions in an RSLogix 5000 Project

3. Program the conveyor buffer routine to meet these requirements:


- Keep an accurate count of the parts in the buffer.
Notes:
-- The Buffer_In_Photoeye turns on every time a part enters
the buffer.
-- The Buffer_Out_Photoeye turns on every time a part leaves
the buffer.
- If the buffer has more than ten parts, the Buffer_Overflow
light turns on.
4. Download the project to slot 1 of your workstation.
5. Put the controller in Run mode.
6. Test your code and make sure it meets requirements. The
following are suggestions:
To simulate parts entering and leaving the buffer, use the
Buffer_In_Photoeye and Buffer_Out_Photoeye.
Check off each requirement as you meet it.
7. Save the project.
8. Go offline.

How Did You Do?

E 2012 Rockwell Automation, Inc. All rights reserved.

Turn to the Answers section.

Rev. June 2012


CNTe56r

Exercise: Programming Counter Instructions in an RSLogix 5000 Project

Rev. June 2012

7--11

E 2012 Rockwell Automation, Inc. All rights reserved.


CNTe56r

7--12

Exercise: Programming Counter Instructions in an RSLogix 5000 Project

Answers

Exercise A
3. The following graphic shows one way to count the parts and
cartons:

Rung 0

If Part_Loaded_Photoeye turns on, add 1 to Part_Count.ACC.

Rung 1

If 8 parts in carton, turn on Carton_Full light and add 1 to


Carton_Count.ACC.

Rung 2

If Carton_In_Position_Photoeye goes from off to on, set


Part_Count.ACC to 0.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


CNTe56r

Exercise: Programming Counter Instructions in an RSLogix 5000 Project

7--13

Exercise B
3. The following graphic shows one way to count the parts in the
buffer:

Rung 0

If Buffer_In_Photoeye turns on, add 1 to Buffer_Count.ACC.

Rung 1

If Buffer_Out_Photoeye turns on, subtract 1 from


Buffer_Count.ACC.

Rung 2

If Buffer_Count.ACC is greater than or equal to 11, turn on


Buffer_Overflow.
You want the buffer to hold up to ten parts. You do not want the
.DN bit of the counter to enable until the eleventh part enters the
buffer.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


CNTe56r

7--14

Exercise: Programming Counter Instructions in an RSLogix 5000 Project

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


CNTe56r

Lesson

Handling Expressions in an
RSLogix 5000 Project
What You Will Learn

After completing this lesson, you should be able to program compare


and compute instructions to handle expressions in an RSLogix 5000
project.

When You Will Do This


You will perform these tasks when you need to provide a final result
for multiple math or logical operations in a single instruction. Some
examples are:
Conversion of each element for the specific purpose of
comparison
Complex math functions and equations displayed in their order of
operations

Before You Begin

CMP (Compare) and CPT (Compute) Instructions

Mention that any instruction help is


available by selecting the instruction and
pressing F1 (Windows default Help key).
Point out that there are two instructions
that handle expressions at the element
level.

CPT (Compute) Instruction

Tip "

Mention that the CMP instruction can be


used in series or parallel with other input
conditions on the rung.

Tip "

To help clarify expressions, refer


students to the Documentation
Reference Guide for CMP
Tip
expressions, valid operators,
formatting expressions, and
determining the order of operation.

Rev. June 2012

There are two instructions that always handle expressions at the


word level:
CMP (Compare) Instruction

"

An instruction executes faster and requires less memory if all the


operands of the instruction use the same optimal data type, typically
DINT or REAL.

CMP (Compare) Instruction


The CMP instruction is an input instruction that compares the
arithmetic operations specified in an expression. The expression:
Defines the operations to perform
Is defined with operators, tags, and immediate values
Parentheses () are used to define sections of more complex
expressions.
The CMP instruction affects the arithmetic status flags only if the
expression contains a math operator (e.g., +, -, *, /) that affects the
arithmetic status flags.

E 2012 Rockwell Automation, Inc. All rights reserved.


EXXsb56r

8--2

Handling Expressions in an RSLogix 5000 Project

Tell students that the expressions in this


graphic are tags.

Tip "

In the following graphic, if the CMP instruction finds the expression


true, the rung-condition-out is set to true:

The advantage of using a CMP instruction is that it allows you to


enter complex expressions in one instruction.
If entering an expression without a compare operator that affects the
arithmetic status flag in a CMP instruction, such as value_1 +
value_2, or value_1, the instruction evaluates the expression as
follows:

Use the steps below to help guide


you during the demonstration:
1. Open the EXX_1756R_DEM1.acd
file.
2. In the CMP routine, demonstrate
how the CMP instruction works.
3. Tell students the execution of a CMP
instruction is slightly slower and
uses more memory than the
execution of other compare
instructions.
4. Demonstrate how to create valid
operators in the CMP instruction.
After placing the CMP instruction on
the rung, double-click Expression
and type the valid operators.

E 2012 Rockwell Automation, Inc. All rights reserved.

If the expression is . . .

The rung-condition-out is set to . . .

Non zero

True

Zero

False

Activity: Follow along as your instructor demonstrates the CMP


instruction. Answer the questions and notice the key points:

The High_Furnace_Temp_Alarm occurs when Furnace_Temp


reaches what temperature in Fahrenheit? In Celsius?

The value of different ranges can be scaled and compared in a


single instruction.

When placing the cursor over the tag name, RSLogix 5000
software will show tag information and the value.

Rev. June 2012


EXXsb56r

Handling Expressions in an RSLogix 5000 Project

8--3

CPT (Compute) Instruction


Point out the length of the Expression in
this example and that tags can be
selected in the Expression editor.

The CPT instruction is an output instruction that performs the


arithmetic operations defined in the expression.
When enabled, the CPT instruction evaluates the expression and
places the result in the destination (Dest):

Refer students to the previous graphic


where the Expression in the CPT
instruction has the raw material weights
grouped together in parentheses. This
will cause the addition of the weights
before the division of the sum total which
will provide the average of the
Tip "
raw material weight.

Tip "

The execution of a CPT instruction is slightly slower and uses more


memory than the execution of the other math instructions. The
advantage of the CPT instruction is that it allows you to enter
complex expressions in one instruction.
There is no limit to the length of an expression.
You can mix data types, but loss of accuracy and rounding errors
may occur, and the instruction may take more time to execute.
The CPT instruction executes once each time it is
scanned as long as the rung-condition-in is true.
To evaluate the expression only once, use a
one-shot instruction to trigger the instruction.

In the CPT routine, demonstrate


how the CPT instruction works.
Use the Quick Watch to enter data
and observe tag values.

Rev. June 2012

Activity: Follow along as your instructor demonstrates the CPT


instruction and notice the key points:

The CPT instruction math functions could be programmed


using individual math instructions. What advantage does the
CPT instruction provide?

CPT instructions are typically used for more complex math


functions just prior to being compared or displayed.

E 2012 Rockwell Automation, Inc. All rights reserved.


EXXsb56r

8--4

Handling Expressions in an RSLogix 5000 Project

The Expression Order of Operation


To help clarify expressions, refer
students to the Documentation
Reference Guide for valid operators,
formatting expressions, and determining
the order of operation.

The CPT instruction performs arithmetic operations in a particular


order, not necessarily the order in which they are written. Grouping
terms within parentheses can override the order of operation because
an instruction will perform an operation within parentheses first.
Operations of equal order are performed from left to right:

Heres How

Order

Operation

( )

ABS, ACS, ASN, ATN, COS, DEG, FRD, LN, LOG, RAD, SIN,
SQR, TAN, TOD, TRN

**

-- (negate), NOT

*, / , MOD

-- (subtract), +

AND

XOR

OR

To program CMP and CPT instructions.

IMPORTANT: To meet IACET CEU


requirements and fully prepare
certificate students for the final exam,
you must demonstrate all lesson
objectives using the proper job aids.

Demonstration Checklist
You should have already demonstrated
the CMP and CPT instructions.

Pay attention to these critical aspects of the demonstration:

E 2012 Rockwell Automation, Inc. All rights reserved.

Do you know what to use when defining sections of more


complex expressions in a CMP instruction?

Did your instructor show you the following?


- Where to create a CMP and CPT instruction
- How to get help for an instruction
- How to interpret true and false rung conditions for
CMP and CPT instructions

Rev. June 2012


EXXsb56r

Exercise: Handling Expressions in an RSLogix 5000 Project

8--5

Exercise: Handling Expressions in


an RSLogix 5000 Project
Exercise A

Practice programming CMP and CPT instructions to handle


expressions.
Context:
Part

Photoeye

Parts/Minute

Suppose your equipment uses a photoeye to signal each time a part is


produced. You want to calculate the production rate of the
equipment. You do not have access to the equipment yet, so you
decide to simulate the action of the photoeye.
When you see underlined text, refer to the related procedure or
information in your job aid.
Directions:
1. Open the EXX_1756R_A1.acd project file.
2. Set up a subroutine called Calculate_Production_Rate.
3. Open the Calculate_Production_Rate subroutine and complete the
programming in that routine.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


EXXe56r

8--6

Exercise: Handling Expressions in an RSLogix 5000 Project

4. Simulate the photoeye as it repeatedly turns off and on as parts go


by. The photoeye should toggle back and forth between off for
1 second and on for 1 second, like this:
2000 ms

Sim_Photoeye

The following are suggestions:


- Create a tag for the simulated photoeye. Use the BOOL
data type for the tag.
- Use a free--running timer to give you a 2000 ms period. A
free-running timer automatically runs, resets itself, and
runs again. For the timers input condition, use an XIO
instruction that checks the timers .DN bit.
- Use an expression as the off/on condition for photoeye.
Use the 2000 ms period in the expression.
5. Count the number of simulated parts, up to 2,000,000,000. The
photoeye turns on each time a part goes by it.
6. Calculate the production rate in parts/minute, where:
Production rate = Change in number of parts/change in time
The following are suggestions:
- Use a free-running timer to trigger the calculation every
10 seconds. This give you the change in time for the
calculation.
- Store the previous .ACC count of parts in a tag. Use the
DINT data type for the tag. Update the tag after every
production rate calculation.
- Store the production rate in a tag. Use the REAL data type
for the tag.
7. Download the project to slot 1 of your workstation.
8. Put the controller in Run mode.
9. Make sure your code calculates the correct production rate. To
test it, enter different preset values in the timer for the photoeye:
If the photoeye timers .PRE is . . .

The parts/minute should be . . .

2000 ms

30.0

1000 ms

60.0

500 ms

120.0

10. Save the project.


11. Go offline.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


EXXe56r

Exercise: Handling Expressions in an RSLogix 5000 Project

How Did You Do?

Rev. June 2012

8--7

Turn to the Answers section.

E 2012 Rockwell Automation, Inc. All rights reserved.


EXXe56r

8--8

Exercise: Handling Expressions in an RSLogix 5000 Project

Answers

Exercise A
2. Use the MainRoutine to call the subroutine:

4. The following graphic shows one way to simulate the action of


the photoeye:

Rung 0

The timer continuously times for 2000 ms, resets, and times
again.

Rung 1

If .ACC of the timer is greater than half the PRE, turn on


Sim_Photoeye. Otherwise, turn off Sim_Photoeye.
This causes the Sim_Photoeye to flash on and off at half the
preset of the timer.

Rung 2

E 2012 Rockwell Automation, Inc. All rights reserved.

If Sim_Photoeye changes from off to on, count up 1.

Rev. June 2012


EXXe56r

Exercise: Handling Expressions in an RSLogix 5000 Project

8--9

6. The following graphic shows one way to calculate the


production rate:

Rung 3

The timer sets its .DN bit every 10 seconds.

Rung 4

Every 10 seconds:

Subtract the current part count from the last part count, and

then multiply it by 6 (6 samples/minute). This produces the


parts/minute.
Set the last part count = current part count.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


EXXe56r

8--10

Exercise: Handling Expressions in an RSLogix 5000 Project

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


EXXe56r

Lesson

Documenting and Searching


Ladder Logic Using RSLogix 5000
Software
What You Will Learn

After completing this lesson, you should be able to:


Document a project component

Search for and replace project components


Point out that every project is unique.
Having the programmer document his
intent for a rung will be an invaluable
tool if he is not available at the time of a
problem.

Before You Begin

When You Will Do This


You will perform these tasks in the following situations:
When you want to add text elements to describe the function of
ladder logic
When you want to find or change known tags, documentation,
etc.

Documenting a Project Component


One of the most important things a programmer should do when
programming ladder logic is to include documentation in the project.
This is critical because often the people responsible for
troubleshooting a project are different than the people who
developed it.

Remind students that they may have to


troubleshoot their own work some day,
so documenting changes is important.
Note that in RSLogix 5000 software, you
can set a fixed width for all components
that display descriptions (10 to 40
characters). This provides a consistent
view in all tag editors, code editors, tag
properties, etc.
Point out that this thumbtacked note
looks similar to SFC text boxes. This
option can be selected on the Language
Elements toolbar.

Standard Documentation: Various text elements that describe the


functions of ladder logic, function block diagrams, and sequential
function charts:
Rung Comment: Describes the function of a ladder logic rung.
Main Operand Description: Describes the function of the main
tag being operated on by the instruction.
User-Defined Data Type (UDT) Description: Describes the data
type itself and each member of the data type.

Text Box:
-- Can be free form or anchored to an instruction block
-- Is stored offline in the .acd project file
Other: Descriptions for various components such as tasks,
programs, routines, tags, etc.

Tip "

Auto-generated tag descriptions are visible in the tag editor in grey.


Question: What types of documentation do you use for your
projects?

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


DL2sb56r

9--2

Documenting and Searching Ladder Logic Using RSLogix 5000 Software

Tip "

Point out that the number of lines that


can be displayed can be adjusted in the
Workstation Options.

Starting with version 17 of RSLogix 5000 software, you may be able


to view and edit documentation in multiple languages if the original
programmer enabled this option.
Tag operand descriptions are tied to the main
operand (primary tag) and appear everywhere the
tag appears regardless of the instruction.

Standard documentation resides outside of the


controller in a computer file only:

Descriptive
Text

Tags and Other


Data

Different descriptions can be attached to a


user-defined data type at different levels (e.g., tag
and member). If a description is applied to the tag
and each member the descriptions will be merged:

User-Defined Data Type Member Descriptions


Tag Description
Merged Descriptions

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


DL2sb56r

Documenting and Searching Ladder Logic Using RSLogix 5000 Software

9--3

Search Options
Note that the ability to search
documentation is a unique and powerful
search option not found in many other
software packages.
If anybody asks, there is a Browse logic
search option, but this is more for a
maintainer. For this option to be useful, a
programmer must add descriptions to
programs and critical routines.

The following search options are available in RSLogix 5000


software:
This search
menu option . . .

Will . . .

Go To

Go to a specific rung, grid location, routine properties dialog box, edit


mode, or cross-reference dialog box.

Find

Find and display occurrences of a specified component, such as a tag,


piece of documentation, edit zone, force, etc..

Replace

Find and replace a specified project component.

Cross-Reference

Create a comprehensive cross-reference table of each occurrence of a


specific tag and its location in programming language.

Searching For and Replacing a Project Component


The search function contains many detailed options that help you
find specific tags, instructions, or other components.
If the correct components of a project are not
selected in the Find Within dialog box, the search
may not find all occurrences.

Give other examples of search words


and what the results would yield if the
Match Whole Word option is selected or
cleared.

Match Whole Word Only


The Match Whole Word Only option can limit the number of
occurrences found:
If Match Whole
Word Only is . . .
Selected

Cleared

Then the search will find . . .

Example: if the search word


is error, results will include. . .

Any occurrence of the whole


word.

Error

All occurrences containing the


text.

Error
Errors
Error1
Error_Flag
MathError

Chalk Talk: List other search terms on the board and discuss how
they can be affected by the Match Whole Word Only option.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


DL2sb56r

9--4

Documenting and Searching Ladder Logic Using RSLogix 5000 Software

Searching by Cross-Reference
Mention that to select the
Cross-Reference option from a
right-click menu, you must right-click the
tag and not the instruction.

Cross-Reference Report: A table that shows where tags are used in


code.
Destructive Bit: An output bit that can be changed by another
instruction, impacting its true/false condition.
Display Tabs

Remind students that a Y in the


destructive column indicates that the
instruction can change the value of the
tag.

The following display tabs are available in the cross-reference


report:
By Logic Tab: Displays all locations in code that reference a
piece of text:

-- If all outputs in an entire routine seem to be inactive,


cross-reference the JSR instruction and view the results on the
By Logic tab.
By Tag Tab: Displays all tags that are alias tags for the selected
tag.

Tag Hierarchy Tab: Allows you to view alias and base tags.
Depending on the type of component selected, the following display
tabs are available:
If the
Component
Type Is . . .

By Logic

By Tag

Tag Hierarchy

Tag

Then you can view the following results:

Data type

Routine

Program

Equipment
Phase

Add-On
Instruction

Task

Module

Label

Bookmark Toolbar
Remind students how to view toolbars
by adding this bar to your software.

When performing complex cross-reference searches, one tool that


can help organize the search is the bookmark toolbar:

This toolbar allows you to mark rungs containing key output


instructions and then return to them quickly, which speeds logic
tracing.
E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


DL2sb56r

Documenting and Searching Ladder Logic Using RSLogix 5000 Software

Heres How
IMPORTANT: To meet IACET CEU
requirements and fully prepare
certificate students for the final exam,
you must demonstrate all lesson
objectives using the proper job aids.

9--5

To perform the following tasks:


Document a project component
Search for and replace project components
Activity: As your instructor demonstrates these procedures, follow
along in the associated job aid(s).

Demonstration Checklist
Use the steps below to help guide you
during the demonstration:
Open the DL2_1756R_DEM1.acd file.
When demonstrating the listed
procedures, point out the following:
S

How to go to a specific component


using the search method from the
main menu

The vast options available in the


search dialog box. Be sure to point
out the Find Within option.

When searching by cross-reference,


show students how they can use the
[CTRL] + [TAB] key combination to
toggle between the cross-reference
window and the ladder window.

Show students how to turn on the


Bookmark toolbar and show how it
can be used.

Rev. June 2012

Pay attention to these critical aspects of the demonstration:


-

Which buttons modify or hide documentation text.

Where you find the Routine Attributes buttons (Show full


line, Truncate text, wrap text, toggle routine
documentation).

Go to a specific component using the search method


from the main menu.

What could happen if the Find Within dialog box is not


used properly during a search?

While performing a cross-reference, use the Bookmark


toolbar to mark several rungs and to move between
them.

Which column in the cross-reference dialog box helps


identify which instruction(s) control a tag?

E 2012 Rockwell Automation, Inc. All rights reserved.


DL2sb56r

9--6

Documenting and Searching Ladder Logic Using RSLogix 5000 Software

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


DL2sb56r

Exercise: Documenting and Searching Ladder Logic Using RSLogix 5000 Software

9--7

Exercise: Documenting and


Searching Ladder Logic Using
RSLogix 5000 Software
Exercise A

Practice documenting and searching ladder logic.


Context:
As a programmer for Steel, Inc., you are responsible for portions of
the Logix5000 ladder logic projects in the steel mill process. You
have recently discovered a project that was created by an outside
vendor many years ago. A portion of the project contains some
documentation, but another portion is very limited and therefore is
not easy to understand.
You must analyze the complete project and determine if the timer in
both subroutines has the same preset value. You must also
incorporate your own documentation to aid in future troubleshooting
and reduce downtime.
When you see underlined text, refer to the related procedure or
information in your job aid.
Directions:
1. Open the DL2_1756R_A1.acd project file.
2. Navigate to the MainRoutine and read the rung comments to
become familiar with the project.
3. Navigate to the subroutines and notice the differences and
similarities between the two.
4. Open the South_Conveyor_System subroutine.
5. Search for the main operand (tag) South_Timer. What is the
preset value?

6. Search for the timer in the North_Conveyor_System subroutine.


7. Determine if both North and South conveyors have the same
preset value.
8. In the South_Conveyor_System subroutine, search and replace
the main operand (tag) South_Timer with S_Conveyor_Timer
tag.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


DL2e56r

9--8

Exercise: Documenting and Searching Ladder Logic Using RSLogix 5000 Software

9. Write down the preset values for both conveyor systems:

10. In the South_Conveyor_System subroutine (Current Routine),


search for a count up counter (CTU) with text (Text Only). Be
sure to Find All occurrences.
11. How many occurrences did you find for the count up counter
(CTU)?

12. In the Find in Routines dialog box, expand the Find Within
section and select the correct check boxes to search for Ladder
Diagram Instructions only.
13. Find All occurrences again.
14. Write the results from the window indicating how many
occurrences and the location of the item(s):

15. Search for the base tag Local:0:O.Data.1 and add the following
tag description:

-- Digital output 1 amber light indicator.


16. In the North_Conveyor_System subroutine, add the following
rung comment to rung 2:

-- The output on this rung will indicate that the north conveyor
timer is enabled.
17. Using documentation from the South Conveyor subroutine, go to
the North Conveyor subroutine and enter the main operand (tag)
descriptions that are similar.

Tip "

Enter documentation that will specifically refer to the North Routine,


which identifies the function of the main operands (tags).
18. Save your changes.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


DL2e56r

Exercise: Documenting and Searching Ladder Logic Using RSLogix 5000 Software

How Did You Do?

Rev. June 2012

9--9

Turn to the Answers section.

E 2012 Rockwell Automation, Inc. All rights reserved.


DL2e56r

9--10

Exercise: Documenting and Searching Ladder Logic Using RSLogix 5000 Software

Answers

Exercise A
5. The main operand (tag) South_Timer on rung 5 has a preset
value of 15000 ms (15 seconds).
7. The North and South conveyor timers do not have the same
preset value.
9. The timer in the North_Conveyor_System subroutine is located
on rung 5 and has a preset value of 5000 ms (5 seconds). The
timer in the South_Conveyor_System subroutine is located on
rung 5 and has a preset value of 15000 ms (15 seconds).
11. You should find four occurrences.
14. The results of your search for the count up counter instruction
in the subroutine South_Conveyor_System should be as
follows:

-- 1 occurrence found
-- CTU found on rung 6
15. The base tag Local:0:O.Data.1 should have the following tag
description in RSLogix 5000 software:

16. The following rung comment should be in the


North_Conveyor_System subroutine:

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


DL2e56r

Exercise: Documenting and Searching Ladder Logic Using RSLogix 5000 Software

9--11

17. The following graphics show what your answer should look
like after making the appropriate changes as specified:
These instructions
are from rung 1.

This instruction is
from rung 5.

This instruction is
from rung 6.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


DL2e56r

9--12

Exercise: Documenting and Searching Ladder Logic Using RSLogix 5000 Software

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


DL2e56r

Lesson

10

Programming a Procedure in an
RSLogix 5000 Project
What You Will Learn

After completing this lesson, you should be able to set up a


sequencer to run your equipment through a predefined procedure.

When You Will Do This


You will perform this task in the following situations:
Easier to read code since it looks like your production procedure
Reduce the amount of interlocking that you have to perform

Fast troubleshooting because it shows you which step has the

problem
Easy modification of code because you can insert or rearrange
steps as needed

Before You Begin

An example of a single action is to start


a motor. An example of several actions
at the same time is opening a valve and
running a timer.

Rev. June 2012

Overview of a Sequencer
A sequencer is a programming method that steps your equipment
through a sequence of actions (procedure). It uses these components:
Step: An action or several related actions that you want the
sequencer to perform. A step can perform a single action or it can
perform several actions at the same time.
Transition: The condition or conditions that tell the sequencer to
go to the next step.

E 2012 Rockwell Automation, Inc. All rights reserved.


SEQsb56r

10--2

Programming a Procedure in an RSLogix 5000 Project

Example: Sequencer
This sequencer steps a traffic light through the green, yellow, and red
lights. We left it simple to focus on the parts of a sequencer. The
sequencer for a real traffic signal would probably include lights for
all directions of traffic:

Step

Transition

Step

Transition

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SEQsb56r

Programming a Procedure in an RSLogix 5000 Project

10--3

Organizing Steps
For your procedure, organize your steps logically. A step can:
Start equipment and another step can stop the equipment

Mark the conditions that specify when your equipment completes


an activity

The following are examples of steps.


Example: Run Equipment While a Step Is Active
In the traffic light example, the green light is on only while the
sequencer is at step 1. The light turns off when the sequencer goes to
the next step.

Example: Start Equipment


This step provides the start command to a motor. The motor stays on
when the sequencer leaves this step. Another step would issue a Stop
command.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


SEQsb56r

10--4

Programming a Procedure in an RSLogix 5000 Project

Example: Wait for a Change in the Equipment


This step marks a waiting period while a feed line fills a tank. When
the tank is full, Feed_01_State turns off. When that happens, the
sequencer goes to the next step.

Identifying Transition Conditions


Keep these points in mind as you choose transition conditions:
Use enough transition conditions to make sure that the step
completes its actions before going to the next step.

Consider situations when the sequencer could be interrupted and

then resumed later on. When it resumes, make sure the sequencer
stays at the current step as long as needed or resets to a
predetermined step/condition.

Examples: Transition Conditions


This step (step 1) provides the start command to a motor. The
transition checks the auxiliary contact of the motor starter to verify
that the motor is on. If the motor is on, the sequence goes to the next
step (step 2):

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SEQsb56r

Programming a Procedure in an RSLogix 5000 Project

10--5

This step (step 2) gives a Forward Run command to a VFD. The


transition checks the status values of the VFD to verify that the drive
is running forward, and NOT in a faulted condition. If the VFD is
running in the forward direction and is NOT faulted, the sequence
goes to the next step (step 3).

Heres How

To set up a sequencer.

IMPORTANT: To meet IACET CEU


requirements and fully prepare
certificate students for the final exam,
you must demonstrate all lesson
objectives using the proper job aids.
Use the steps below to help guide you
during the demonstration:
Use the SEQ_1756R_DEM1.acd file to
demonstrate.
1.

2.

Actions

Notes
Add other input conditions as needed.

1.

Clear the step number on the first scan.

Example: You can add a branch with an input that lets you manually trigger the rung.
Depending on your application, you may need to perform additional reset actions, such as
turning off any latched bits.

2.

Start the sequence.

Add other input conditions as needed.


The ONS instruction limits this action to the first scan when the rung goes true. Otherwise,
the MOV instruction would keep the sequence at Step 1.
(Continued)

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


SEQsb56r

10--6

Programming a Procedure in an RSLogix 5000 Project

3.

4.

5.

Last Step

6.

Actions

Notes
Add other input conditions as needed.

3.

Set up a step number.

4.

Take action.

Example: Suppose your equipment has a status bit that shows if it is faulted. In that case,
check that status bit.
Use caution if you latch a bit. The bit stays on even after a power loss or
mode change. Turn off (unlatch) the bit as needed to keep your equipment in
a safe state..

5.

Program the transition.

Use enough transition conditions to make sure that the step completes its actions before
going to the next step.
Consider situations when the sequencer could be interrupted and then resumed later on.
When it resumes, make sure the sequencer stays at the current step as long as needed.
Use a MOV instruction to go to a specific step number.

6.

End the sequencer.

Do you want to repeat the steps?


Yes: Use a MOV instruction and go to the first step.
No: Use a CLR instruction and clear the step number.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SEQsb56r

Exercise: Programming a Procedure in an RSLogix 5000 Project

10--7

Exercise: Programming a
Procedure in an RSLogix 5000
Project
Exercise A

Practice setting up a sequencer that controls a tank.

Tank Equipment
Valve_02

Valve_01
Motor_01

Feed_01

Feed_02

Sensor_Level_2
Sensor_Level_1

Sensor_Tank_Empty
Valve_03

Drain

Tank Procedure
When the operator presses the start button, the tank runs this
procedure one time:
Action
1.

Add the first ingredient.

2.

Add the second ingredient.

3.

Mix the ingredients.

4.

Drain the tank.

Rev. June 2012

Details
A. Turn on Valve_01 and add the first ingredient to the tank from Feed_01.
B. When Sensor_Level_1 turns on, turn off Valve_01 and stop adding the ingredient.
A. Turn on Valve_02 and add the second ingredient to the tank from Feed_02.
B. When Sensor_Level_2 turns on, turn off Valve_02 and stop adding the ingredient.
A. Run Motor_01 for 30 seconds.
B. After 30 seconds, stop Motor_01.
A. Turn on Valve_03 and drain the tank.
B. When Sensor_Tank_Empty turns on, turn off Valve_03.

E 2012 Rockwell Automation, Inc. All rights reserved.


SEQe56r

10--8

Exercise: Programming a Procedure in an RSLogix 5000 Project

Workstation Devices
Use these workstation devices to represent the equipment of the tank:
Motor_01_Out

Valve_03_Out

Start

Valve_01_Out
Valve_02_Out

Sensor_Level_1

Sensor_Level_2

Tag Name

Sensor_Tank_Empty

Alias For

Workstation Device

Start

Local:2:I.Data.0

DI0

Sensor_Level_1

Local:2:I.Data.12

DI12

Sensor_Level_2

Local:2:I.Data.13

DI13

Sensor_Tank_Empty

Local:2:I.Data.14

DI14

Valve_01_Out

Local:0:O.Data.1

DO1

Valve_02_Out

Local:0:O.Data.2

DO2

Motor_01_Out

Local:0:O.Data.3

DO3

Valve_03_Out

Local:0:O.Data.4

DO4

When you see underlined text, refer to the related procedure or


information in your job aid.
Directions:
1. Open the SEQ_1756R_A1.acd project file.
2. Program the MainProgram to run the tank procedure when you
press Start.
3. Save the project.
4. Turn off the switches that represent the sensors of the tank.
5. Download the project to slot 1 of your workstation.
6. Put the controller in Run mode.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SEQe56r

Exercise: Programming a Procedure in an RSLogix 5000 Project

10--9

7. Test your code and make sure it correctly runs the procedure.
The following are suggestions:
Once you verify that a specific valve is open, turn on the
respective switch to simulate the sensor turning on.
Before you rerun the procedure, turn off all the switches.
8. When you are satisfied that the code meets requirements,
go offline.
9. Save the project.

How Did You Do?

Rev. June 2012

Turn to the Answers section.

E 2012 Rockwell Automation, Inc. All rights reserved.


SEQe56r

10--10

Exercise: Programming a Procedure in an RSLogix 5000 Project

Answers

Exercise A
2. The following is one way to set up the sequencer:

Rung 0

If this is the first scan, set Step to 0.

Rung 1

If Start turns on, go to Step 1.


The ONS instruction limits this action to the change of start from
off to on.

Rung 2

If Step is 1, turn on Valve_01_Out.


When Sensor_Level_1 turns on, go to the next step and turn off
Valve_01_Out .

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SEQe56r

Exercise: Programming a Procedure in an RSLogix 5000 Project

Rung 3

10--11

If Step is 2, turn on Valve_02_Out .


When Sensor_Level_2 turns on, go to the next step and turn off
Valve_02_Out.

Rung 4

If Step is 3, turn on Motor_01_Out and start timing.


After 30 seconds, go to the next step and turn off Motor_01_Out.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


SEQe56r

10--12

Exercise: Programming a Procedure in an RSLogix 5000 Project

Rung 5

If Step is 4, turn on Valve_03_Out.


When Sensor_Tank_Empty turns on, set Step to 0 and turn off
Valve_03_Out. This ends the sequence.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SEQe56r

Lesson

11

Separating the Procedure from


Equipment Control in an
RSLogix 5000 Project
What You Will Learn

After completing this lesson, you should be able to separate your


production procedure from your equipment control.

When You Will Do This


Explain to the students about being
careful not to get caught up in the action
of programming as-you-go, entering and
re-entering ladder logic until it works.
Always remember there may be people
in and around equipment and you can
cause personal injury to yourself or
others, and equipment damage can
occur. Mention that danger is greatly
reduced with a well-defined and
well-documented program.

Before You Begin

You will perform this task in the following situations:


Modularized programming -- form a template of the process or
machine by combining procedures
Become more productive in larger projects with multiple
programmers
Provide more robust and time critical functions for programming,
debugging and maintenance actions

Levels of Control Overview


An application usually has several levels of control:

Procedural
Control

Equipment
Control

Raise the Lift

1. Set the direction.


2. Set the speed.
3. Start the drive.

Add Water

1. Open valve 01.


2. Start pump 01.
3. Wait for limit switch 01.

Heat the Furnace

1. Lock the temperature loop.


2. Set the new temperature.
3. Monitor the temperature.

Procedural Control: Directs the overall process. It is written at a


higher level than the equipment control. It determines what the
equipment should do and when to do it. In this lesson, we will call
this the procedure.
Equipment Control: Handles specific groups of devices. It takes
direction from the procedure and performs the specific actions for
the devices.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEsb56r

11--2

Separating the Procedure from Equipment Control in an RSLogix 5000 Project

A best practice is to separate the procedure from the equipment


control. Once you have separated them, link them using command
and status tags:
Procedure

Equipment
Control

Raise the Lift

Add Water

Heat the Furnace

Command and Status


Tags

Command and Status


Tags

Command and Status


Tags

1. Set the direction.


2. Set the speed.
3. Start the drive.

1. Open valve 01.


2. Start pump 01.
3. Wait for limit switch 01.

1. Lock the temperature loop.


2. Set the new temperature.
3. Monitor the temperature.

The procedure sets the command tags and monitors the status tags.
The equipment control monitors the command tags and sets the
status tags.
Benefits
By separating the procedure from the equipment control, your
application becomes much easier to program, maintain, and edit:
You can develop and test the equipment control separate from the
procedure.

It is easier to develop the procedure without all the equipment


details embedded in the same code.

You can change the procedure without touching the equipment


control.
You can change the equipment control without touching the
procedure.

Separate the Procedure from Equipment Control


Only preview the steps. You will
demonstrate each one in the Heres
How.

The following is an overview of the steps for separating your


production procedure from your equipment code:
1. Divide the equipment into sections.
2. Identify the commands that you must give to a section to operate
it.
3. Identify the status information you need to validate the response
of a section.
4. Program the equipment control to act on the commands and
return the status.
5. Set up a sequencer to give the commands and read the status.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SPEsb56r

Separating the Procedure from Equipment Control in an RSLogix 5000 Project

11--3

Example: Separating the Procedure from Equipment Control

Action

Details

1.

The procedure gives a command to a


section of the equipment.

The procedure decides when that section of equipment should start. It does not need to
handle the details of how the equipment starts or which devices are part of that section.
The procedure does need to know if the equipment responded to the command, so it waits
for status from the equipment. When it sees that the equipment responded, the procedure
moves on to the next command.

2.

The equipment control performs the


command and returns its status.

The equipment control handles the details of how to perform the command. This includes
which devices to use, the specific actions to use them, and any interlocks or other
requirements. The equipment control also determines the status of the devices.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEsb56r

11--4

Separating the Procedure from Equipment Control in an RSLogix 5000 Project

Divide the Equipment into Sections


Keep the visuals open. Present the step
and guideline, and then apply it to the
example.
Explain that this guideline serves as a
starting point.

Example

Guideline

To identify a section of your equipment, look for a


group of devices that performs a relatively
independent activity from the rest of the equipment.

Suppose your equipment uses two conveyors. While each conveyor


usually works together, they are independent parts of the system.
Conveyor_02 Section

Conveyor_01 Section

In that case, call each conveyor its own section of equipment.

Keep the visuals open. Present the step


and guideline, and then apply it to the
example.
Explain that this guideline serves as a
starting point. It helps to rule out
unnecessary commands. You will write
your ladder diagram to actually give the
commands.

Example

Identify the Command That You Must Give to a Section to


Operate It

Guideline

To identify the commands, answer this question: What


signals or information would operators need to give
the equipment if they were manually operating it?

The following are possible commands for each of the conveyor


sections:
Conveyor_02 Section

Start
Stop
Direction
Speed
Reset Faults

E 2012 Rockwell Automation, Inc. All rights reserved.

Conveyor_01 Section

Start
Stop
Direction
Speed
Reset Faults

Rev. June 2012


SPEsb56r

Separating the Procedure from Equipment Control in an RSLogix 5000 Project

11--5

To keep it simple, assume each conveyor always moves forward at a


fixed speed and does not set fault data. The following are the
commands for each conveyor:
Conveyor_02 Section

Conveyor_01 Section

Conveyor_02_Start

Conveyor_01_Start
Conveyor_01_Stop

Conveyor_02_Stop

Identify the Status Information You Need to Operate a Section


Keep the visuals open. Present the step
and guideline, and then apply it to the
example.
Explain that this guideline serves as a
starting point.

Example

Guideline

The following are possible states for each conveyor section:


Conveyor_02 Section

State (on/off)
Actual Direction
Faulted

Rev. June 2012

To identify the status information, answer this


question: What information would an operator need
from the equipment to manually operate it?

Conveyor_01 Section

State (on/off)
Actual Direction
Faulted

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEsb56r

Separating the Procedure from Equipment Control in an RSLogix 5000 Project

11--6

To keep it simple, assume we only need the state of each conveyor.


The following shows the final list of commands and states for each
conveyor:
Conveyor_02 Section

Conveyor_01 Section

Conveyor_02_Start
Conveyor_02_Stop
Conveyor_02_State

Conveyor_01_Start
Conveyor_01_Stop
Conveyor_01_State

Program the Equipment Control to Act on the Commands and


Return the Status

Example

The following graphic shows the equipment control for one of the
conveyor sections. Notice that it is in its own routine:

Start Command

State

When the routine gets the Start command, it turns on the motor for
the conveyor. When the auxiliary contact shows that the motor is
running, the routine changes the state to on.
While this example uses only a motor, you can apply the concept to
more complex situations that use multiple pieces of equipment.
E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SPEsb56r

Separating the Procedure from Equipment Control in an RSLogix 5000 Project

11--7

Set Up a Sequencer to Give the Commands and Read the Status

Example

The following graphic shows the sequencer for the whole system:

Start Command

State

In Step 1, the sequencer turns on the Start command for the


Conveyor_01 section. When the Conveyor_01 section is in the on
state, the sequencer goes to the next step.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEsb56r

11--8

Separating the Procedure from Equipment Control in an RSLogix 5000 Project

Heres How
IMPORTANT: To meet IACET CEU
requirements and fully prepare
certificate students for the final
exam, you must demonstrate all
lesson objectives using the proper job
aids.

To separate the procedure from equipment control.


Activity: As your instructor demonstrates these procedures, follow
along.

Demonstration Checklist
Use the steps below and the information
on the Demonstration Checklist to help
guide you during the demonstration:
1. Open the SPE_1756R_DEM1 file.

Pay attention to these critical aspects of the demonstration:

2 Open the MainRoutine and put an


AFI instruction in front of the JSR for
the Conveyor_Sequencer.

Did your instructor show you how to divide the process


or machine functions into sections (procedures)?

Did your instructor show you how to define the Control


and Status tags needed for equipment operation?

Did your instructor show you how the Commands and


Status tags interact between the Procedure and its
equipment operation?

3. Show how the Conveyor_01


subroutine works by toggling the
start tag on and then off. Show that
the motor is now running.
Note: The Feedback_Simulation
routine turns on the aux contact 3 s
after the motor turns on.
4. Toggle the stop bit on and then off.
Show that the motor is off.
5. Show the logic for the Conveyor_02
subroutine.
6. Remove the AFI instruction from the
MainRoutine.
7. Open the Conveyor_Sequencer
subroutine. Press the
System_Start_Command button to
start the procedure.
8. Show each step and point out the
transition conditions.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SPEsb56r

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

11--9

Exercise: Separating the Procedure


from Equipment Control in an
RSLogix 5000 Project
Exercise A

Practice dividing the equipment into sections.


Context:
Suppose you have to program a tank that mixes 2 ingredients.
Tank Equipment
Valve_02

Valve_01
Motor_01

Feed_01

Feed_02

Sensor_Level_2
Sensor_Level_1

Sensor_Tank_Empty
Valve_03

Drain

Tank Procedure
When the operator presses the start button, the tank runs this
procedure one time:
Action
1.

Add the first ingredient.

2.

Add the second ingredient.

3.

Mix the ingredients for 30 seconds.

4.

Drain the tank.

Rev. June 2012

Details
A. Turn on Valve_01 and add the first ingredient to the tank from Feed_01.
B. When Sensor_Level_1 turns on, turn off Valve_01 and stop the ingredient.
A. Turn on Valve_02 and add the second ingredient to the tank from Feed_02.
B. When Sensor_Level_2 turns on, turn off Valve_02 and stop the ingredient.
Start and stop Motor_01.
A. Turn on Valve_03 and drain the tank.
B. When Sensor_Tank_Empty turns on, turn off Valve_03.
E 2012 Rockwell Automation, Inc. All rights reserved.
SPEe56r

11--10

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

Directions:
1. On the diagram below, divide the tank into sections and draw a
line around the equipment of each section. We did the first section
for you.
Valve_02

Valve_01
Feed_01

Motor_01

Feed_02

Sensor_Level_2
Sensor_Level_1

Sensor_Tank_Empty
Valve_03

Drain

2. Give each section a name.

How Did You Do?

E 2012 Rockwell Automation, Inc. All rights reserved.

Turn to the Answers section.

Rev. June 2012


SPEe56r

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

Exercise B

11--11

Practice identifying the commands that you must give to a section to


operate it.
Directions:
1. Heres first few steps of the mixing procedure. Notice that we
added steps to the procedure and expanded the equipment
requirements:

Mixing Procedure

Equipment Control Requirements

1.

Start adding the first ingredient through


Feed_01.

If the procedure calls for Feed_01 AND the stop signal is off AND Sensor_Level_1 is off,
turn on Valve_01.
When Sensor_Level_1 turns on OR the stop signal turns on, turn off Valve_01.
Notes:
Valve_01 stays on even if the procedure turns off the call for Feed_01.
Sensor_Level_1 turns on when the tank has enough of ingredient 1.
The stop signal gives someone the option to manually stop the feed.

2.

Wait for Feed_01 to turn off.

If Valve_01 is on AND Valve_01_FB1 is on, signal that the feed is on. Otherwise, signal that
the feed is off.
Note: Valve_01_FB1 is a limit switch that turns on if the valve is fully open.

3.

Start adding the second ingredient through


Feed_02.

If the procedure calls for Feed_02 AND the stop signal is off AND Sensor_Level_2 is off,
turn on Valve_02.
When Sensor_Level_2 turns on OR the stop signal turns on, turn off Valve_02.
Notes:
Valve_02 stays on even if the procedure turns off the call for Feed_02.
Sensor_Level_2 turns on when the tank has enough of ingredient 2.
The stop signal gives someone the option to manually stop the feed.

Decide which of the values below are commands for Feed_01:


Value

Command?

A. Bit that tells Feed_01 when to start

Yes

No

B. Output bit of the I/O module that controls Valve_01

Yes

No

C. Indication that Feed_01 is on (filling) or off (not filling)

Yes

No

D. Input bit of Sensor_Level_1

Yes

No

E. State of the start pushbutton that the operator


presses to start the process

Yes

No

F. Bit that tells Feed_01 when to stop

Yes

No

G. Integer that tracks the step number of the procedure

Yes

No

2. Choose tag names and data types for the commands for Feed_01.
Write your choices in the table below. The table has more rows
than youll probably need:
Equipment Section
Feed_01

Rev. June 2012

Command Tag

Data Type

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEe56r

11--12

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

3. Heres the requirements for the Mixer section:


Mixing Procedure
5.

Start the Mixer and mix the ingredients for


30 seconds.

Equipment Control Requirements


If the procedure calls for Mixer AND the stop signal is off, turn on Motor_01.
When the stop signal turns on, turn off Motor_01.
If Motor_01 is on and its auxiliary contact is on, signal that the mixer is on. Otherwise, signal
that the mixer is off.
Notes:
Motor_01 stays on even if the procedure turns off the call for Mixer.
The auxiliary contact turns on if the motor is on.

Decide which of the values below are commands for the Mixer
section:
Value

Command?

A. Signal to start mixing

Yes

No

B. Signal to stop mixing

Yes

No

C. Output bit of the I/O module that controls Motor_01

Yes

No

D. How long the mixer has been running

Yes

No

E. Indication that mixing is in process

Yes

No

F. Input bit for the auxiliary contact of the motor

Yes

No

G. Integer that tracks the step number of the procedure

Yes

No

H. State of the start pushbutton that the operator


presses to start the process

Yes

No

4. Choose tag names and data types for the commands for the Mixer
section. Write your choices in the table below. The table has more
rows than youll probably need:
Equipment Section
Mixer

How Did You Do?

E 2012 Rockwell Automation, Inc. All rights reserved.

Command Tag

Data Type

Turn to the Answers section.

Rev. June 2012


SPEe56r

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

Exercise C

11--13

Practice identifying the status information you need to operate a


section.
Directions:
1. The following lists the first few steps of the mixing procedure.
Notice that we added steps to the procedure and expanded the
equipment requirements:

Mixing Procedure

Equipment Control Requirements

1.

Start adding the first ingredient through


Feed_01.

If the procedure calls for Feed_01 AND the stop signal is off AND Sensor_Level_1 is off,
turn on Valve_01.
When Sensor_Level_1 turns on OR the stop signal turns on, turn off Valve_01.
Notes:
Valve_01 stays on even if the procedure turns off the call for Feed_01.
Sensor_Level_1 turns on when the tank has enough of ingredient 1.
The stop signal gives someone the option to manually stop the feed.

2.

Wait for Feed_01 to turn off.

If Valve_01 is on AND Valve_01_FB1 is on, signal that the feed is on. Otherwise, signal that
the feed is off.
Note: Valve_01_FB1 is a limit switch that turns on if the valve is fully open.

3.

Start adding the second ingredient through


Feed_02.

If the procedure calls for Feed_02 AND the stop signal is off AND Sensor_Level_2 is off,
turn on Valve_02.
When Sensor_Level_2 turns on OR the stop signal turns on, turn off Valve_02.
Notes:
Valve_02 stays on even if the procedure turns off the call for Feed_02.
Sensor_Level_2 turns on when the tank has enough of ingredient 2.
The stop signal gives someone the option to manually stop the feed.

Decide which of the values below are status information for


Feed_01:
Value

Status?

A. Bit that tells Feed_01 when to start

Yes

No

B. Output bit of the I/O module that controls Valve_01

Yes

No

C. Indication that Feed_01 is on (filling) or off (not filling)

Yes

No

D. Input bit of Sensor_Level_1

Yes

No

E. State of the start pushbutton that the operator


presses to start the process

Yes

No

F. Bit that tells Feed_01 when to stop

Yes

No

G. Integer that tracks the step number of the procedure

Yes

No

2. Choose tag names and data types for the status for Feed_01.
Write your choices in the table below. The table has more rows
than youll probably need:
Equipment Section
Feed_01

Rev. June 2012

Status Tag

Data Type

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEe56r

11--14

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

3. The following are the requirements for the Mixer section:


Mixing Procedure
5.

Start the Mixer and mix the ingredients for


30 seconds.

Equipment Control Requirements


If the procedure calls for Mixer AND the stop signal is off, turn on Motor_01.
When the stop signal turns on, turn off Motor_01.
If Motor_01 is on and its auxiliary contact is on, signal that the mixer is on. Otherwise, signal
that the mixer is off.
Notes:
Motor_01 stays on even if the procedure turns off the call for Mixer.
The auxiliary contact turns on if the motor is on.

Decide which of the values below are status information for the
Mixer section:
Value

Status?

A. Signal to start mixing

Yes

No

B. Signal to stop mixing

Yes

No

C. Output bit of the I/O module that controls Motor_01

Yes

No

D. How long the mixer has been running

Yes

No

E. Indication that mixing is in process

Yes

No

F. Input bit for the auxiliary contact of the motor

Yes

No

G. Integer that tracks the step number of the procedure

Yes

No

H. State of the start pushbutton that the operator


presses to start the process

Yes

No

4. Choose tag names and data types for the status for the Mixer
section. Write your choices in the table below. The table has more
rows than youll probably need:
Equipment Section
Mixer

How Did You Do?

E 2012 Rockwell Automation, Inc. All rights reserved.

Status Tag

Data Type

Turn to the Answers section.

Rev. June 2012


SPEe56r

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

Exercise D

11--15

Practice these steps:


Program the equipment control to act on the commands and
return the status.
Set up a sequencer to give the commands and read the status.
Context:
Heres the complete requirements for the tank. Notice that it is a
more detailed version of what you saw in Exercise A.
When the operator presses the start button, the tank runs this
procedure one time:

Mixing Procedure

Equipment Control Requirements

1.

Start adding the first ingredient through


Feed_01.

If the procedure calls for Feed_01 AND the stop signal is off AND Sensor_Level_1 is off,
turn on Valve_01.
When Sensor_Level_1 turns on OR the stop signal turns on, turn off Valve_01.
Notes:
Valve_01 stays on even if the procedure turns off the call for Feed_01.
Sensor_Level_1 turns on when the tank has enough of ingredient 1.
The stop signal gives someone the option to manually stop the feed.

2.

Wait for Feed_01 to turn off.

If Valve_01 is on AND Valve_01_FB1 is on, signal that the feed is on. Otherwise, signal that
the feed is off.
Note: Valve_01_FB1 is a limit switch that turns on if the valve is fully open.

3.

Start adding the second ingredient through


Feed_02.

If the procedure calls for Feed_02 AND the stop signal is off AND Sensor_Level_2 is off,
turn on Valve_02.
When Sensor_Level_2 turns on OR the stop signal turns on, turn off Valve_02.
Notes:
Valve_02 stays on even if the procedure turns off the call for Feed_02.
Sensor_Level_2 turns on when the tank has enough of ingredient 2.
The stop signal gives someone the option to manually stop the feed.

4.

Wait for Feed_02 to turn off.

If Valve_02 is on AND Valve_02_FB1 is on, signal that the feed is on. Otherwise, signal that
the feed is off.
Note: Valve_02_FB1 is a limit switch that turns on if the valve is fully open.

5.

Start the Mixer and mix the ingredients for


30 seconds.

If the procedure calls for Mixer AND the stop signal is off, turn on Motor_01.
When the stop signal turns on, turn off Motor_01.
If Motor_01 is on and its auxiliary contact is on, signal that the mixer is on. Otherwise, signal
that the mixer is off.
Notes:
Motor_01 stays on even if the procedure turns off the call for Mixer.
The auxiliary contact turns on if the motor is on.

6.

Start draining the tank.

If the procedure calls for Drain AND the stop signal is off AND Sensor_Tank_Empty is off,
turn on Valve_03.
When Sensor_Tank_Empty turns on OR the stop signal turns on, turn off Valve_03.
Notes:
Valve_03 stays on even if the procedure turns off the call for Drain.
Sensor_Tank_Empty turns on when the tank is empty.
The stop signal gives someone the option to manually stop draining.

7.

Wait for the tank to finish draining.

Rev. June 2012

If Valve_03 is on AND Valve_03_FB1 is on, signal that the drain is on. Otherwise, signal that
the drain is off.
Note: Valve_03_FB1 is a limit switch that turns on if the valve is fully open.

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEe56r

11--16

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

Workstation Devices
Use these workstation devices to represent the equipment of the tank:
Motor_01_Out

Valve_03_Out

Start

Valve_01_Out
Valve_02_Out

Tag Name

Alias For

Workstation Device

Start

Local:2:I.Data.0

DI0

Valve_01_Out

Local:0:O.Data.1

DO1

Valve_02_Out

Local:0:O.Data.2

DO2

Motor_01_Out

Local:0:O.Data.3

DO3

Valve_03_Out

Local:0:O.Data.4

DO4

When you see underlined text, refer to the related procedure or


information in your job aid.
Directions:
1. Open the SPE_1756R_D1.acd project file.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SPEe56r

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

11--17

2. Open the program tags for MainProgram and review the tags that
are already there.
The project already has tags for the sensors, feedback devices,
valves, and motor. Make sure you use these tags:

3. Notice that MainProgram already has an Equipment_Simulation


routine.

The Equipment_Simulation routine simulates most of the inputs


that youll need. The routine:

Turns the sensors on and off as you fill and empty the tank.
Turns the feedback for the valves on and off as you open and

close the valves.


Turns the auxiliary contact of the motor on and off as you run
the motor.
4. Program the equipment control for each section of the tank. Use a
separate routine for each section.
Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEe56r

11--18

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

5. In the MainRoutine, add a JSR for each routine created. Set up a


sequencer for the mixing procedure. Use a separate routine for the
sequencer.
6. Save the project.
7. Download the project to slot 1 of your workstation.
8. Put the controller in Run mode.
9. Test your code. Heres some suggestions:

To see the simulated tank level, open the

Equipment_Simulation routine and look at the Tank_Level


tag.
-- Sensor_Level_1 turns on at 21 gallons.
-- Sensor_Level_2 turns on at 40 gallons (full tank).

One way to debug the code is to disable the sequencer and


manually run each equipment section:

-- Put an AFI instruction in front of the JSR that calls the


sequencer.
-- To run an equipment section, toggle its command bits.
-- Remember to turn off the command bits when youre done.
-- Remember to remove the AFI instruction when youre
done.
10. When youre satisfied that the code meets requirements, go
offline.
11. Save the project.

How Did You Do?

E 2012 Rockwell Automation, Inc. All rights reserved.

Turn to the Answers section.

Rev. June 2012


SPEe56r

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

Rev. June 2012

11--19

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEe56r

11--20

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

Answers

Exercise A
1. and 2. Heres the sections we chose for the tank.

Feed_01

Mixer

Valve_01

Feed_02

Valve_02

Motor_01

Feed_01

Feed_02

Sensor_Level_2
Sensor_Level_1

Drain
Sensor_Tank_Empty
Valve_03

Drain

Exercise B
1. These are probably commands for Feed_01:
Value

Command?

Reason

A. Bit that tells Feed_01 when to


start

Yes ;

No

The procedure give this command to the equipment section.

B. Output bit of the I/O module


that controls Valve_01

Yes

No ;

The equipment section takes care of this.

C. Indication that Feed_01 is on


(filling) or off (not filling)

Yes

No ;

Although the procedure could use this value, the procedure doesnt give
the value. So it isnt a command.

D. Input bit of Sensor_Level_1

Yes

No ;

The procedure doesnt need to know the state of the sensor. The
equipment section uses it to start and stop.

E. State of the start pushbutton


that the operator presses to
start the process

Yes

No ;

The equipment section doesnt use it. The section waits for its start
command from the procedure.

F. Bit that tells Feed_01 when to


stop

Yes ;

No

You might want to manually stop the section.

G. Integer that tracks the step


number of the procedure

Yes

No ;

Strictly a part of the procedure.

2. These are possible command tags for Feed_01:


Equipment Section
Feed_01

E 2012 Rockwell Automation, Inc. All rights reserved.

Command Tag

Data Type

Feed_01_Start
Feed_01_Stop

BOOL
BOOL

Rev. June 2012


SPEe56r

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

11--21

3. These are probably commands for the Mixer:


Value

Command?

Reason

A. Signal to start mixing

Yes ;

No

The procedure give this command to the equipment section.

B. Signal to stop mixing

Yes ;

No

The procedure give this command to the equipment section.

C. Output bit of the I/O module


that controls Motor_01

Yes

No ;

The equipment section takes care of this.

D. How long the mixer has been


running

Yes

No ;

This is part of the procedure.

E. Indication that mixing is in


process

Yes

No ;

Although the procedure could use this value, the procedure doesnt give
the value. So it isnt a command.

F. Input bit for the auxiliary contact


of the motor

Yes

No ;

The procedure doesnt need to know the state of the contact.

G. Integer that tracks the step


number of the procedure

Yes

No ;

Strictly a part of the procedure.

H. State of the start pushbutton


that the operator presses to
start the process

Yes

No ;

The equipment section doesnt use it. The section waits for its start
command from the procedure.

4. These are possible command tags for Mixer:


Equipment Section
Mixer

Command Tag

Data Type

Mixer_Start
Mixer_Stop

BOOL
BOOL

Exercise C
1. These are probably statuses for Feed_01:
Value

Command?

Reason

A. Bit that tells Feed_01 when to


start

Yes

No ;

The procedure give this command to the equipment section.

B. Output bit of the I/O module


that controls Valve_01

Yes

No ;

The equipment section takes care of this.

C. Indication that Feed_01 is on


(filling) or off (not filling)

Yes ;

No

The equipment section controls this value. The procedure monitors it.

D. Input bit of Sensor_Level_1

Yes

No ;

The procedure doesnt need to know the state of the sensor. The
equipment section uses it to stop.

E. State of the start pushbutton


that the operator presses to
start the process

Yes

No ;

The equipment section doesnt use it. The section waits for its start
command from the procedure.

F. Bit that tells Feed_01 when to


stop

Yes

No ;

You might want to manually stop the section.

G. Integer that tracks the step


number of the procedure

Yes

No ;

Strictly a part of the procedure.

2. This a possible status tag for Feed_01:

Rev. June 2012

Equipment Section

Status Tag

Data Type

Feed_01

Feed_01_State

BOOL

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEe56r

11--22

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

3. These are probably status for the Mixer:


Value

Status?

Reason

A. Signal to start mixing

Yes

No ;

The procedure give this command to the equipment section.

B. Signal to stop mixing

Yes

No ;

The procedure give this command to the equipment section.

C. Output bit of the I/O module


that controls Motor_01

Yes

No ;

The equipment section takes care of this.

D. How long the mixer has been


running

Yes

No ;

This is part of the procedure.

E. Indication that mixing is in


process

Yes ;

No

The equipment section controls this value. The procedure monitors it.

F. Input bit for the auxiliary contact


of the motor

Yes

No ;

The procedure doesnt need to know the state of the contact.

G. Integer that tracks the step


number of the procedure

Yes

No ;

Strictly a part of the procedure.

H. State of the start pushbutton


that the operator presses to
start the process

Yes

No ;

The equipment section doesnt use it. The section waits for its start
command from the procedure.

4. This is a possible status tag for Mixer:


Equipment Section

Status Tag

Data Type

Mixer

Mixer_State

BOOL

Exercise D
4. Heres one way to program the equipment control for each
section:

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SPEe56r

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

Rev. June 2012

11--23

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEe56r

11--24

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

5. Heres one way to set up the sequencer:

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SPEe56r

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

Rev. June 2012

11--25

E 2012 Rockwell Automation, Inc. All rights reserved.


SPEe56r

11--26

Exercise: Separating the Procedure from Equipment Control in an RSLogix 5000 Project

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


SPEe56r

Lesson

12

Copying and Filling an Array in an


RSLogix 5000 Project
What You Will Learn

After completing this lesson, you should be able:


Create a single dimension array
Program a Copy (COP) instruction

Program a File Fill (FLL) instruction


When You Will Do This
You will perform this task in the following situations:
Create a set of related same type data points under a single name

Move multiple pieces of data of the same data type in a single


instruction

Conserve memory in the controller with an array


Clear or preset a set of array values with a single instruction

Before You Begin


Mention that this lesson will focus on
one dimensional arrays. Two and three
dimensional arrays are covered in
RSLogix 5000 Level 3: Project
Development course.

Creating a Single Dimension Array


Array: A numerically indexed sequence of elements of the same
data type. An array tag occupies a contiguous section of memory in
the controller with each element in sequence. Arrays can have one,
two, or three dimensions.
Element: A single position within an array.
Example: Array
To make INT records for 6 parts, a one-dimensional array of INTs
is created:
1 DINT (32 Bits)
1 INT (16 Bits)

Rev. June 2012

Part_Data[1]

Part_Data[0]

Part_Data[3]
Part_Data[5]

Part_Data[2]
Part_Data[4]

E 2012 Rockwell Automation, Inc. All rights reserved.


PCFsb56r

12--2

Copying and Filling an Array in an RSLogix 5000 Project

The elements in the array occupy memory in order. The array always
starts at 0 and extends to the number of elements minus 1.

Point out that if you create an array tag


from the Tags Editor window, and
manually enter the brackets and
numbers, the first value entered in the
brackets becomes the X value.

An array in the Tags window is shown in the following graphic:


Same Data Type

Array of 6 (0- 5) INTs


Single Element

Tell the students who are familiar with


PLC-5 or SLC 500 processors that the
data table files in these products are
single element arrays.

Tip "

An array must be created with the following rules in mind:


When an array is a part of a user-defined data type, it can have
only one dimension.
An array can be of one data type only. Arrays support the
following data types:
-- Any pre-defined data types except Axis data types, Message,
or Motion_Group
-- A user-defined data type
Data of the same type is not automatically grouped in memory. To
store all timers together, create an array of timer tags.
Array Addressing

Mention that the numeric element is


fixed.
Explain the program controls which
element is being addressed by
controlling the value stored in
SerialNumber.

The following table presents array address types, formats, and


examples/applications:
Type
Numeric element

Format
ArrayName[Element Number]

Example/Application
PartData[4]
Application: Selecting a timer
from a group of fault timers

Variable element

ArrayName[Tag]

Part[SerialNumber]

ArrayName[Expression]

Application: Saving the amount


of parts produced per hour into an
array for a daily production report
Part[Position1--Position2]
Application: Adding an offset to
a group of position values maybe
in a grinding operation.

Numeric bit

ArrayName[Element].Bit

Process_Time[5].DN

Chalk Talk: Have students write out other examples of each array
addressing type.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCFsb56r

Copying and Filling an Array in an RSLogix 5000 Project

12--3

Some of the mathematical operators that can be used in an


expression to specify an array element are as follows:
Operator

Description

Add

--

Subtract/Negate

Multiply

Divide

And

And

Not

Complement

Or

Or

As an example, state that if


Position1--Position2=48 and the array is
an array of only 40, a major fault will
occur.

Any array value that you enter must be within


the boundaries of the specified array.
Instructions that view arrays as a collection of
elements generate a major fault if a value
exceeds its corresponding dimension.

Copy (COP) and File Fill (FLL) Instructions


(COP) and File Fill (FLL) instructions operate on arrays of data.
An example is moving recipe
values or production data.

Tip "

A Copy (COP) instruction moves a group of elements (an array) all


at one time compared to a MOV instruction, which moves a single
element.
COP and FLL instructions have three operands:
Source: An initial element to copy.

Mention that there are other File


instructions that operate on arrays of
data. This lesson only covers the COP
and FLL instructions.

Destination: An initial element to be overwritten by the Source.


Length: The number of Destination elements to copy or fill.
The Source and Destination operands should
be the same data type or unexpected results
may occur.

Copies the value(s) in the Source to


the values in the Destination.

An example would be to zero Tip


out an array of daily production
data after a report was generated.

Rev. June 2012

"

Fills elements of an array with the


Source value.

A FLL instruction with a Source value of 0 could be used to clear a


group of values.

E 2012 Rockwell Automation, Inc. All rights reserved.


PCFsb56r

12--4

Copying and Filling an Array in an RSLogix 5000 Project

You must test and confirm that the instruction


does not change data that you do NOT want it
to change.
These instructions operate on contiguous data memory. In some
cases, these instructions will write past the array into other members
of the tag if the length is too big and the tag is a user-defined data
type. In both cases, no major fault is generated:
If the tag is . . .

Tip "

Use the steps below to help guide


you during the demonstration:

Then if the length is too big, the


instruction . . .

A user-defined data type

Writes past the end of the array into other


members of the tag. It stops at the end of
the tag.

Not a user-defined data type

Stops at the end of the array.

The length is too large if it is more than the total number of elements
in the Destination array.
Activity: As your instructor demonstrates the COP and FLL
instructions, notice the key points:

1. Schedule the unscheduled


MainProgram.

2. Download and go online to the


controller with the
PCF_1756R_DEM1.acd file.

A COP instruction is like a MOV instruction, except a length


is specified.

A FLL instruction is similar to a CLR instruction, or MOV


instruction (0), except you can clear multiple addresses at once
or use an FLL instruction to preset an array with a value other
than zero.

COP and FLL instructions are used with arrays.

3. Expand the Unscheduled Programs.


The MainProgram is the completed
project. Open the
4_Data_for_Offsite_Server
subroutine and show the students
how the COP instruction works.
4. Open the Initialize subroutine and
show the student how the FLL
instructions work.
5. When you have finished
demonstrating the instructions,
unschedule the MainProgram in
preparation for creating single
dimension arrays.

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCFsb56r

Copying and Filling an Array in an RSLogix 5000 Project

Heres How
IMPORTANT: To meet IACET CEU
requirements and fully prepare
certificate students for the final exam,
you must demonstrate all lesson
objectives using the proper job aids.

12--5

To perform the following tasks:


Create a single dimension array
Program a Copy (COP) instruction

Program a File Fill (FLL) instruction


Activity: As your instructor demonstrates these procedures, follow
along.

Demonstration Checklist
Use the steps below to help guide you
during the demonstration:
1. Open the PCF_1756R_DEM1.acd
file. The Instructor_Demo program is
currently scheduled to run.
2. In the
Copy_and_FLL_Two_1x15_Arrays
routine, create two arrays: 1 x 15.
These will become the Source and
Destination of the COP instruction.

Pay attention to these critical aspects of the demonstration:


-

Did your instructor point out that the Source and


Destination addresses must be arrays including which
element each will begin?

3. Save the project, download and go


online to the controller.

Do you know what the function of the Source Immediate


or tag is when used in a FLL instruction?

4. Enter data in the Source array. Use


either a Quick Watch or Data
Monitor.

Did your instructor show you the following?


- Where to create the COP or FLL instruction
- How to get help for an instruction
- How to assign tags or a constant value to the Source
- How to assign tags to the Destination

5. Replace the NOP instruction on


Rung 1 with a COP instruction of
Array 1 to Array 2. Discuss that the
Source or Destination arrays not
always need to start at element [0],
but for purposes of this
demonstration they will.
6. Show that the data was copied
(could have been multiple MOV
instructions or one COP).
7. Replace the NOP on Rung 2 with
two FLL instructions. Fill one array
with zeros and the other array with a
different value.
8. Display the results.

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


PCFsb56r

12--6

Copying and Filling an Array in an RSLogix 5000 Project

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCFsb56r

Exercise: Copying and Filling an Array in an RSLogix 5000 Project

12--7

Exercise: Copying and Filling an


Array in an RSLogix 5000 Project
Exercise A

In this exercise, you will practice entering a single array and


programming COP and FLL instructions for a simulated iron
process.
Use these workstation devices to represent the equipment of the iron
process:
Load_Process_Data

Process_Data_Loaded

All_Data_Entered

Set_Tons_Molten_Iron
(2 - 5 = 20 - 50 Tons)

Sim_Molten_Iron
Display_Tons_Molten_Iron (1-10)
Sim_Oxy_In

Sim_Cr_In Display_Tons_Molten_Iron_Processing (2-5)

All_Data_In

Tag Name

Tip "

Rev. June 2012

Alias For

Workstation
Device

Set_Tons_Molten_Iron

Local:8:I.Ch0Data

AI0

Load_Process_Data

Local:2:I.Data.2

DI2

All_Data_Entered

Local:2:I.Data.6

DI6

Process_Data_Loaded

Local:4:O.Data.6

DO6

All_Data_In

Local:4:O.Data.7

DO7

Sim_Molten_Iron

Local:4:O.Data.9

DO9

Sim_Oxy_In

Local:4:O.Data.10

DO10

Sim_Cr_In

Local:4:O.Data.11

DO11

Display_Tons_Molten_Iron

Local:7:O.Ch0Data

AO0

Display_Tons_Molten_Iron_Processing

Local:7:O.Ch1Data

AO1

Start_New_Run

Local:2:I.Data.10

DI10

New_Run

Local:4:O.Data.8

DO8

For a description of the function of each tag, see the Description


field in the Tags window.
E 2012 Rockwell Automation, Inc. All rights reserved.
PCFe56r

12--8

Exercise: Copying and Filling an Array in an RSLogix 5000 Project

When you see underlined text, refer to the related procedure or


information in your job aid.
Directions:
1. Open the PCF_1756R_A1.acd project file.
2. Create two program-scope single dimension arrays (names, types,
and size need to be exact):
Tons_Molten_Iron_1x15_Array (DINT with Dim 0 = 15)
Off_Site_TMI_1x15_Array (DINT with Dim 0 = 15)
If an array is too small, the controller will fault
when the program tries to write into an
undefined memory location.
3. In the Initialize subroutine, on Rung 1 replace the NOP
instruction with a FLL instruction to clear all of
Tons_Molten_Iron_1x15_Array.

Tip "

In this project, we will fill all 15 locations starting at [0]. HINT:


Tons_Molten_Iron_1x15_Array[0].
4. In the 4_Data_for_Offsite_Server subroutine, on Rung 1 replace
the NOP instruction with a COP instruction. Copy the
Tons_Molten_Iron_1x15_Array values into the
Off_Site_TMI_1x15_Array.
Saving data for historical archiving by a
SCADA system (the archiving is set up in the
SCADA system), all we need to do is get the
data into the appropriate array elements.
5. Download the project into slot 1 of your workstation.
6. Put the controller in Run mode.
7. Set AI0 (potentiometer) to a value between 2 and 5 and watch the
AO0 (upper analog potentiometer) for the appropriate range.
8. Press and hold DI2 (should be illuminated green) for 2-3 seconds.
If DI2 flashes, the value attempted is out-of-range and it was not
used. Try it again.
You can load up to 15 times. This simulates the total tonnage of
molten iron that left the furnace in the bullet cars for transport to
the steel plant.

Tip "

E 2012 Rockwell Automation, Inc. All rights reserved.

Each of the bullet car loads (depends on how many you loaded in the
above step) takes 60 seconds in this simulation to fully complete.
They will all complete automatically, one at a time, after you start
the steelmaking process.
Rev. June 2012
PCFe56r

Exercise: Copying and Filling an Array in an RSLogix 5000 Project

12--9

9. Press DI6 (yellow pushbutton) to start the process. The following


should occur:
- DO7 should turn on.
- DO9 (green), DO10 (yellow), and DO11 (red) should begin
flashing.
- DO9 will flash slower than DO10 and DO11, indicating that
green is less critical to failure of the simulated steel stainless
process.
- AO1 (lower analog potentiometer) will display the tonnage
currently being processed as long as DO9 is on.
- DO7 flashes for 20-50 seconds (x10 the value entered from
the initial loading of AI0 settings), now processing iron into
steel.
- DO10 flashes for 10% of DO7 (2-5 seconds), adding oxygen
to remove impurities.
- DO11 flashes for 30% of DO7 (6-15 seconds), adding
chromium to produce stainless steel.
- The process repeats itself every 60 seconds, so there may be
some time to wait for the next car.
- As long as DO7 is on, there are cars to finish.
10. Go offline.
11. Save your project.

How Did You Do?

Rev. June 2012

Turn to the Answers section.

E 2012 Rockwell Automation, Inc. All rights reserved.


PCFe56r

12--10

Exercise: Copying and Filling an Array in an RSLogix 5000 Project

Answers

Exercise A
2. The single dimension arrays should look similar to the
following graphics:

3. Rung 1 in the Initialize subroutine should look similar to the


following graphic:

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCFe56r

Exercise: Copying and Filling an Array in an RSLogix 5000 Project

12--11

4. Rung 1 in the 4_Data_for_Offsite_Server subroutine should


look similar to the following graphic:

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


PCFe56r

12--12

Exercise: Copying and Filling an Array in an RSLogix 5000 Project

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


PCFe56r

Appendix

I/O Wiring Diagrams


Slot 0 - 1756-OB16D Digital Output Module
WORKSTATION
DEVICE

BLACK

RED

DO0

OUT- 0

OUT- 1

OUT- 2

10

OUT- 3

DO3

12

OUT- 4

DO4

11

OUT- 5

6
8

14

DO1
DO2

DO5

GND- 0
+DC- 1
+DC- 1
+DC- 1
+DC- 1
+DC- 1
+DC- 1

16

28

DO2 = Local:0:O.Data.2

+DC- 1

30

DO3 = Local:0:O.Data.3

GND- 1
GND- 1
Not Used

32

DO4 = Local:0:O.Data.4

34

DO5 = Local:0:O.Data.5

18
20
22
24
26

36

DO0 = Local:0:O.Data.0
DO1 = Local:0:O.Data.1

BLACK

RED

+DC- 0
+DC- 0
+DC- 0
+DC- 0
+DC- 0
+DC- 0
+DC- 0

LABEL

- GREEN PILOT LIGHT


- AMBER PILOT LIGHT

- RED PILOT LIGHT

24VDC

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


WD3a56r

A--2

I/O Wiring Diagrams

Slot 2 - 1756-IB16D Digital Input Module


WORKSTATION
DEVICE

BLACK

BLACK

BLACK

BLACK

10

12

11

IN- 4
IN- 5

14

13

IN- 6

GND- 1
GND- 2
GND- 2
GND- 2
GND- 2
GND- 3
GND- 3
GND- 3

16

15

18

17

20

19

22

21

IN- 7
IN- 8
IN- 9
IN- 10

24

23

26

25

28

27

30

29

GND- 3
GND- 3
NOT USED

32

31

34

33

IN- 11
IN- 12
IN- 13
IN- 14
IN- 15
NOT USED

36

35

NOT USED

+24VDC

DI0
DI1
DI2

IN- 0
IN- 1
IN- 2
IN- 3

GND- 0
GND- 0
GND- 0
GND- 0
GND- 1
GND- 1
GND- 1

LABEL

DI3
DI4
DI5
DI6
DI7
DI8
DI9
DI10
DI11
DI12
DI13
DI14
DI15

DI0 = Local:2:I.Data.0

DI8 = Local:2:I.Data.8

DI1 = Local:2:I.Data.1

DI9 = Local:2:I.Data.9

DI2 = Local:2:I.Data.2

DI10 = Local:2:I.Data.10

DI3 = Local:2:I.Data.3

DI11 = Local:2:I.Data.11

DI4 = Local:2:I.Data.4

DI12 = Local:2:I.Data.12

DI5 = Local:2:I.Data.5

DI13 = Local:2:I.Data.13

DI6 = Local:2:I.Data.6

DI14 = Local:2:I.Data.14

DI7 = Local:2:I.Data.7

DI15 = Local:2:I.Data.15
- NORMALLY OPEN PUSHBUTTON
- SELECTOR SWITCH

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


WD3a56r

I/O Wiring Diagrams

A--3

Slot 4 - 1756-OB16D Output Module


RED

+DC- 0
+DC- 0
+DC- 0
+DC- 0
+DC- 0
+DC- 0
+DC- 0

2
4
6

WORKSTATION
DEVICE

10
12

OUT- 6
OUT- 7

DO6

13

GND- 0
+DC- 1
+DC- 1
+DC- 1
+DC- 1
+DC- 1
+DC- 1
+DC- 1

16

15

18

17

30

DO6 = Local:4:O.Data.6

GND- 1
GND- 1
NOT USED

32

DO7 = Local:4:O.Data.7

BLACK

14

21

24

23

OUT- 11

20

19

DO9
DO10

G
A
R

DO11

26
28

34

DO8 = Local:4:O.Data.8

36

DO9 = Local:4:O.Data.9
DO10 = Local:4:O.Data.10
DO11 = Local:4:O.Data.11

- GREEN PILOT LIGHT


- AMBER PILOT LIGHT

- RED PILOT LIGHT

+24VDC

Rev. June 2012

DO7
DO8

BLACK

RED

22

OUT- 8
OUT- 9
OUT- 10

LABEL

E 2012 Rockwell Automation, Inc. All rights reserved.


WD3a56r

I/O Wiring Diagrams

A--4

Slot 7 - 1756-OF6VI Analog Output


WORKSTATION
DEVICE

AO1 (Channel 1)

AO0
Return

WORKSTATION
DEVICE
OUT- 1

OUT- 0

NOT USED

NOT USED

RTN- 1

RTN- 0

OUT- 3

OUT- 2

NOT USED

10

NOT USED

RTN- 3

12

11

RTN- 2

NOT USED

14

13

NOT USED

OUT- 5

16

15

OUT- 4

NOT USED

18

17

NOT USED

RTN- 5

20

19

RTN- 4

AO0 (Channel 0)

AO1
Return

AO0 = Local:7:O.Ch0Data
AO1 = Local:7:O.Ch1Data

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


WD3a56r

I/O Wiring Diagrams

A--5

Slot 8 - 1756-IF6VI Analog Input


+10VDC

+10VDC
WORKSTATION
DEVICE

AI1
(Channel 1)

AI1
Return

WORKSTATION
DEVICE

IN- 1/V

IN- 0/V

IN- 1/I

IN- 0/I

RET- 1

RET- 0

IN- 3/V

IN- 2/V

IN- 3/I

10

IN- 2/I

RET- 3

12

11

RET- 2

NOT USED

14

13

NOT USED

IN- 5/V

16

15

IN- 4/V

IN- 5/I

18

17

IN- 4/I

RET- 5

20

19

RET- 4

AI0
(Channel 0)

AI0
Return

AI0 = Local:8:I.Ch0Data
AI1 = Local:8:I.Ch1Data

Rev. June 2012

E 2012 Rockwell Automation, Inc. All rights reserved.


WD3a56r

A--6

I/O Wiring Diagrams

E 2012 Rockwell Automation, Inc. All rights reserved.

Rev. June 2012


WD3a56r

Rev. June 2012

DI6

DI5

DI11
DO11
DI15

DI10
DO8
DI14

DO5
DI13

DI12

DO10

DI7

DI3
DO9

DI9

DO4

DO6

DO3

DO7

DI2

DI1

Outputs (6- 11 in Slot 4)

DI8
DO2

DI4
DO1

DI0
DO0

Outputs (0- 5 in Slot 0)

Inputs Run Left to Right (All Wired to Slot 2)

Ch01 Analog
Meter Output

Ch00 Analog
Meter Output

Ch01 Analog
Meter Input

Ch00 Analog
Meter Input

Appendix

ControlLogix Workstation I/O


Device Assignments

The following standard ControlLogix workstation inputs and outputs


are used in this course (Local I/O tags are listed on the next page):

E 2012 Rockwell Automation, Inc. All rights reserved.


WI3a56r

B--2

ControlLogix Workstation I/O Device Assignments

Local I/O Tags

The devices used in the workstation have the following I/O base
tags:
Module

Digital Input
wired to Slot 2

Digital Output
wired to Slot 0

Digital Output
wired to Slot 4

E 2012 Rockwell Automation, Inc. All rights reserved.

Workstation Device

I/O Base Tag

DI0
DI1
DI2
DI3
DI4
DI5
DI6
DI7
DI8
DI9
DI10
DI11
DI12
DI13
DI14
DI15
D00
D01
D02
D03
D04
D05
D06
D07
D08
D09
D010

Local:2:I.Data.0
Local:2:I.Data.1
Local:2:I.Data.2
Local:2:I.Data.3
Local:2:I.Data.4
Local:2:I.Data.5
Local:2:I.Data.6
Local:2:I.Data.7
Local:2:I.Data.8
Local:2:I.Data.9
Local:2:I.Data.10
Local:2:I.Data.11
Local:2:I.Data.12
Local:2:I.Data.13
Local:2:I.Data.14
Local:2:I.Data.15
Local:0.O.Data.0
Local:0.O.Data.1
Local:0.O.Data.2
Local:0.O.Data.3
Local:0.O.Data.4
Local:0.O.Data.5
Local:4:O.Data.6
Local:4:O.Data.7
Local:4:O.Data.8
Local:4:O.Data.9
Local:4:O.Data.10

D011

Local:4:O.Data.11

Rev. June 2012


WI3a56r

The following are trademarks of Rockwell Automation, Inc.:


1336 FORCE
1336 PLUS
ControlBus
Data Highway Plus
DriveTools
Flex
Logix5000
PanelBuilder
PLC-5
PowerFlex
RSLinx
RSView
SCANPort
SoftLogix

1336 IMPACT
CompactLogix
ControlLogix
DH+
FactoryTalk
FlexLogix
Logix5550
PanelView
PHOTOSWITCH
RediSTATION
RSLogix
RSNetWorx
SLC
Ultra

EtherNet/IP and ControlNet are trademarks of ControlNet International Ltd.


DeviceNet is a trademark of the Open DeviceNet Vendor Association, Inc. (ODVA).
The following are registered trademarks of Microsoft Corporation:
MS-DOS
Windows

PowerPoint
Windows NT

IBM is a registered trademark of International Business Machines Corporation.


Pentium is a registered trademark of Intel Corporation.
All other trademarks are the property of their respective holders and are hereby acknowledged.

Catalog Number ABT-CCP151-TSM -- June 2012


Supersedes Catalog Number ABT--CCP151-TSM - December 2010

E 2012 Rockwell Automation, Inc. All rights reserved.


Printed in USA

Vous aimerez peut-être aussi