3/20/2013 11:43 PM | |
Posts: 60 Rating:
|
Hi Huggy, how do I add a checksum?? I think this will suit my requirement because I can use the different checksum to trigger my function.
|
3/21/2013 12:37 AM | |
Joined: 7/7/2010 Last visit: 6/8/2023 Posts: 13373 Rating:
|
As you initialize your DBs during the first scan, add up the bytes and stuff that value into your checksum. It might bea DINT. Each time you update any portion of the DB, add the bytes for your DB that change to your checksum. You can do it any number of ways, but as long as you do it the same way to both DBs. Then you can say, ---|DBprimary.Checksum <> DBsecondary.Checksum |----| FBxxx |- There will always be a possibility that significantly different values can add up to the same checksum value, so if it becomes a problem, you can look at various weighting factors for different bytes of your DB so they always vary more dramatically. Like multiplying by some factor of 2 (like 4, 8, 16, etc) so the likelihood of various bytes somehow ending up with the same checksum result. Try it and let us know how it goes. This is also worth a look before you make your changes: http://en.wikipedia.org/wiki/Checksum |
Last edited by: huggy_d1 at: 3/21/2013 12:39 AMlink to wiki for checksum science guy |
|
Follow us on