PDA

View Full Version : Inner workings of adc



Michael Wakileh
- 26th October 2009, 19:49
Hi! I've been cathing up on theory, and have questions regarding the inner/electrical workings of the ADC module and Chold (Sample and Hold Capacitor).

reading through various documents (for example ww1.microchip.com/downloads/en/AppNotes/01298A.pdf)
I'm left with some uncertainties.

It is currently my understanding that simply pointing to the correct ADC Channel (via ANSEL Analog Select bits) will connect and charge/discharge CHOLD to the level at that pin. In the beforementioned reference that pin is
a driven digital output so Chold is charged to Vdd....

I'm guessing the Analog Select Bits directly control the Sampling Switch Rss. So its also possible to sample....and then disconnect CHOLD via ANSEL and still start a conversion via the godone bit?
I also assume disconnecting CHOLD only works as long as the go/done bit hasen't been set yet..

"Sampling and Conversion: After a new channel
is selected, a minimum amount of sampling time
must be allowed before the GO/DONE bit in
ADCON0 is set to begin conversion. Once
conversion begins, it is OK to select the next
channel, but sampling does not begin until current conversion is complete!
....."

I'd be greatful for any pointers...
(unfortuntely I don't have my electronics nearby to gain insight... would have been a quick test of a Vref...)

greets mike

mackrackit
- 27th October 2009, 02:26
This thread might help clear things up. Then again it might not.
http://www.picbasic.co.uk/forum/showthread.php?t=11947
let us know.

Michael Wakileh
- 27th October 2009, 10:01
Thanks you for replying. I'm not having problems on the software side... I've used the ADC module quite often without really grasping some of the inner workings...(for that I simply select the channel, wait the sampling time, set go/done)


I guess the questions I have is:

Can the CHold capacitor be charged (by selecting the appropriate channel and waiting the sample time), then be disconnected by deselecting the channel, and still be converted by immediately setting the GoDone bit after disconnection?
regards,
mike

mackrackit
- 27th October 2009, 12:32
Not sure what you are wanting???
Selecting the channel just tells what channel the go/done bit converts if the ADC is enabled.

Michael Wakileh
- 11th December 2009, 22:15
Sorry, I've been quite busy and never got back to this... I had wondered why, in the above mentioned appnote (ww1.microchip.com/downloads/en/AppNotes/01298A.pdf), 2 channels are needed (and if it's possible to get by with just 1)... I plan to do some testing one of these days, but I'm busy with other projects at the moment... anyway, that's where I was going with my post...

regards
Michael

Acetronics2
- 12th December 2009, 09:17
Hi, Michael

2 Channel required , why ???

SIMPLY because it is needed to charge CHold to Vcc ... through one channel. ( How else ? )

AND the second channel is used for measure...

sooo ...

2 "buttons" need 3 channels , 3 buttons ... 4 channels, etc, etc ...

Capisce ???

Alain

Michael Wakileh
- 13th December 2009, 19:44
Hi Alain!

without checking the datasheets or functioning code snippets
my idea was the following:

only 1 channel for cap touch (example on a 12F)
---------------------------------------

1...Tris to output and pin high/Vdd

2...charge Chold / Point ADC to the High pin (for example ANS<3:0>: Analog Select bits = 0001)

3...disconnect Chold ANS<3:0>: Analog Select bits = 0000

4...digital output low... dicharge external capacitance

5...Tris to input

6...Analog Select bit 0001 / (Point ADC to sensor on the same pin)

7...Begin Conversion.../...Set GODONE

----------------------------------------------------------------------



I guess I have 2 more uncertainties

in the following procedure:
1 tris to input
2 pointing ADC to input channel (using Analog select bits)
3 wait for Chold to charge to input pin level
4 disconnecting Chold from input channel (ANS = 0000)
5 Start Conversion....


1))) Can it work? Is only the charge on Chold needed for the conversion?

2))) Is there only 1 Chold for all analog channels, or one Chold on every analog channel?



These are just some thoughts..... I will get around to testing myself next month....

If someone can point me to a datasheet or appnote that sheds some light on this, I would be greatfull...

regards,
mike

Michael Wakileh
- 13th December 2009, 19:49
Sorry... please ignore 2)))

Michael Wakileh
- 31st January 2010, 20:49
Never posted my thoughts....
the method woudn't work because the Ansel bits (which select the channel the sampling cap is connected to) don't allow for the sampling cap to be disconnected from all the channels... too bad...

As much as I looked around I couldn't find a single good resource on how the Adc internals really work... as far as I can guess the Sampling cap comes after the multiplexer or is built into it...

If I ever get the chance to make some pcbs I will be testing a few other ideas I had... will post my results then...

ScaleRobotics
- 31st January 2010, 21:16
The online book from Mikroe explains it with some nice visuals.

http://www.mikroe.com/en/books//picmcubook/ch7/

http://www.picbasic.co.uk/forum/attachment.php?attachmentid=3950&stc=1&d=1264972430

Michael Wakileh
- 4th February 2010, 15:22
Hi, thanks for the reply. I believe I stumbled upon that image when I started the thread. Together with these 2 attached images (from microchip datasheet), I had tried to figure out where exactly the Sampling cap is located (in the multiplexer?, between multiplexer and adc unit? in the adcunit?)

Currently I believe it may be in the adc, with godone disconnecting it from the multiplexer and connecting it to the successive approximation circuitry (new channel can be selected after godone is set, but sampling of new channel begins only when conversion is complete) .

I also had a few other questions even though they may have no practical application:

For example can the sampling cap be connected to a pin (using Ansel) while ADON is off? Does the Sampling Cap retain its charge when ADON is off?


I guess that led to a useful question as well and I haven't found an answer yet:

Can internal resistance and capacitance of a pic pin be measured using a voltmeter/LC-meter without destroying the pic?

Michael Wakileh
- 4th February 2010, 15:25
Any information regarding the last question would be great to know in advance:p