Go Down

Topic: Pins A6 & A7 on the Atmega328P-AU (Read 2449 times) previous topic - next topic

SouthernAtHeart

I just learned (the hard way) the these pins can not be used as digital inputs.  On my PCB, I have them used that way, with a tactile button to ground.  So would it be okay to add a 10K resistor to A6 & A7, and then analogRead() them, instead?  I assume I should get either 0 or 1023?
thanks,

AWOL

I can't guarantee it would go to 1023, but generally, you're quite right.

SouthernAtHeart

Thanks.  It won't make the code look pretty, watching a dozen or so buttons, and 2 of them being analogRead() version. :) 

SouthernAtHeart

Another option for be to jumper A6 to A1, it is free. Would A1 work okay with internal pull-up for a pushbutton, with A6 connected to it?

Paul__B

Another option for be to jumper A6 to A1, it is free. Would A1 work okay with internal pull-up for a pushbutton, with A6 connected to it?
Absolutely.

No code to A6 then.

SouthernAtHeart

Hmm, I'll definitely have to go that route.  It seems that using analogRead() for buttons doesn't work well at all if they're needing to be read frequently

Paul__B

It seems that using analogRead() for buttons doesn't work well at all if they're needing to be read frequently
Well, it takes a good millisecond or so IIRC, which is a significant time if you are trying to get other things done simultaneously.  This can be overcome using assembler to interleave operations more closely.

OTOH, you do not need to read pushbuttons any more frequently than every millisecond and you need to re-read them over about 10 ms to exclude contact bounce.

SouthernAtHeart

I am seeing that from reading further. I see a lot of 'reading analog pins close together causes problems" but for a my push button, It's not that critical. Probably even less of an issue as I'm not really needing a real accurate analog reading. It pretty much shows 0 or 1023 with a 10K pull-up in a grounding button.

Go Up