Go Down

Topic: IDE change - please add support for ADC6 and ADC7 ! (SMD Uno) (Read 1 time) previous topic - next topic

daemach

I am building a custom board based on the SMD Uno.

I like being able to use the Arduino IDE to code/debug with.

I noticed that the SMD version of the Uno has access to 2 extra ADC-capable pins but it doesn't use them. What would it take to modify the IDE code to recognize and use those pins as A6 and A7 as well as D20 & D21?  The Uno itself wouldn't be able to take advantage of this change, but it would sure help those of us using this as a base for custom designs.  I could use the extra inputs!

Coding Badly

Quote
What would it take to modify the IDE code to recognize and use those pins as A6 and A7 as well as D20 & D21?


Is that a rhetorical question or do you truly want help modifying the core?

fat16lib

#2
Dec 22, 2011, 03:28 pm Last Edit: Dec 22, 2011, 03:44 pm by fat16lib Reason: 1
In Arduino 1.0 it looks like analog pins 6, 7 are supported.  There is a "eightanaloginputs" variant defined but all it does is set NUM_ANALOG_INPUTS.   NUM_ANALOG_INPUTS only seems to be for users to know if A6 and A7 exist.  It is not used in the core.

Here is pins_arduino.h for the "eightanaloginputs" varient:
Code: [Select]
#include "../standard/pins_arduino.h"
#undef NUM_ANALOG_INPUTS
#define NUM_ANALOG_INPUTS           8


The core code in wiring_analog.c seems to support A6 and A7.

It appears that analogRead may already work on pins A6, A7 for the SMD Uno.  analogRead does load the ADC registers with the correct values for A6 and A7 in analogRead.

A6 and A7 can't be used as digital pins since that is not supported on the 32 pin 328 MLF part.

CrossRoads

A6 & A7 only do analog inputs. If you want to use as digital, you must do analog read, and then make decision to treat ther result as low (<=0.3VCC Max if Vcc >2.4V, see Note 1) or high (>=0.6VCC Min if Vcc>2.4V, see Note 2)
1. "Max" means the highest value where the pin is guaranteed to be read as low
2. "Min." means the lowest value where the pin is guaranteed to be read as high

So with Vcc = 5V, a low would be 0 to 1.5V, and a high would be 3 to 5V.
>1.5 and <3 would floating, in transistion, unknown.

With Aref at 5V, 1.5V/4.88mV/bit = a reading of ~307,
and 3V/4.88mV/bit = a reading of ~614.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Go Up