Quote:
|
Originally Posted by BradAMiller
The sensors (digital and analog IO) happens as fast as you can read/write data to those ports. There is no 26ms interval when reading or writing those.
If you want to write a PID loop and get the loop time for your integral term, a good way to do that is with a timer. It will count in 1ms increments and you can factor the time each time through the loop into your calculations. Another was is to only do the calculations at longer intervals - again a timer will help with that.
|
Brad,
Thank you so much for your insight. I just posted a question about this very thing (not using a While Loop in our code) in this post:
Dummy Link Here
So what your saying above, is that EasyC excute different than FRC Default code last year? We can poll the I/O faster than the 26ms? In other words, if we have an encoder (quadature), we should be able to get a decent velocity measurement from the inputs correct?
We did start to use the timer in our test.zip file above. Basically setting up a timer, then sending our code into "poll the encoder and get velocity reading" function (get_right_velocity) function.
Makes sense now that you've said something about the while loop.
I think maybe if Intellitek updated their software to version 2.1, they should make a change to the "Competition Template" and just add a blank While Loop in the OperatorControl function. This would eliminate some of our guess work, and now maybe the timers won't reset on their own.
I hope your right about those dumb printF statements. I would be nice to actually see a long varible come out to a terminal session like that and ACTUALLY BE what the varible is inside the controller.
Of course, what would be even NEATER is if Intellitek could make an online debugger or step/break logic in the PIC. You could hover your mouse over a varible and see what the varible is or even access to a VARIBLE TABLE...every varible created would go to a varible table, then you just open the table and view your varibles like a watch window instead of having to do all the printF statements. But I suppose that amounts to controller OVER-HEAD and then everyone would be complaining about that....I wouldn't complain at all...anything to make debugging a PIC controller easier....
I said it many times before and I'll say it again...I dunno how you PIC programmers stand it, you don't know what your missing compared to other CPUs, such as IAI Robot, PLCs, Servo Motor Platforms. They all support some sort of online debugger, make life tons easier....I do have one servo motor that I program that works the same way as a PIC, it's called a Smart Motor by Animatics. Not so "smart" to me when you have to debug it through a terminal window.....