seeeduino mega : 16 extra digital i/o

Arduino, Seeeduino Serials and mutants. Share your problems and experence on arduino compatible board such as seeeduino/stalker, etc.

Moderators: lily.li, violet, salmanfarisvp

stevecooley
Pre-kindergarten
Pre-kindergarten
Posts: 4
Joined: Thu Aug 06, 2009 4:48 am

seeeduino mega : 16 extra digital i/o

Post by stevecooley » Thu Aug 06, 2009 5:06 am

Hey there, some questions for you:

1. the seeeduino mega page says that you have 16 extra digital i/o pins versus the arduino mega. So can I use all 70 digital i/o pins and all 16 analog in pins at the same time? I'm asking because 70 is exactly 16 more than 54, and there are 16 analog pins on the mega... and it's not well known that you can use analog pins as digital pins on the arduino. My personal experience has been inconclusive on the arduino mega on this topic because there just isn't a whole lot of documentation specific for the mega. I got some clues that I could use analog-in pins for digital, but the instructions I was given didn't really work, so I've been doing it the hard way of treating the analog like a digital and testing for higher analog values with button presses. It kind of sucks... it works, but.. it's not as easy as just using a digital pin for this digital signal.

2. If you can in fact use all 70 digital pins and 16 analog pins at the same time on the seeeduino mega, how do you address those additional pins in the arduino IDE?

3. Any clues why the arduino team didn't just publish all 70 digital pins on their board?

thanks, I'm very much looking forward to your responses because I'm working on a kick ass step sequencer (http://beatseqr.com), and I'm running up to the limit on the arduino mega already. I could definitely put those extra digital i/o's to work immediately!

leftyretro
Pre-kindergarten
Pre-kindergarten
Posts: 25
Joined: Tue Aug 04, 2009 12:01 pm

Re: seeeduino mega : 16 extra digital i/o

Post by leftyretro » Thu Aug 06, 2009 9:35 am

Hi Steve;

I've been testing out my new Seeeduino Mega sense it arrived earlier this week. I too was not real clear on the extra I/O pins Vs the Ardunio Mega. What I've come to understand is that Arduino mega digital pins 0 to 69 are the same as for the Seeduino and that digital pins 54-69 are the same pins as analog pins 0-15. The extra I/O pins that the Seeeduino Mega brings out are not mapped out with pin aliases in the Arduino core libraries. So the only way to access these additional I/O pins is via direct port access using direction ports and masks to set or reset or read the actual pins. The schematic that Seeeduino published in my other thread on the mega shows the port/bit number of the additional pins.

Bottom line, it's nice that the Seeeduino folks brought out those additional I/O pins, however the Arduino library does not support those pins directly using the standard digitalwrite/read functions.

At least that is my take on the topic to date.

Lefty

stevecooley
Pre-kindergarten
Pre-kindergarten
Posts: 4
Joined: Thu Aug 06, 2009 4:48 am

Re: seeeduino mega : 16 extra digital i/o

Post by stevecooley » Thu Aug 06, 2009 11:53 am

Ok, sounds tedious, but wouldn't it be possible to write a function to take out the tedium? I have no idea how to do what you just said, but it seems like if it's possible it should be possible to make it a bit more user friendly through a library extension, yeah?

leftyretro
Pre-kindergarten
Pre-kindergarten
Posts: 25
Joined: Tue Aug 04, 2009 12:01 pm

Re: seeeduino mega : 16 extra digital i/o

Post by leftyretro » Thu Aug 06, 2009 2:30 pm

I guess you could write a conversion function that would convert new higher digital pin numbers and mimic what the arduino digitalwrite() and digitalread() functions due. You could call them extendedwrite() and extendedread() :lol:

Anyway below is a write up from the Arduino site on how direct port access works to give you an idea of what is involved. I'm more of a hardware guy then software so I can't just whip you out the functions ;)

It would be a pretty unusual application that would require the extra I/O pins I suspect, but it's nice to know they are available. I decided not to solder header connectors to those extra pins at this time.

http://www.arduino.cc/en/Reference/PortManipulation

Lefty

