beautypg.com

Rockwell Automation DAG6.5.8 APPLICATION GUIDE SCADA SYSTEM User Manual

Page 397

background image

Publication AG-UM008C-EN-P - February 2005

Sample Ladder Logic E-15

The next three rungs create a data file comparison routine. This rung clears the index register (S:24) to prepare it for use in the Not Equal comparison instruction.

0003

CLR

Clear
Dest

S2:24

0<

CLR

Index Register

If any values differ between the first three words of B3:0 and N7:0, copy B3:0-7 into N7:0-7, trigger the MSG (which will write N7:0-7 to the Master) and jump out of the routine.

0004

LBL

Q2:1

Compare
Rung

NEQ

Not Equal
Source A

#B3:0

0000000000000000<

Source B

#N7:0

0<

NEQ

Data Compare Buffer

COP

Copy File
Source

#B3:0

Dest

#N7:0

Length

8

COP

MSG Write Buffer

U

N7:90

15

MSG
Enable

JMP

Q2:2

Jump to
MSG Rung

If the current value comparison found no differences, increment the index register. As long as the index register (S:24) is still less than the number of words being compared, jump back to the previous rung to
perform the next value comparison. Otherwise, fall out of the routine.

0005

ADD

Add
Source A

S2:24

0<

Source B

1

1<

Dest

S2:24

0<

ADD

Index Register

LES

Less Than (ASource A

S2:24

0<

Source B

3

3<

LES

Index Register

JMP

Q2:1

Jump to
Compare
Rung

The next two rungs are the MSG rungs. Timer T4:1 is used as the MSG timeout timer, with a preset value of 10 seconds. Note that the MSG timeout value should be set to at least twice the channel 0 poll timeout
value.

0006

LBL

Q2:2

MSG Rung

N7:90

15

MSG
Enable

N7:90

13

MSG
Done

N7:90

12

MSG
Error

EN

DN

TON

Timer On Delay
Timer

T4:1

Time Base

1.0

Preset

10<

Accum

0<

TON

MSG Timeout Timer

T4:1

DN

MSG
Timer

L

N7:90

8

MSG
Timeout

"Report-by-exception" write instruction to the SLC Master. This MSG block is configured to write 8 elements ( words) from this Slave's Source File N7:0, out channel 0, to the Master's (Target Node Address 0)
Target Destination File N7:10. MSG can only be triggered if DF1 is the active protocol.

0007

S2:0

11

Active
Protocol

EN

DN

ER

MSG

Read/Write Message
Read/Write

Write

Target Device

500CPU

Control Block

N7:90

Control Block Length

7

Setup Screen

MSG

Write MSG to Master

0008

END