compare data tables in RSLogix

Join Date
Apr 2002
Location
Just a bit northeast of nowhere
Posts
1,117
Forgive me if this one seems too basic, I should be able to figure it out, but it has me stumped. I tried searching for the answer, but I get so MANY results, I can't sort them all out.

In RSLogix 500, on a SLC 505, I have two data tables, F102 and F104. Both are 20 elements in length. I want to compare these two tables to see if they are identical (used for a change of state implementation).

I'm pretty sure I remember there is a syntax for using the EQU function to compare two complete files. I tried #F102, but this gives an error.

What's the correct way to pull this off?

Thanks,

TM
 
I'm pretty sure I remember there is a syntax for using the EQU function to compare two complete files.

I don't think so - at least not in RSLogix500 ...

in RSLogix5 the FAL instruction would come in handy - but RSLogix500 doesn't support that ...

see if the Indirect Addressing approach (attached) will get you going ...

a BIG WORD of caution ... remember that F-type values are SELDOM if ever exactly equal - so you're probably going to have trouble with whatever way you decide to compare the files - unless you can build in some sort of "tolerance" factor to handle "close-enough-to-be-considered-equal" situations ...
 
Last edited:
Hi again,

Thinking about what I'm implementing - the value in F102:0 is keyed in from an operator terminal. Does this mean that if I copy F102:0 to F104:0, then what I get in F104:0 may or may not equal what's in F102:0?

Strange...

TM
 
no - don't worry about what I said IF (big IF) that's what you're doing ...

the part I was thinking about pertains mostly to analog input signals ... for example: if you compare a 12 mA signal from ONE transmitter it will almost certainly NOT be equal to a 12 mA signal from another transmitter ... in fact, the signal from ANY analog transmitter will tend to "jiggle" a small amount ...

on the other hand, "operator entry" values should be OK ... if you MOV or COP the value into another location, then both locations should contain the same value ...

sorry if I alarmed you for no reason, but I've helped quite a few people over the years who have tried (unsuccessfully) to test analog signals for "equality" without realizing that the PLC is pretty doggone picky about what it regards as "equal" ...
 
Last edited:
No, if you copy the two will be EXACTLY equal. If that's the type of comparison you want then the EQU, even if spread out over many cycles to compare complete tables, will work.

The problem with comparing values entered from an HMI and values obtained by something like taking the float equivalent of a noisy analog input is that the two can be VERY VERY close but not EXACTLY equal. A difference in the tenth place may not mean a lot in a real situation but it wont be EXACTLY equal.

It's not a Twilight Zone thing. Two glasses of beer would seem equal if within one percent of each other but that difference is HUGE when it comes to the percentage differences floats can express.

EXACT equality is easy. 'Really really close' is harder to judge.
 
I see that my distinguished colleague Bernie and I posted the same idea at almost precisely the same time ...

that's quite understandable ... since we share the same general hairstyle, it's altogether fitting that we should share the same general views on PLC programming ...
 

Similar Topics

Okay so, I have a user data base that consists of 100 users that have 10 words of data each. So 1000 words. My log in data is coming in as BIN...
Replies
2
Views
2,092
Dear all, Could you please give me an instruction, how can I compare 2 data area? (I read a text with Barcode reader to DB1, I make a database in...
Replies
2
Views
1,542
can someone please help me, im trying to compare two "time of day" data types but i cant seem to do it, I have a time of day from a hmi, and i...
Replies
5
Views
4,062
Hi all, I need to change an IP address on a CPU and wanted to check the hardware config was correct. I compared the 'System Data' in the blocks...
Replies
0
Views
2,056
Hi, how can I compare data (of any type) in Ladder Logic and Structured Text? I know that for BOOL I can use NOT( XOR ), and for numeric types I...
Replies
2
Views
1,705
Back
Top Bottom