User avatar
Albert.Miao
Elementary-2
Elementary-2
Posts: 250
Joined: Sun Nov 23, 2008 9:23 am

Re: seeeduino mega : 16 extra digital i/o

Post by Albert.Miao » Thu Aug 06, 2009 6:50 pm

Hello,
Can use the GPIO register to config the extern 16 IOs at this moment.
And we may modify the internal file(Pin_arduino.c) to match the IOs, if possible.
PH2 -->70;
PH7 -->71;
.
.
.
PE2 -->85.
Thanks
Albert

stevecooley
Pre-kindergarten
Pre-kindergarten
Posts: 4
Joined: Thu Aug 06, 2009 4:48 am

Re: seeeduino mega : 16 extra digital i/o

Post by stevecooley » Fri Aug 07, 2009 2:38 am

Can someone from seeedstudio post some example code for how I could read and write to these extra GPIO pins? This will absolutely decide it for me and I'll order up a seeeduino mega immediately after. My project is super hungry for more i/o :) http://www.flickr.com/photos/stevecoole ... 64cfbc.jpg[/img]

stevecooley
Pre-kindergarten
Pre-kindergarten
Posts: 4
Joined: Thu Aug 06, 2009 4:48 am

Re: seeeduino mega : 16 extra digital i/o

Post by stevecooley » Fri Aug 07, 2009 2:40 am

i should say "I will order one mega immediately and can require them for my project when I start selling them."

leftyretro
Pre-kindergarten
Pre-kindergarten
Posts: 25
Joined: Tue Aug 04, 2009 12:01 pm

Re: seeeduino mega : 16 extra digital i/o

Post by leftyretro » Sat Aug 08, 2009 5:54 am

Steve;

Here is a simple example of turning on and off the first and last I/O bits of the extended bits that the Seeeduino Mega makes avalible.

Code: Select all

/*
 * Toggle extended I/O bits 70 and 86 on and off for Seeeduino Mega board
 *
 * Also added an example of a digital input reading the state of digital pin 71
*/

int switchstate;               // variable to hold value of digital input pin 70

void setup()                    // run once, when the sketch starts
{

  DDRH |= 0x04;                 // sets the digital pin 70 to output, pin 70 is bit 2 of port H
  DDRE |= 0x04;                 // sets the digital pin 86 to output, pin 86 is bit 2 of port E

  DDRH &= 0x7f;                 // sets the digital pin 71 to input, pin 71 is bit 7 of port H
}

void loop()                     // run over and over again
{

  PORTH |= 0x04;                // sets pin 70 high
  PORTE |= 0x04;                // sets pin 86 high
  delay(1000);                  // waits for a second

  PORTH &= 0xfb;                // sets pin 70 low
  PORTE &= 0xfb;                // sets pin 86 low
  delay(1000);                  // waits for a second

  switchstate = PINH & 0x80;   // switchstate is non zero if digital input 71 is high, else it's zero if input 71 is low
}
Lefty

scott_goff
Pre-kindergarten
Pre-kindergarten
Posts: 2
Joined: Wed Sep 02, 2009 10:40 pm

Re: seeeduino mega : 16 extra digital i/o

Post by scott_goff » Wed Sep 02, 2009 11:08 pm

I was researching the Arduino Mega while searching for a microcontroller board on which I'd like to base a project, and came upon the Seeeduino Mega. Then I got all excited because of the extra digital ports without any futzing about with matrices or multiplexing. Then I saw this thread. Hopefully someone can answer some questions I have re: the Seeduino Mega's extra digital ins and outs.

So, this is what I have gotten out of this discussion:

1: The Seeeduino Mega has 16 extra digi i/o pins, but these pins are difficult to use, and surely won't be supported by the stantard Firmata sketch (which isn't functional for the normal Arduino Mega, anyhow, according to info on the Arduino forum).

2: These extra 16 digi i/o's *cannot* be used simultaneously with the 16 analog pins that they share traces/microcontroller pins with. Or can they?

