View Single Post
  #6   Spotlight this post!  
Unread 12-01-2006, 11:47
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Analog-to-Digital Converter Code

Quote:
Originally Posted by Joel J.
Let's suppose there are four analog signals being sampled and "buffered" by your code. The gyro is running on ADC_CH0 and the other three channels are for other devices. How do we know when the gyro specifically has new data available? I saw the ~update_count~ variable, but it seemed to just indicate when any new sample is available, not when the sample for a specific channel is. Am I going to have to modify your code (maybe add an array of update_counts, with each index correspondent with the channel's freshness of data?) to allow this functionality, or is it already there and I'm just not seeing it?
The update flag only gets incremented after all enabled ADC channels have been refreshed. You can get less latency (if that's what you're after) by doing the modification you described, or by just moving the gyro to the last enabled channel and continue using Get_ADC_Result_Count().

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org