Quote:
Originally Posted by Demothesis
As long as you're on the topic, where did you go to learn how to use the gyros? Is there another way besides using Kevin's code? Like always, the simplest solution will be the best  and I find that Kevin kind of goes overboard with his code (hence the need to all but re-write the default code).
Demothesis
|
Really... you need almost all of the 'overboard' code he writes. If you're planning on integrating rate of rotation up to absolute angle with any kind of repeatability, you MUST have extremely precise sampling timing so that you don't under or over integrate a specific sample of rotation rate. Any variations in the sample rate will cause erroneous headings.
The reason kevin's code looks so confusing at first is that it allows the analog converter to run in a hardware triggered mode. This way, as much of the time critical sampling as possible is done on a hardware only basis, to cut out any possibility of interrupt overhead causing a variation in sampling interval.
It's a really great system... that would be even greater if the processor in the FIRST controller had DMA like some of the newer/fancier Microchip processors... imagine hands-off gyro oversampling that only bothers to interrupt your code after all the samples have been taken, since they were directly recorded to RAM by the DMA.
-q