3: The standard Arduino Mega may be able to do the same thing as the Seeeduino Mega and produce 16 more usable digital i/o's; it would just require a firmware revision and some extra off-board wiring? Or is there more work which would have to be done to access these pins? ...Or is this completely impossible on the original Mega? The way the posts above are worded, it seems the analog pins 0-15 share circuit board traces with the digital pins 54-69. which means that those digital pins are just duplicates, as you would get from stacked headers sprouting off of a shield on an Arduino. This theory would further confirm my suspicion that you can't use the extra 16 digital pins at the same time as the analog pins.

So anyhow, could someone with experience confirm or deny any of this? I really want to purchase a Seeeduino to base a prototype of a production piece off of, but I can't until I have this stuff figured out.

Cheers,
Scott

leftyretro
Pre-kindergarten
Pre-kindergarten
Posts: 25
Joined: Tue Aug 04, 2009 12:01 pm

Re: seeeduino mega : 16 extra digital i/o

Post by leftyretro » Thu Sep 03, 2009 10:47 pm

1: The Seeeduino Mega has 16 extra digi i/o pins, but these pins are difficult to use, and surely won't be supported by the stantard Firmata sketch (which isn't functional for the normal Arduino Mega, anyhow, according to info on the Arduino forum).

Note familure with Firmata, but the 16 extra digital pins are not really difficult to use, just that you can't use the built in Arduino pin numbering when doing digital reads, digital writes, and pinMode those extra pins. You have to utilize direct port statements as shown in my example above.

2: These extra 16 digi i/o's *cannot* be used simultaneously with the 16 analog pins that they share traces/microcontroller pins with. Or can they?

Not True, the extra 16 digital pins are just digital pins. The sixteen analog pins, A0 to A15 are ALSO avalible as digital I/O pins by referencing them as digital pins 54 to 69. These analog/digital pins can be used with the standard Arduino digital pin commands as either analog using pin numbers 0-15 or digital using pin numbers 54-69 by either the Arduino or Seeeduino mega boards.

3: The standard Arduino Mega may be able to do the same thing as the Seeeduino Mega and produce 16 more usable digital i/o's; it would just require a firmware revision and some extra off-board wiring? Or is there more work which would have to be done to access these pins?

Those pins are not avalible on the Arduino Mega because they didn't run printed circuit board traces from the Mega1280 chip to any connector, they are just left unconnected on the Arduino Mega, so physically unavalible on the Arduino Mega for hardware reasons, no firmware or software changes can fix that. IF the Arduino mega had run the extra 16 traces AND they had updated the pin mapping software, those 16 'extra' pins would be nameed pins 70 to 85. But they didn't so those 16 can only be accessed by using direct port statements in oyur sketch.

Or is this completely impossible on the original Mega?

Yes, impossible.

The way the posts above are worded, it seems the analog pins 0-15 share circuit board traces with the digital pins 54-69.
Yes, A0-A15 and digtal pins 54 to 69 are the same physicall I/O pins on the processor. But these are NOT the same as the 'extra' 16 digital I/O pins that the Seeeduino Mega wired up.

which means that those digital pins are just duplicates, as you would get from stacked headers sprouting off of a shield on an Arduino. This theory would further confirm my suspicion that you can't use the extra 16 digital pins at the same time as the analog pins.
No you are confusing different pins. We are actualy talking about 32 different I/O pins, 16 are digital only pins that only the Seeeduino has wired out to connectors that the Arduino software can't utilize via standard Arduino pins commands, but can be acessed via direct port statements. The 16 analog pins can be utilized as digital pins by either the Arduino or Seeeduino meaga boards by using shotware pin numbers 54 to 69.

So anyhow, could someone with experience confirm or deny any of this? I really want to purchase a Seeeduino to base a prototype of a production piece off of, but I can't until I have this stuff figured out.
Bottom line on I/O pins, the AVR mega1280 processor has 70 total I/O pins avalible. The Arduino mega only wired up 54 of these pins, 38 digital only and 16 analog/digital pins. The Seeeduino mega wired all 70 I/O pins, so there are 54 digital only pins and 16 analog/digital pins.
I like the Seeduino design and extra features better then the standard Arduino Mega, but that's just my opinion.

Lefty

Post Reply