![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| 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-. | |
| |
| | (permalink) | |
| Quote:
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/ | ||
| |
| | (permalink) |
| 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. | |
| |
| | (permalink) |
| 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. | |
| |
| | (permalink) |
| 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 | |
| |
| | (permalink) |
| 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 10k 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. | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| 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! | |
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| 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 |