View previous topic :: View next topic |
Author |
Message |
Guest
|
free running adc? |
Posted: Mon Feb 11, 2008 10:37 am |
|
|
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
|
|
Posted: Mon Feb 11, 2008 2:36 pm |
|
|
There is no CCS A/D function that does continuous conversions.
You have to write the code to do it. |
|
|
Ttelmah Guest
|
|
Posted: Mon Feb 11, 2008 3:35 pm |
|
|
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
|
|
Posted: Tue Feb 12, 2008 1:52 pm |
|
|
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
|
|
Posted: Tue Feb 12, 2008 4:20 pm |
|
|
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
|
|
Posted: Wed Feb 13, 2008 2:43 pm |
|
|
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! |
|
|
|