View Single Post
  #11   Spotlight this post!  
Unread 12-02-2005, 12:24
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
Re: Unknown Blinky-light type Errors.

Quote:
Originally Posted by Kevin Watson
You're using gyro code that is two revisions behind. I would dump that code and use the latest. BTW, what was the problem (I'm having trouble keeping track of the various CD and e-mail discussions I've got going)? Was it something knuckleheaded I was doing?

-Kevin
Sorry, I didn't make either post very clear.

In the old version of the gyro code, the initialize function would call OpenADC() but not CloseADC(), leaving the A/D converter open. If you wanted to get an analog value by calling IFI's function, it would also call OpenADC(), which is probably bad, and CloseADC(), also bad. The interupt that handled the gyro doesn't call anything other than to get the value. The only way this would work is if Microchip's code kept track of nested Opening/closing of the ADC.

The way I solved this is that I put Set_Analog_Channels() in an Initialize_Analog_Channels() (or similar) call, which would call OpenADC(). Then I changed Get_Analog_Value() so it set the analog channel without opening/closing. I also changed the Gyro interupt so that it would switch channels as well.

I haven't checked this yet for the new code, I'm in the process of merging them. And a few of the function names are probably wrong.