Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 30th October 2007, 07:05 AM   (permalink)
Lightbulb PIC 16F877A ADC matters

hi,

im having dificulties on ADC in PIC16F877A. i did the programming and it works fine with hardware. the problem here is when the input(RA0) is not present, the output of the adc is random and not zero. it supposed to be zero right?

note: the adc output goes well when there are analog input level between the Vref+ and Vref-.
mokh is offline  
Old 30th October 2007, 08:32 AM   (permalink)
Default

Quote:
Originally Posted by mokh
hi,

im having dificulties on ADC in PIC16F877A. i did the programming and it works fine with hardware. the problem here is when the input(RA0) is not present, the output of the adc is random and not zero. it supposed to be zero right?

note: the adc output goes well when there are analog input level between the Vref+ and Vref-.
hi,
If the ADC input is 'floating' I would expect it to pick up em noise,
if you have the ADC part of your program running and sampling the ADC input, you will get random results.
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is offline  
Old 30th October 2007, 10:34 AM   (permalink)
Default

Exactly, you can't leave the input pin just floating as it's high impedance and picks up noise. Adding a resistor from the pin to ground should stop it, I get no such pickup on my analogue tutorial board.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 30th October 2007, 03:12 PM   (permalink)
Default

Hrm.. that gives me an idea, I wonder if you could use a floating ADC as a way to get (pseudo?) random numbers.

It would be interesting to collect bunch of samples with it and see the distribution with a histogram or something.
Stellarcore is offline  
Old 31st October 2007, 04:38 AM   (permalink)
Default

the problem is, i need it to be floating.

what exactly i do is using the potentiometer to giving variable analog input to the adc. however, i removed the potentiometer stopper for some reason, so the potentiometer can turn 360degree. the problem appear when the potentiometer contact move to the point where i connect to the PIC. it mean, it connect to itself. not to vcc or ground.

i dont think modifie the potentiometer is an option.

btw, thanks for make me clear about the random output
mokh is offline  
Old 31st October 2007, 07:30 AM   (permalink)
Default

You need a resistor or two to stop the input floating when the potentiometer is in the dead area. If the resistance is much higher than the potentiometer, there will be little effect when the potentiometer is working normally.

A capacitor to ground could also help reduce the noise, if the potentiometer is far from the PIC, or there is a mains voltages nearby.

If you have a 10khm: potentiometer, a 330khm: resistor to ground from the wiper will have no noticable effect unless the potentiometer is in the dead area.

A 1µ F capacitor in parallel with the resistor will help keep noise down.

The PIC will read 0 when the potentiomer is in the dead area. You can make this read full scale by connecting the resistor between the wiper and Vcc. You can also make it read mid-scale by fitting resistors in both positions.
Diver300 is offline  
Old 31st October 2007, 10:03 AM   (permalink)
Default

Quote:
Originally Posted by mokh
the problem is, i need it to be floating.
No you don't, like I said above, fit a resistor from input to ground.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 3rd November 2007, 08:02 AM   (permalink)
Default

thank you all! i solved the problem. i put a series resistors 40k. 1st when i tried with 200k, 300k, the pin cant goes low maybe the resistant too high. then i tried with 40k and it work. im using 10k potetiometer, so 40k is enough as it is higher than 10k i think.

once again, thank you!
mokh is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
High ADC sampling rate PIC, 18F needed? bananasiong Micro Controllers 24 28th October 2007 01:13 PM
HS1101 capacitive humidity sensor; need nearly linear voltage to feed to a 1-wire ADC FirefighterBlu3 Electronic Projects Design/Ideas/Reviews 5 20th October 2007 12:06 AM
RTC with pic 16f877a fernandoagf General Electronics Chat 1 15th October 2007 12:12 AM
PIC 16f877a and PDIUSBD12 Hesam Kamalan Micro Controllers 2 10th October 2007 03:32 AM
16F877 Timer0 Interrupt Affecting ADC sebana Micro Controllers 13 12th September 2007 10:43 AM



All times are GMT. The time now is 08:59 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker