NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Sensors, Actuators, and Robotics » ADC ignores Pin DC5 and all pins pull high/low together
June 07, 2011 by KilbySeale ![]() |
Hi All, I am trying to use pins DC5-DC2 to do analog to digital conversions. However, I am getting extremely strange behavior. I am using the following piece of code to read from each pin, but pulling one pin high causes all of them to go high (generally speaking, to varying degrees), and pulling one pin low causes all of them to go low. Additionally, pin DC5 seems to be responding to ADMUX=4, which is puzzling to me. Am I doing it wrong? +>J while(1) {
} return 0; } |
---|---|
June 08, 2011 by Rick_S ![]() |
How are you pulling them high? Is there a pulldown on each port to ensure it's low when not high or are you trying to read a true analog signal? Rick |
June 08, 2011 by bretm ![]() |
Is your adc_read starting a new conversion after you change admux, or is it reporting the result of the previous conversion already started with the old admux and then starting a new conversion? The adc_read in the temp sensor sample project does the latter, so it doesn't work if you're changing admux. |
June 08, 2011 by KilbySeale ![]() |
At this point I am debugging, so I am manually pulling them high or low by connecting them to the rails. I have the code set up to show on the LCD the signal it is getting for each pin. Fixing the adc_read() fixed the initial problem with DC5, etc. Thanks Bret!!! Now... for actual signal. How do I go about pulling them down? Do I have to use NPNs or is there an internal way? (Would it be NPNs or PNPs?) +>Josiah |
June 08, 2011 by Rick_S ![]() |
Do you have a wire to ground on all of the adc inputs except the one you are connecting to 5v or are you leaving them floating? If you are leaving them floating, you will get odd results. To pull them down, just connect a 10k resistor between each input and ground that way when they are not being forced high, the resistor will keep them low. Rick |
June 08, 2011 by KilbySeale ![]() |
That did it. Thanks!!! |
Please log in to post a reply.
Did you know that you can make a spooky Halloween Jack-O-Lantern with a microcontroller? Learn more...
|