|
Solution to Timing Loops
I have found out how to time. Based of the information from Innovation First, a loop is every 26.2 ms, assuming your code does't lengthen it. Based off of that, there are 38.167938931297709923664122137405 loops per sec. So to do close timing without overloading the stamp, you do:
Time VAR byte
RealTime VAR byte
Time = Time + delta_t + 1
if Time > 38 then
Time = Time - 38
RealTime = RealTime + 1
EndIf
This way only uses 2 bytes insted of a byte and a word. I tryed the delta_t * 262 / 10 but it overloaded the stamp and was very inaccurate.
Based of of this formula, then the basic stamp will be 0.530431579 seconds fast at end of match.
You can check this information on this xls I inclosed.
__________________
2016+ - Team 6013 Lead Engineer
2002-05 - Team 45 Software/Electrical
A robot is like a campfire: it takes a while to bulid it, and then everyone surounds it!
A world without standards is chaos. A world with standards is chaos.
|