Go to Post We should also remember the fact that the FIRST Manual is not supposed to be enterpreted with lawyer speak. If so you could make it say many things. - Anthony [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 12-02-2005, 15:38
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Exclamation Using gyro.c with other analog sensors no go

I'm going through the interupt routine in gyro.c to figure it out, and I believe I found a major issue with it. Kevin: Please check!

In the interupt routine, it does the following things (in order):
  1. Initialize i and accum if calculating bias
  2. Set old_calc_gyro_bias to calc_gyro_bias
  3. Reads ADC value
  4. Adds it to the accumulator
  5. Begins another ADC conversion
  6. Adds to accumulator.
  7. Does biasing code

The problem with this is if you try to read an analog channel (and clear the ADC) outside of the interupt. For this to work correctly, the gyro must be the only sensor connected to your analog inputs.

The Details:
The ADC converter works asyncronously from the controller. To use it, you have to:
  1. Set the channel or open it and wait for it to settle
  2. Tell it to begin a conversion
  3. Wait until it finishes
  4. Read the value
  5. Close it (?)
If anything is changed during a conversion, you have to start over from #2. The interrupt assumes that the conversion finnished successfully, and that the value in the registers is the one from the gyro. If you read a value, it will likely read the value from the last sensor you used.

Is there any fix to this? This seems to be a large blocker, since the gyro code is dependent on it.

And yes, I did update my code.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
heres the code. y this not working omega Programming 16 31-03-2004 15:18
Getting Fancy with Sensors FadyS. Programming 30 10-03-2004 15:02
IR sensors: dealing with reflections? gnormhurst Programming 3 08-03-2004 20:04
Why not analog sensors?? gnormhurst Programming 16 07-03-2004 16:14
Interrupts and rotation sensors kor Programming 3 12-02-2004 11:05


All times are GMT -5. The time now is 12:00.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi