Been having a bit of a fight with pins A6 and A7 on my Pro Mini. Started searching and at first found various conflicting posts and information:http://arduino.cc/en/Reference/PortManipulation
PORTC maps to Arduino analog pins 0 to 5. Pins 6 & 7 are only accessible on the Arduino Mini
DDRC - The Port C Data Direction Register - read/write
PORTC - The Port C Data Register - read/write
PINC - The Port C Input Pins Register - read only
Unless everyone I've pasted below saying 6 and 7 are purely analog input only and have no digital buffer, are wrong, then it would probably help to clarify the line above and rewrite it to:
Pins 6 & 7 are only accessible on the Arduino Mini and are analog inputs only and therefore can only be read with analogRead()
Here's why I was getting confused:
ADC6 and ADC7 can be used if you read and write directly to the registers.
They can also be used with the Arduino libraries if you use a Arduino Pro Mini compatible board.
So you can
This has already been answered above, port C bit 6 is the reset pin, port C bit 7 is
not used at all. Standard Arduinos do not configure port C bit 6 for use so that
the pin can be used as RESET.
Analog inputs 6 and 7 have nothing at all to do with port C or any other port.
They don't? But the Arduino guide says they do!
You can always use analogRead (6) and analogRead (7), which should just work.
And no, you can't _control_ ADC6 or 7, they are only wired to the analog multiplexer, so have no output
capability. In fact port C bit 6 can be mapped to the RESET pin if the chip is appropriated fused, and port C
bit 7 is unassigned. The standard bootloader keeps the reset pin as a reset signal so bits 6 and 7 of port
C are not used.
The analog inputs 0..5 share pins with digital port C bits 0..5, hence they can be set as digital I/O.
Ah, that seems a bit more definitive.
So the two extra SMD pins can be read with AnalogRead(6) for ADC6 and AnalogRead(7) for ADC7? Sounds great - will give it a shot!
Make sure you review boards.txt and select a board type that uses "eightanaloginputs"
A6 and A7 are 100% analog only pins and they are only available onboards with the surface mount version of the ATmega328.
Don't try to treat them as digital inputs.
OK, starting to get a consensus among the old-timers here:) I'll go with that.
And the docs says (http://www.atmel.com/Images/doc8161.pdf
Note that ADC pins ADC7 and ADC6 do not have digital input buffers, and therefore do not
require Digital Input Disable bits.
And finally, joy of joys:
Except for A6, A7 on surface mount '328P equipped boards when they are broken out. Those are analog input only.
Even those work well for reading switches.The other day I connected a rotary encoder *and* two push-buttons to A6/A7
(with suitable resistors to give different voltage levels).
Fantastic! In which case, assuming that's right, I can move the rotary encoder to these two analogue read-only pins, freeing up two digital output pins, meaning I have exactly the right amount of pins needed and no extra shift registers or port expanders required.
The bottom line is:
ADC6 and ADC7 are not reserved for any other purpose, they are exactly like the other analog pins, except that they are only analog inputs (cannot also be used as digital pins)
Therefore, unless anyone disagrees, might it be an idea to clarify that port manipulation page?