PDA

View Full Version : Can Vref be turned on and off



rossfree
- 31st August 2006, 14:34
Hi all,

I have the need to use Vref for A/D processing of thermal sensors but do not want it when reading other A/D pins (serial buttons on one wire). Can it be turned off and on with program statements?

I'm using a 16f876 and picbasic pro.

Thank you!

Ross

paul borgmeier
- 31st August 2006, 14:45
Yes – the easiest way is to NOT use the ADCIN command but roll your own like that shown on MELabs website:

http://www.melabs.com/resources/samples/pbp/a2d10.bas

With this approach, you can change ADCON1 (which controls vrefs and A/D port assignments) whenever you would like. Make sure and read section 11 of the datasheet.

----------
edit: Being a control freak, I have never used ADCIN for A2D work - I would suppose one could change ADCON1 on the fly as well with this approach but this has not been verifed by me (I use the approach above all the time and know it works)
----------

mat janssen
- 31st August 2006, 14:49
By telling the adcon1 register to do that for you.
Read the datasheet please. Page 114 of the datasheet there you can read how!

rossfree
- 31st August 2006, 16:25
Thanks all, that'll do it!

I have to be nudged from time to time to read that blasted data sheet. It does not read easily for me... if you must know it. I must be ADD. My eyes glaze over within minutes and I leave a trail of drool across my desk calendar. I look like Jack Nicholson comming from back from his shock treatment.

I re-read the suggested pages and was able to understand the A/D module information in the data sheet. This must be a good day.

Thanks again!

Ross