Você está na página 1de 49

Basic Programming RSLogix 5000

Modifikasi System Control MCW Water Intake PLTGU

Indonesia Power UBP Priok

Programming Basic Ladder Logic Instructions in an


RSLogix 5000 Project
Click the corresponding button to access a file:
*

*
& ! '()))* +"

"
!
# "$ %
,"
! "
*

! "
& ! '()))* +"

&!

!
-

*
"

&!

"
'()))* +"

&!

0 $
'()))* +"

#
&!

"

"$
'()))

* " " .*
&!

"
'()))* +"
/ "
'()))* +"

"

* " " .*
"
&! '
()))* +"
0
&!

"
'()))* +"

Programming Basic Ladder


Logic Instructions in an RSLogix 5000

Course Purpose
Skill-building course for maintainers
Basic understanding of ladder logic instructions and terminology
Provides resources and hands-on practice
To modify basic instructions
Use RSLogix 5000 software to perform basic software tasks
Introduced to ladder logic techniques, standards, and rules

Programming Basic Ladder


Logic Instructions in an RSLogix 5000

Prerequisites
To complete this course:
Completion of course CCP146
Or, the ability to:
Go online
Configure I/O modules
Download
Assign tags
Verify a project
Change operating modes on a controller
Enter/edit instructions in RSLogix 5000 software
Also, to complete this course:
Perform basic Windows tasks:
Use a mouse
Browse for files
Open, close, size, and move windows

Programming Basic Ladder


Logic Instructions in an RSLogix 5000

Outline
Course lessons:
Applying Ladder Logic Strategies and Techniques
Documenting and Searching Ladder Logic
Programming Timer and Counter Instructions
Integrated Practice: Modifying Basic Instructions
Programming Program Control Instructions
Programming Compare Instructions
Programming Compute and Math Instructions
Integrated Practice: Programming Ladder Logic Instructions
Programming Move Instructions

Ladder Logic
Strategies and Techniques to an RSLogix 5000

Lesson Objectives
Arrange instructions for optimum performance
Draft ladder logic on paper
Execute best practices for use with ladder logic

Key Terms
Non-Retentive Output Instruction: Continually controls state of output
Example: Non-Retentive Output Instruction
Output Energize (OTE): When rung true, output enabled.
When rung false, output disabled.
Retentive Output Instruction: Sets and retains state of output, even if
power lost
Example: Retentive Output Instruction
Output Latch (OTL): When rung changes to false, output is not
changed

Ladder Logic
Strategies and Techniques to an RSLogix 5000
Efficient Ladder Logic Arrangement
Basic methods help reduce program scan time:
Efficient instruction arrangement on rungs and branches
Efficient arrangement of multiple branches
Efficient Instruction Arrangement
on Rungs and Branches
Instructions most likely to be false on the rung first
Ensures ladder logic instruction placement on rung fully optimized
They will quickly be skipped
Program that skips false rungs reduces scan time:
Instruction MOST
Likely to Be False

Instruction LEAST
Likely to Be False

Ladder Logic
Strategies and Techniques to an RSLogix 5000
Efficient Instruction Arrangement
on Rungs

When controller encounters false instruction:


It stops scanning rung and moves to next rung of logic
Efficient Arrangement of Branches

Ensure efficient arrangement of multiple branches fully optimized:


Path most often true placed on the first rung or branch
Next branch contains path less likely to contain logical continuity
Pattern continues with each descending branch of ladder logic
Path MOST Likely
to Be True
LESS Likely
LEAST Likely

Ladder Logic
Strategies and Techniques to an RSLogix 5000
Soon as controller finds true path:
Stops scanning and will not read any remaining branches
Important:

For best performance, if the rung contains parallel


branches, place the path that is most often true on
the top.

Ladder Logic
Strategies and Techniques to an RSLogix 5000
Drafting Ladder Logic
Modifying, entering, or programming:
Considered interchangeable terms that refer to
introduction of new or different ladder logic elements into
a project.
Examples of ladder logic elements:
Rungs, instructions, and branches
Valid and essential first step to formulate a project:
Draft ladder logic on paper
Ladder logic rarely inputted directly into program
Without having to rework it
Prior to drafting, project engineer establish items for the project:
Standards
Conformity
Consistency
Establishing standards, conformity, and consistency:
Imperative when more than one programmer assigned to project

Programming
Timer and Counter Instructions in an RSLogix 5000
Timer and Counter Instruction Usage

Timer instructions used for following:


After timed delay, trigger outcome to take place
Cause event to transpire for specified length of time
Time duration of an event
Counters used for following:
Count number of parts entering/leaving
Count how many times certain incident occurs
In RSLogix 5000, timers and counters are output instructions.
TIMER Data Type

