PDA

View Full Version : A/D converter problem



netstranger.nz
- 14th August 2009, 06:53
Hi Everyone,
I am having difficulty using Pic’s onboard A/D converter. Can someone give an advise please.
I want to measure the voltage across automotive battery when the car is running. When the vehicle is stationary the power to the PIC is off (to prolong the battery quiescent time). So I assembled a simple test circuit on the bench. The problem is that when the power to the Pic is off it still could be powered if the potentiometer is in high(5v) position. But the one that worries me the most is if the potentiometer is in midway( I read around 1.3v at Vdd with Pic’s 5v disconnected) position the Pic locks up and I have to reconnect the power several times to reset it and make it go again.
I really don’t want to use external brown out circuitry if possible. May be you’ve come across the same problem. If yes please share your experience.

Melanie
- 14th August 2009, 09:42
There is no easy solution to your problem. If the main power is OFF to the PIC, then it can be powered via any of it's input pins through it's internal protection Diodes.

Easiest and cheapest solution is to power the PIC at all times, but when it is not needed, put it to SLEEP to conserve Battery power.

Otherwise you will have to devise additional circuitry to disconnect all independently powered pins from the PIC when it needs to be switched OFF. If you only have ONE independently powered and connected pin, then a single 5v Reed Relay is the easiest solution... when the PICs supply is disconnected, the Relay will disconnect your input.

netstranger.nz
- 14th August 2009, 20:42
Hi Melanie,
Thanks for the advise. A reed relay disconnecting the input will do the job. I got one from local electronics supplier. It is 100v 0.5A 500Om coil. I tried to drive it directly of Pic’s pin and it works well. I attached the oscillogram.

Melanie
- 14th August 2009, 20:49
Just remember that if it hasn't got a built-in Diode to protect against back-emf spikes, you must add one otherwise you will run the risk of destroying the PIC pin that the coil is connected to.

languer
- 15th August 2009, 04:44
For multiple inputs you can look at analog switches (e.g. MAX312 and equivalents). These will require a few additional parts to guarantee the power-up conditions (e.g. pull-ups or pull-downs on control lines).

netstranger.nz
- 13th September 2009, 07:56
Just found one more solution reading this thread http://www.picbasic.co.uk/forum/showthread.php?t=698&highlight=jswayze

I put 10k resistor in series with the AD pin and changed the PIC to 12F683 or 16F684 (it doesn’t work with 16HV785).