05-31-2011, 09:52 AM
Why don\'t you try using only two counters.
Counter1 counts from 0-255, as soon as you add another to counter 1 it wraps to 0 and then you set Counter 1 to 1 and you can count again from 0-255 using Counter1. When you get to another 255 then add 1 to Counter 2 etc.
This way you can count to huge numbers. Counter 2 will always show how many times Counter 1 overflowed. For the value 1000 you will have the following:
Counter 1 = 232
Counter 2 = 3
The calculation is then 232 + (3 * 256) = 1000. For 64201 it will be 201 + (250 * 256).
That is if my maths are correct :-) How to implement it in Comfort is another story... I haven\'t done it myself but I am sure it\'s not too difficult.
Ingo
Counter1 counts from 0-255, as soon as you add another to counter 1 it wraps to 0 and then you set Counter 1 to 1 and you can count again from 0-255 using Counter1. When you get to another 255 then add 1 to Counter 2 etc.
This way you can count to huge numbers. Counter 2 will always show how many times Counter 1 overflowed. For the value 1000 you will have the following:
Counter 1 = 232
Counter 2 = 3
The calculation is then 232 + (3 * 256) = 1000. For 64201 it will be 201 + (250 * 256).
That is if my maths are correct :-) How to implement it in Comfort is another story... I haven\'t done it myself but I am sure it\'s not too difficult.
Ingo
