Pages: [1]   Go Down
Author Topic: IDE change - please add support for ADC6 and ADC7 ! (SMD Uno)  (Read 1279 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 176
Posts: 12286
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Edison Member
*
Karma: 44
Posts: 1482
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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.
« Last Edit: December 22, 2011, 09:44:43 am by fat16lib » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Pages: [1]   Go Up
Jump to: