1/27/2010 7:30 AM | |
Joined: 10/7/2005 Last visit: 6/9/2023 Posts: 2969 Rating:
|
Hello auto_r it depends on what you do with the system time. Let's say you use SFC64 to for example to count or measure a certain time period. In this case you would saved a "start timetick" value in a variable andcalculate the elapsedtime by subtracting the saved"start time" from the current SFC64 "timetick" value. Should you now have an "overflow" of SFC64 (which means SFC64 timetick value has reached 2147483647 msand starts again "ticking" from0 ms), you're subtraction will give you a negative result. This can be easily deteted by the "A <0" STL command (in case you use STL) ORby using the "<0" box from the "Status bits" Elements (in case you use LAD or FBD) ORby simply programming an DINT comparator to check if the subtraction result is negative (i.e. <0). The rectification then comprises of adding L#2147483647 to the subtraction result to make up for the occured SFC64 "overflow" of the timetick value. In case you don't use a subtraction of a SFC64 "start timetick" valuefrom it's current value you could of course always implement one purely for the "overlow" detection I hope this helps |
Cheers |
|
1/27/2010 9:06 AM | |
Joined: 10/7/2005 Last visit: 6/9/2023 Posts: 2969 Rating:
|
Hello again auto_r you are correct, that's why the method that I described is "(T1-T0)<0" to detect the "overflow"
You will of course "miss" the overflow event in this case (even with "(T1-T0)<0"), but this doesn't matter sincethe resulting "measured" time difference between the two "checkpoints" would give you acorrect result of 5 ms in this case(i.e. why worry that a timetick "overflow" took place). I hope this helps |
Cheers |
|
1/27/2010 4:09 PM | |
Joined: 1/29/2006 Last visit: 6/8/2023 Posts: 438 Rating:
|
Hey, auto_r! A "serious" discussion about measuring of working time was held here: /tf/WW/en/Posts/29422 Have fun! uel123 |
Follow us on