CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

#int_AD

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
tavioman



Joined: 22 Feb 2006
Posts: 65

View user's profile Send private message

#int_AD
PostPosted: Wed Feb 22, 2006 1:06 pm     Reply with quote

How can I read A/D during A/D conversion complete interrupt, and how do I start the conversion before main loop.
Thank You!
Ttelmah
Guest







PostPosted: Wed Feb 22, 2006 3:37 pm     Reply with quote

The 'read_adc' function, has an optional variable, that allows it to be 'split' into components. The default 'read_adc()', functions the same as 'read_adc(ADC_START_AND_READ)'. Read_ADC(ADC_READ_ONLY), returns the current ADC reading, if one is ready, without starting the conversion. Read_adc(ADC_START_ONLY), starts the conversion, and does not return a reading.

However I'd suggest 'rethinking' using the ADC interrupt. The problem is that calling an interrupt handler, inserts typically about 30 instruction times overhead, before the handler is reached, and the same again, returning from the handler. Then perhaps another ten instruction times to take the reading itself. So if you trigger an ADC conversion, you get perhaps 20uSec pass, before the interrupt triggers, and then you have a total overhead of perhaps 70 instruction times to actually 'get' the reading. Now assuming a 40Mhz processor clock, you 'save' potentially 200 instruction times where you can be doing other things while the reading occurs, but then lose back some 70 of these in the overhead associated with the interrupt handler. On slower processors, the overhead becomes greater than any saving....
In another thread, I suggested that instead, if you are using a timer interrupt, you can use this to read the value from the last conversion, and then trigger a new conversion, and not have to wait for either part.

Best Wishes
tavioman



Joined: 22 Feb 2006
Posts: 65

View user's profile Send private message

PostPosted: Wed Feb 22, 2006 3:44 pm     Reply with quote

Thank You!
tavioman



Joined: 22 Feb 2006
Posts: 65

View user's profile Send private message

PostPosted: Wed Feb 22, 2006 3:44 pm     Reply with quote

Thank You!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group