Data stored in members of Timer structure:


Members have own tag, hold preset, accumulated, and status bits

Programming
Timer and Counter Instructions in an RSLogix 5000
Timer structure within the Monitor Tags window:
Preset Tag
Accumulated Tag
Enable Tag
Timer Timing Tag
Done Tag

Preset Value (.PRE): time base; range of 0 to +2,147,483,647


Accumulated Value (.ACC): total time counted in milliseconds
Timer Status Bits, (.EN, .DN, and .TT): tell controller status of instruction:

Programming
Timer and Counter Instructions in an RSLogix 5000
Timer Instruction Status Bit

Description

.EN (enable)

Specifies if instruction enabled:


.EN is 1 (set), enabled
.EN is 0 (cleared), disabled

.TT (timer timing)

Specifies if instruction timing:


.TT is 1 (set), timing
.TT is 0 (cleared), not timing

.DN (done)

Specifies if accumulated value equals preset:


.DN bit changes state when accumulated = preset

Timer Instruction Components

Have the following components:


Timer: Structure where information stored
Time Base: Unit of time to register events
Important:

In Logix5000 systems, time base always 1


millisecond (.001 seconds). 2-second timer, enter
2000 for preset

Programming
Timer and Counter Instructions in an RSLogix 5000
Timer Instructions

Timer instructions control operations based on time:


If you want to

For Instance

Time for a specific


interval after timer
enabled

Begin timing when rung goes true and reset


accumulated time when rung logic goes false

Time for a specific


interval after timer
disabled

Begin timing when rung goes false and reset


accumulated time when rung logic goes true

Accumulate time

Begin timing when rung goes true and hold


accumulated time when rung logic goes false

Reset a timer

Reset a TON or RTO, (do not use reset for


TOF)

Then use this


instruction
TON
timer on delay
TOF
timer off delay
RTO
retentive timer on
delay
RES

Programming
Timer and Counter Instructions in an RSLogix 5000
TON (Timer On Delay) Instruction

TON instruction accumulates time when true, resets when false:

When limit_switch_1 enabled (set), light_2 enabled (on) for 2


seconds
When accumulated time reaches 2 seconds, light_2 disabled,
light_3 enabled
Light_3 remains on until TON instruction disabled
If limit_switch_1 cleared while timer_1 timing, light_2 disabled

Programming
Timer and Counter Instructions in an RSLogix 5000
TON (Timer On Delay) Instruction

If the accumulated value is . . .

Then the status bits will be in the


following states
.EN

.TT

And the timer is . . .

.DN

=0

Reset (False)

< PRE

Timing (True)

= PRE

Timed Out (True)

TOF (Timer Off Delay) Instruction

Programming
Timer and Counter Instructions in an RSLogix 5000

When limit_switch_2 cleared, light_2 and light_3 enabled for 2


