>> Linux for Electronics Design Automation
Thread views: 1536 View all threadsNext thread*Threaded Mode

(Stranger )
06/30/17 02:46 AM
AVR ATMega328P ADC channel selection issue Report this article as Inappropriate to us !!!Login to Reply

I'm tinkering around with an ATMega328P (here is the datesheet of atmega328p) right now and wanted to read an analogue value from a pin through the ADC and simply output the value to 4 LEDs. Really simple

This works kind of fine, except the channel selection. When I select a channel it works fine, but independently from the selected channel, channel 0 also always reads and converts. What I mean with that is that if I plug the cable into the selected channel pin, it reads the values correctly. When I plug it into any other channel pin it obviously doesn't, except for ADC0. No matter what channel I set, not only does that one read but also ADC0.

Why is that and how do I fix that?

I already checked my PCB for solder bridges, but there are none and I would also expect some slightly different behaviour with that.

Also ADC4 and ADC5 don't seem to properly convert either. Any idea why that is? The only clue I found in the datasheet is, that those two use digital power, while all the other ADCs use analogue. What's the difference, why does it matter and why does it not correctly convert my anlogue signal?

Both ARef and AVCC are connected according to the datasheet, with the exception that the inductor for ARef is missing.

Jump to



Internet Business Systems © 2018 Internet Business Systems, Inc.
25 North 14th Steet, Suite 710, San Jose, CA 95112
+1 (408) 882-6554 — Contact Us, or visit our other sites:
AECCafe - Architectural Design and Engineering TechJobsCafe - Technical Jobs and Resumes GISCafe - Geographical Information Services  MCADCafe - Mechanical Design and Engineering ShareCG - Share Computer Graphic (CG) Animation, 3D Art and 3D Models
  Privacy PolicyAdvertise