S7 Data block comparisons

RheinhardtP

Lifetime Supporting Member + Moderator
Join Date
Oct 2004
Location
Perth
Posts
562
Hi All,

I need the CPU to compare 50 bytes of data in 2 seperate Data blocks without PG online,
I couln't find anything in any standard Step 7 blocks,

I know you can compare Real,INT and DINT but need a bit more data compared.

I though of using the XOR DWORD function which will generate a value < 1 if DWORD data is not the same, then i still have to look for value < 1 than ect., and i still have to generate x-amount of merker bits to manipulate a single bit result.
Same or Not.

Must be an easier way.

Would appreciate any feedback

Kind Regards.

Rheinhardt
 
Hello could you break the 50 bytes up into seperate data units like int's then add up all the seperate values to create a new value which is your new data format it could be real int dint word dword what ever and then do the oposite for the data you are compare to, so that you could see and understand what you are looking at.?????
 
STL Code

You could use a loop with indirect addressing, stepping though the words 1 by one, and set a flag when your XOR DWORD (or XOR WORD) command finds a difference. Off cource you reset this flag before you start the search.

I have sample code that does something very similar (Uses three DB Blocks as inputs, sets a (horn) bit when there is a difference in the first two, unless the difference was allready detected once indicated by a bit in the mask. I use this routine to find new alarms (bits) in a DB block, and sound a horn for the important new alarms (hence the mask DB). Unfortunately most comments are in Dutch, which you may be able to read if you speak afrikaans?
 
I have not done this and it would probably not be as simple as this but how about something along these lines:

Take the first byte of each block in as a pointer. Start a loop that reads in the pointed value & compares, Saves the result, an increments the pointer.
 
Looks right

Hi progger,

yes, this looks like the one i need, searched on the Simens website but couldn't find it, any way you can help me get hold of this one??

Regards

Rheinhardt
 

Similar Topics

Afternoon, I have a DB in TIA Portal V16 that is optimised. I cannot change this. There is an array inside that block which consists of 3000...
Replies
9
Views
1,035
Hello all, PLC-programming noob here. I have multiple clients accessing some data on my Siemens S7 1211C PLC; some OPC clients and some direct...
Replies
30
Views
8,190
Hey people, I have been using GET_NAME , GET_IM_DATA and ModuleStatus FB to get an info from Modules inside my program, but ever since and...
Replies
4
Views
2,494
Hi, just wondering if I could get some advice when setting up function blocks (Currently using Siemens S7) using a STRUCT data format. Say I was...
Replies
11
Views
2,921
Hi, Ok bear with me, I have an Array of Real in a DB ranging from 0 to 10. In ladder I want when count pulse = 100 move count into Array 0...
Replies
1
Views
2,060
Back
Top Bottom