I’ve had some very interesting results when I’ve been working on using loop counts as timers for distance calculations. I kept getting results being half of what I wanted. So, I threw in a timer and manually timed how many loops would go by in a minute… and after dividing my results I found that each timer tick took very close to twice the 26.2ms data stream (since I did it by hand I don’t know if it was exactly twice or just close). I was wondering why this is.
I was thinking… are the loops really 52.4ms for calculations and such? Or does it vary based on how many calculations you have or something? I’d like to find out why this seems to be occuring, and if it is 52.4ms that will be a simple fix by modifying the number used, but because of precision purposes I want to find out if I’m right or not… or if the loops will take longer and longer with more and more calculations. I’ve never used timers to do these types of calculations so I’ve never run into this before. Any ideas?
Since you talked earlier about using a lot of floats, I’d assume you are doing more then 26.2ms worth of calculations. You can check the packet number. If you only get every other packet, your program is taking to long.
Just a thought…
You aren’t by any chance testing on the EDU controller are you?
EDU = 17ms slow loop (~59 loops per second) as opposed to the FRC 26ms.
Nah. I’m going the wrong way aren’t I? Faster rather than the slower you are experiencing. (Too early on a Sunday morning. I shouldn’t post before noon.)
I ended up not using a bunch of floats. I was just curious with that thread as I was planning some things out. Currently I’m working with 2 floats, and when I don’t run the functions using floats my counter is still counting at about half the speed it should be.
Doesn’t the master uP stop your code if it exceeds the 26.2 refresh limit? (and the “code error” light comes on) Or does your code call putdata() in the middle of the loop?