View Full Version : Comparing two STRUCT?
April 25th, 2006, 04:23 PM
It is possible to compare two STRUCTs that has the same number or entrys and the same data type? If not, it is posible to transform the STRUCT into the word or integer or any other data type?
Thanks for your help.
April 25th, 2006, 04:50 PM
Sure, but it really doesn't have anything to do with it being in STRUCT format (I'm speaking from a Siemens perspective).
All you would do is compare the bytes, words, or doublewords one by one until you are finished. You can determine the length dynamically if you want. As for different lengths, I don't know what the point would be of measuring structs of two different lengths (they will never be equal, right?).
Another way to approach it would be to determine a checksum of each, if all you wannted to know if they were equal or not, and didn't care about what is different.
April 25th, 2006, 06:14 PM
I am doing a testing program, which with the technician will connect the inputs and outputs of the device, will select the inputs and outputs on the display and then will test the device by pressing the buttons on the remote console pr touchscreen.....
So i was thinking to compare the inputs that will be selected through the OP and the inputs on the PLC, if the value is equal the output will be true if not the output will be false.