Using adc6 and adc7

I am currently designing a pcb where I intend to use the two analogue inputs adc6 and adc7.

I am planning to use the arduino ide to develop the code, but although I have searched high and low, I cannot find any instances where people have used these inputs.

There are several questions about configuring it and lots of "answers", although many of these show the people "answering " clearly haven't understood the question.

Unfortunately not one of the current threads actually indicates a working solution.

Obviously I can't use an arduino to test it as they are designed around the atmega328 28dip chip. I don't really want to develop the pcb around using these two inputs if there isn't any way of configuring these two analogue inputs within the ide.

Has anyone actually used adc6 and adc7, and if so, how did you configure it via the arduine ide?

Thanks 8n advance

You don't trust the data sheet and schematics? The Nano does have them, you could experiment with that. If you're wondering about code, just compile for a Nano, only "verify", no upload. There are few posts because the UNO doesn't expose them to board pins, and because it's a non-issue because it simply works. Most people find enough utility in A0-A5 and so just don't need to play with A6-A7.

I trust the dataset and schematic obviously, however wasn't aware that they were available on the nano, if they are i will bootload the chips as a nano, but more importantly this means they will already be addressable.

Looking back on previous questions in this regard it appears that the addressing was the issue, the ide allowed you to address a0-a5, but a6 & 7 were not available and all the questions were around trying to address them, not the wiring which is obvious.

Thanks

I just tried this in IDE 1.8.12, with Nano selected as a board:

unsigned int analog6;
unsigned int analog7;


void setup() {
  // put your setup code here, to run once:
}


void loop() {
  // put your main code here, to run repeatedly:
analog6 = analogRead (A6);
analog7 = analogRead (A7);
}

Compiled without errors.

Sketch uses 492 bytes (1%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

If you look in boards.txt, you will see the Nano has

nano.build.variant=eightanaloginputs

while the Uno has

uno.build.variant=standard

Hmm, the same code compiles ok on an Uno as well. So maybe there is some other issue.

A6 and A7 should be usable on an UNO as far as compiling the code is concerned, and the chip actually has the hardware, but the package lacks the pins to bring them out. Occasionally you will see code for an UNO doing an analogRead() on those pins as part of generating a semi-random number for randomSeed().

Do not use the Nano bootloader, the Nano currently uses the same bootloader as the UNO (optiboot), but wastes an additional 1.5K of flash memory as a holdover from the old Nano bootloader.

1 Like

OK, I have ordered a nano in order to test it before I finalise the pcb, I want to check it actually works as just because it compiles doesn't mean it will actually work, although if it is available in the nano there should be a way.

Which version of the IDE are you using? Its possible the older versions did not allow A6 and A7 on the UNO, but at least the last several versions have. I also do not understand what you mean by configuring those ports. The only operation allowed is an analogRead, digitalRead and digitalWrite are not applicable, and there would be no need for pinMode either.

juilegn:
OK, I have ordered a nano in order to test it before I finalise the pcb, I want to check it actually works as just because it compiles doesn't mean it will actually work, although if it is available in the nano there should be a way.

Great plan. Everyone should have a working prototype before committing to PCB production. Some people can do it, but only because of lengthy and broad experience. Sometimes it's not feasible, then you have a rework job for each unit until you can correct the mistakes in the next revision.

By configure i mean

Int mysensormeasurementpin = A6

As I previously said, I didn't know the nano had these pins, and understood that the ide only recognised up to A5 hence how do you access/configure the two additional inputs.

There is no way I can realistically produce the complete circuit ahead of pcb production, so many of the devices are smd only, some have dil counterparts which is fine but don't really need pre-building, so I only check the dubious aspects, being able to access these two inputs is one such part.