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 support@ccsinfo.com

free running adc?

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








free running adc?
PostPosted: Mon Feb 11, 2008 10:37 am     Reply with quote

I have 2 different boards. 1 transmits wirelessly to the other. The receiver module has a pin that puts out a voltage proportional to the strength of the signal received. Im trying to implement squelch control by monitoring that pin, and only accepting transmissions when the voltage is above a certain level. So I need to run the adc non-stop. Is there a predefined mode that does this, or do I need to run this through a timer? The receiver PIC is a PIC18f25j10.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 11, 2008 2:36 pm     Reply with quote

There is no CCS A/D function that does continuous conversions.
You have to write the code to do it.
Ttelmah
Guest







PostPosted: Mon Feb 11, 2008 3:35 pm     Reply with quote

Also, remember that the ADC, can't actually _do_ continuous conversions. The ADC in the PIC, has a capacitor, which needs to charge _back_ to the incoming voltage after a conversion (it is disconnected from the incoming voltage during the conversion time), so you must wait long enough between conversions for this to happen. Typically this takes as long as the conversion itself.

Best Wishes
Guest








PostPosted: Tue Feb 12, 2008 1:52 pm     Reply with quote

Thanks. I was able to achieve the desired result by placing a read_adc() command in my while(1) loop. Initially I thought this would be too slow, but evidently not.

I know that some atmel avrs have a free running mode, so it is possible. Its just not implemented on PICs.
Ttelmah
Guest







PostPosted: Tue Feb 12, 2008 4:20 pm     Reply with quote

The larger PICs, with DMA abilities, do have the ability to automatically perform a sequence of acquisitions to a block of memory.
Beware with what you are doing, that if the time from the end of the ADC conversion, back 'round' the loop to the start of the next conversion, is less than typically 10 to 12uSec (it almost certainly will be if your clock is more than a couple of MHz, - depending on what the 'loop' condition is in the while), the results of the ADC conversion _will_be wrong, because of the capacitor charging issue.
Some of the 'latter' 18 chips, have the ability to program delays between acquisitions, automatically, to avoid this.

Best Wishes
kolio



Joined: 06 Feb 2008
Posts: 26

View user's profile Send private message

PostPosted: Wed Feb 13, 2008 2:43 pm     Reply with quote

You can try with built-in comparator and internal programmable Vref, which can have 16 steps something. This is fair enough for RSSI.
Good luck!
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