seconds
(timer_2 timing and done (.DN) bit enabled
When timer_2.acc reaches 2 seconds, light_2 and light_3 disabled

TOF instruction works:


If the accumulated value is . . .

Then the status bits will be in the


following states
.EN

.TT

And the timer is . . .

.DN

=0

Reset (True)

< PRE

Timing (False)

= PRE

Timed Out (False)

Programming
Timer and Counter Instructions in an RSLogix 5000
RTO (Retentive Timer On Delay) Instruction
RTO instruction accumulates time when true, does not reset when false
Can start/stop without losing accumulated value:

When limit_switch_1 enabled, light_1 enabled for 2.5 seconds


When timer_3.acc reaches 2.5 seconds, light_1 disabled, light_2 enabled
Light_2 remains enabled until timer_3 resets
If limit_switch_2 cleared while timer_3 timing, light_1 remains enabled
When limit_switch_2 enabled, RES instruction resets timer_3

Programming
Timer and Counter Instructions in an RSLogix 5000
Reset (RES) needed to reset RTO instruction's accumulated
value and bits
RTO instruction works:
If the accumulated value is . . .

Then the status bits will be in the


following states
.EN

.TT

And the timer is . . .

.DN

=0

Reset (False)

< PRE

Timing (True)

= PRE

Timed Out (True)

= PRE

Timed Out (False)

Programming
Timer and Counter Instructions in an RSLogix 5000
COUNTER Data Type
Data stored in members of COUNTER structure
Members have own tag, hold preset, accumulated, status bits
COUNTER structure within Monitor Tags window:
Preset Tag
Accumulated Tag
Count Up Tag
Count Down Tag
Done Tag
Overflow Tag
Underflow Tag

Preset Value (.PRE): Value to be counted, range of +2,147,483,647 to 2,147,483,648

Accumulated Value (.ACC): Number of elapsed counts

Counter Status Bits, (.CU, .CD, .DN, .OV, and .UN): Tell controller status
instruction

Programming
Timer and Counter Instructions in an RSLogix 5000
Counter Status
Bit

Description

.CU

Specifies if count up enabled:


.CU is 1 (set), enabled
.CU is 0 (cleared), disabled

.CD

Specifies if count down enabled:


.CD is 1 (set), enabled
.CD is 0 (cleared), disabled

.DN

Specifies if accumulated value greater than or equal to preset value:


Accumulated preset, .DN is 1 (set)
Accumulated < preset, .DN is 0 (cleared)

.OV

Specifies if counter counted above upper limit +2,147,483,647 (overflow):


.OV is 1 (set), upper limit exceeded
.OV is 0 (cleared), not exceeded

.UN

Specifies if counter counted below lower limit -2,147,483,648 (underflow):


.UN is 1 (set), lower limit exceeded
.UN is 0 (cleared), not exceeded

Counter instructions:
Accumulated value continues incrementing/decrementing even after .DN bit is set
(i.e., the accumulated value can be greater than the preset value).
Clear accumulated value, use RES (reset) instruction that references
counter tag

Programming
Timer and Counter Instructions in an RSLogix 5000
Counter Instructions

Counter instructions control operations based on number of events:


If you want to

For Instance

Count up

Increase count when an event


occurs

Count down

Decrease count when an event


occurs

Count up and
count down
Reset a timer

Add/subtract from one total count


as necessary
Reset a CTU or CTD

Then use this


instruction
CTU
count up counter
CTD
count down
counter
CTU and CTD
combined
RES

Programming
Timer and Counter Instructions in an RSLogix 5000
CTU (Count Up) Instruction

CTU instruction used to count up by one every time rung is true:

After limit_switch_1 goes from disabled to enabled 10 times, .DN bit


enabled and light_1 enabled.
If limit_switch_1 continues to go from disabled to enabled, counter_1
continues to increment its count and .DN bit remains enabled.
When limit_switch_2 enabled, RES instruction resets counter_1 and
light_1 disabled.

Programming
Timer and Counter Instructions in an RSLogix 5000
CTD (Count Down) Instruction
CTD instruction used to count down by one every time rung is true:

Rungs of ladder logic represent conveyor bringing parts into buffer zone.
Each time part enters, limit_switch_1 enabled and part_count increments by 1.
Each time part leaves, limit_switch_2 enabled and part_count decrements by 1.
If there are 100 parts in buffer zone (part_count.DN is set), conveyor_A enabled
and stops the conveyor from bringing in any more parts until buffer has room.

Programming
Timer and Counter Instructions in an RSLogix 5000
RES (Reset) Instruction

RES instruction: output instruction used to reset timer/counter


instructions
RES true, accumulated value is cleared to 0 (reset):

Important:

Never use an RES instruction to reset a TOF


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

Program Control Instructions


in an RSLogix 5000
Program Control Instructions

Program control instructions change flow of logic:


If you want to . . .
Jump to separate routine, pass data to
routine, execute routine, and return results

Use this instruction . . .


Name

Mnemonic

Jump to Subroutine

JSR

Subroutine

SBR

Return from Subroutine

RET

Jump over section of logic that does not


always need to be executed

Jump to Label

JMP

Label

LBL

Disable all rungs in section of logic

Master Control Reset

MCR

Disable user tasks

User Interrupt Disable

UID

Enable user tasks

User Interrupt Enable

UIE

Mark temporary end that halts routine


execution

Temporary End

TND

Disable rung

Always False Instruction

AFI

Insert placeholder in ladder logic

No Operation

NOP

Program Control Instructions


in an RSLogix 5000
Subroutine Usage

Examples programmed in subroutines:


Loading specific recipe when needed
Performing calculation at specified intervals
Cleaning vat after specified number of cycles
Packing/sealing a carton
Painting part specific color
Initializing system
Measuring part at specific point
JSR (Jump to Subroutine) Instruction

JSR Instructions:
Jumps to separate routine, when enabled
Initiates execution of specified routine; a.k.a. subroutine:
Executes subroutine one time
Execution returns to original routine, after subroutine executes

Program Control Instructions


in an RSLogix 5000
JSR an output instruction:

Output Instruction

SBR (Subroutine) Instruction


SBR used to pass parameters received from JSR instruction
Parameter values copied in subroutine where SBR located
SBR identifies tags that store incoming parameters
Important:

RSLogix 5000 software does not require SBR unless input


parameters passed from JSR.

Input Instruction

Program Control Instructions


in an RSLogix 5000
RET (Return from Subroutine) Instruction
RET Instruction:
Returns parameters to JSR
RET passes its parameters
Resumes execution at rung following JSR
Important:

RSLogix 5000 software does not require RET unless


parameters passed back to JSR.

RET an output instruction:


Used only when returning parameters to JSR instruction or
terminating subroutine before end reached
Ends subroutine, returns parameters to JSR

Output Instruction

Subroutine can have more than one RET instruction.

Program Control Instructions


in an RSLogix 5000
Nesting subroutines allows access to one subroutine from inside
another subroutine:
No restrictions, except controller memory, on number nested
Or, number of parameters passed/returned:

Main Routine

Level 1

Level 2

Level 3

Subroutine action_1

Subroutine action_2

Subroutine action_3

SBR

SBR

SBR

JSR
JSR

JSR

RET

RET

RET

Program Control Instructions


in an RSLogix 5000
JMP (Jump to Label) and LBL (Label) Instructions
JMP instruction skips to referenced LBL instruction:
Controller continues executing from that instruction
Instruction does not affect ladder logic execution, when disabled

LBL Instructions:
Target of JMP instruction that uses reference
Label name unique within routine
LBL an input instruction:

Input Instruction

Output Instruction

Program Control Instructions


in an RSLogix 5000
MCR (Master Control Reset) Instruction
MCR used in pairs, create program zone that disables all rungs between pair:
MCR zone enabled, rungs scanned for true/false conditions

When disabled, controller scans within zone, but scan time reduced
Rung-condition-in false for all instructions inside disabled zone

MCR an output instruction:

Output Instruction

Output Instruction

Program Control Instructions


in an RSLogix 5000
Program an MCR zone:
End zone with unconditional MCR instruction
Do not nest one MCR zone within another.
Do not jump into an MCR zone:
Zone false, activates zone from that point to end of zone

Programming Compare Instructions in an


RSLogix 5000
Compare Instructions
If you want to . . .

Use this instruction . . .


Name

Mnemonic

Test whether two values are equal

Equal to

EQU

Test whether one value is greater than or equal to a


second value

Greater Than or Equal


to

GEQ

Test whether one value is greater than a second value

Greater Than

GRT

Test whether one value is less than or equal to a


second value

Less Than or Equal to

Test whether one value is less than a second value

Less Than

LEQ
LES

Test whether one value is not equal to a second value

Not equal to

NEQ

Compare values based on an expression

Compare

CMP

Test whether one value is between two values

Limit

LIM

Pass two values through a mask and test whether they


are equal

Mask equal to

MEQ

Programming Compare Instructions in an


RSLogix 5000
EQU (Equal to) Instruction
Tests whether Source A is equal to Source B.
Compares two numbers or two strings of ASCII characters.
If value_1 equal to value_2, rung-condition-out set to true:

GEQ (Greater Than or Equal to) Instruction


Tests whether Source A is greater than or equal to Source B.
Compares two numbers or two strings of ASCII characters.
If value_1 equal to or greater than value_2, rung-condition-out set to true:

Programming Compare Instructions in an


RSLogix 5000
GRT (Greater Than) Instruction
Tests whether Source A is greater than Source B.
Compares two numbers or two strings of ASCII characters.
If value_1 is greater than value_2, rung-condition-out set to true:

LEQ (Less Than or Equal to) Instruction


Tests whether Source A is less than or equal to Source B.
Compares two numbers or two strings of ASCII characters:
If value_3 less than or equal to value_4, rung-condition-out set to true

Strings compared, hexadecimal values of characters determine if one string less than or
equal to another string

Programming Compare Instructions in an


RSLogix 5000
LES (Less Than) Instruction
Tests whether Source A is less than Source B.
Compares two numbers or two strings of ASCII characters:

If value_4 less than value_1, rung-condition-out set to true


Strings are compared, hexadecimal values of characters determine if one string
is less than another string

NEQ (Not Equal to) Instruction


Tests whether Source A is not equal to Source B.
Compares two numbers or two strings of ASCII characters.
If value_2 not equal to value_4, rung-condition-out set to true:

Programming Compare Instructions in an


RSLogix 5000
CMP (Compare) Instruction
CMP instruction finds the expression true, rung-condition-out set to true:

Expression without compare operator affects arithmetic status flag in CMP


instruction, such as value_1 + value_2, or value_1, instruction evaluates
expression:
If the expression is . . .

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

Non zero

True

Zero

False

Programming Compare Instructions in an


RSLogix 5000
LIM (Limit) Instruction
Determines if test value within low limit to high limit range
To make the
rung true when
the tested value
is . . .

Then set the


low limit . . .

Between or
equal to either of
the limits

Outside or equal
to either of the
limits

Example
High limit

Low limit

Less than the


high limit

85

60

Higher than the


high limit

60

85

Rung is true when

The value is equal to 85,


equal to 60, or between the
two

The tested value is 60 or less,


or 85 and above

Programming Compare Instructions in an


RSLogix 5000

Starts at low limit increments clockwise until it reaches high limit


Test values in clockwise range from high limit to the low limit set rungcondition-out to false

True if test value equal to or between low and high limit


Low Limit

High Limit

-1

+1

Low Limit

High Limit
-(n+1)

+n

n = maximum value

Programming Compare Instructions in an


RSLogix 5000
Set low limit to a larger number than the high limit

Starts at low limit increments clockwise until it reaches high limit

Test values in clockwise range from high limit to low limit set rung-conditionout to false

True if test value outside or equal to low and high limit

Low Limit

High Limit

-1

+1

High Limit

Low Limit
-(n+1)

+n
n = maximum value

Programming Compare Instructions in an


RSLogix 5000
MEQ (Masked Equal to) Instruction
Passes Source and Compare values through a Mask then compares the results.
Masked value_1 equal to masked value_2, the rung-condition-out set to
true:

Important:

1 in mask means data bit passed.


0 in mask means data bit blocked.

Typically, Source, Mask, Compare values all same data type

Programming Compare Instructions in an


RSLogix 5000
MEQ (Masked Equal to) Instruction

value_1

value_2

mask_1

mask_1

Masked
value_1

Masked
value_2

Important:

1 in mask means data bit passed.


0 in mask means data bit blocked.

Programming Compute and Math Instructions


in an RSLogix 5000
Compute and Math Instructions
If you want to:

Use this instruction


Name

Mnemonic

Add two values

Add

ADD

Subtract two values

Subtract

SUB

Multiply two values

Multiply

MUL

Divide two values

Divide

DIV

Determine the remainder after one value is


divided by another

Modulo

MOD

Take the opposite sign of a value

Negate

NEG

Take the absolute value of a value

Absolute Value

ABS

Calculate the square root of a value

Square Root

SQR

Evaluate an expression

Compute

CPT

Compute and math instructions execute faster and require less memory if
all the operands of the instruction use the same optimal data type,
typically DINT or REAL.

Programming Compute and Math Instructions


in an RSLogix 5000
ADD (Add) Instruction
Adds Source A to Source B and places result in Dest (destination).

When enabled, coke_weight1 and coke_weight2 are added.


Result placed in Dest (destination) tag, result_1:

SUB (Subtract) Instruction

When enabled, coke_weight1 subtracted from coke_weight2.


Result placed in Dest (destination) tag, result_2:

Programming Compute and Math Instructions


in an RSLogix 5000
MUL (Multiply) Instruction
Multiplies Source A with Source B and places result in Dest (destination).

When enabled, result_1 and result_2 are multiplied.

Result placed in Dest (destination) tag, result_3:

DIV (Divide) Instruction


Divides Source A by Source B and places result in Dest (destination).

When enabled, Valve_Capacity1 divided by Valve_Capacity2.


Result placed in Dest (destination) tag, Valve_1and2:

Programming Compute and Math Instructions


in an RSLogix 5000
NEG (Negate) Instruction
Changes sign of Source (positive or negative) then places result in Dest (destination).

When enabled, coke_weight1 becomes different tag value.


New value placed in Dest (destination) tag, Coke_weight:

Important:

Negating a negative value, result is positive. Negating a positive


value, result is negative.

ABS (Absolute Value) Instruction


Takes absolute value of Source and places result in Dest (destination).

When enabled, calculates absolute value of result_6.

Answer placed in Dest (destination) tag, result_7:

Programming Move Instructions in an RSLogix 5000


Move Instructions
Output instructions that modify/move bits from one location to another.
Data moved from Source to Destination.
If you want to

Use this instruction


Name

Mnemonic

Copy a value (move the source value into the


destination)

Move

MOV

Copy a specific part of an integer (move the


unmasked bits of a source file into the destination
file)

Masked Move

MVM

Moves bits within an integer or between integers

Bit Field Distribute

BTD

Clear a value

Clear

CLR

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.

Programming Move Instructions in an RSLogix 5000


MOV (Move) Instruction
When enabled, copies Source value to Dest (destination) location.
Important:
Source value remains unchanged during move
operations with MOV instructions.

Você também pode gostar