chipKIT® Development Platform

Inspired by Arduino™

Additional Analog and Digital I/Os

Created Wed, 06 Jul 2011 10:20:19 +0000 by settorezero


settorezero

Wed, 06 Jul 2011 10:20:19 +0000

If I want to use the additional I/Os (those numbered from 26 to 41) I can use code like this:

pinMode(39, OUTPUT);
digitalWrite(39, HIGH);

This code works (but it will compile for Arduino too. I think it would better that when you've an Arduino selected compiler must give an error).

But if I want to use additional Analog ports (those numbered from A6 to A11) this code doesn't work:

sensorValue = analogRead(A11);

It gives the error "A11 was not declared in this scope". On MPIDE is only possible to read Analog pins from A0 to A5. I think you must fix this issue


Trev

Wed, 06 Jul 2011 12:29:36 +0000

The digital issue is surely not an issue... does not the Arduino Mega go past pin 39 all the way up to 53?

The analog issue has already been fixed. See http://www.chipkit.org/forum/viewtopic.php?f=7&t=158&p=588&hilit=analogread#p588


settorezero

Wed, 06 Jul 2011 12:41:59 +0000

Ah ok for the digital pin. But the analog is not fixed, I've used the latest release of MPIDE available (mpide 0022 win 20110619) and is not possible to use extra analog pins.


settorezero

Wed, 06 Jul 2011 12:51:09 +0000

The issue of the topic you've linked is not the same I say. In that post they talk about using "0" instead of "A0", and this is fixed, ok. I'm talking about to use the extra analog pins (A6, A7, A8, A9, A10, A11)


dangeljs

Wed, 06 Jul 2011 15:31:30 +0000

If I put the number 6-11 it compiles for me. The pins A6-A11 appear to need to be declared in "WProgram.h" but I don't understand the numbering scheme and question if any of the analog pins will work if "A0" through "A5" are used with a chipKit model. When I added them to the list in the .h file, using arbitrary numbers, my program compiled so I guess that is where the fix should be. I guess it still needs to be modified with few #ifdef statements for the PIC32.


settorezero

Wed, 06 Jul 2011 15:57:58 +0000

AAaaaaaa! Ok Ok!! If I use "11" instead "A11" it works. The examples for arduino uses "A1", "A2" and so on. Because of this I used "A9", "A8" .... With "A" in front of number. Ok, thank you!!