Go Down

Topic: How to change pin mapping in Arduino Mega? (Read 2046 times) previous topic - next topic

waterhue

I'm working on an "arduino Mega compatible" board (ATmega1280), and I want to access portF  as general I/O. This way I can use standard pinMode() , digitalWrite() and digitalRead() functions to operate them. But portF is not assigned with pin numbers. Can anyone give me a hint how to do this?

Thanks!!

cr0sh

Don't know anything about the Mega, but this thread may help:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1245229578
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

retrolefty

From the above link, here is the useful chart (linked below) that shows you can use analog input pins A0-A15 in digital mode by referencing them as pins 54-69.  So therefore Port F (bits 0-7) can be referenced as A0-A7 (for analog inputs) or digital pins 54-61 (as digital I/O).

http://spreadsheets.google.com/pub?key=rtHw_R6eVL140KS9_G8GPkA&gid=0

Lefty


waterhue

Thanks for the links.
Does it mean that a port which is not assigned with any number cannot be access from arduino environment? For example how to use Port J as general I/O? There is no pin mapping for PJ2~PJ7.

Thanks!!

TchnclFl

There's a way to do what's called "Direct Port manipulation".

I've seen it done, but I've no idea how ;D.

retrolefty

#5
Feb 17, 2010, 03:36 am Last Edit: Feb 17, 2010, 03:37 am by retrolefty Reason: 1
Quote
There is no pin mapping for PJ2~PJ7.


Actually there are 16 pins not mapped for the Arduino Mega board. Not only are they not mapped, there is no wiring traces from the processor chip to any connector. The Seeeduino mega board does wire these 16 'extra' pins to an additional connector, but because the Arduino core software does not map these pins one has to use direct port access commands to mode/read/write to these pins. These 'unreachable' pins on the Arduino Mega board are:

pe2,pe6,pe7,pg3,pg4,pd6,pd5,pd4,pj7.pj6,pj5,pj4,pj3,pj2,ph7,ph2.

Direct port commands are explaned here:
http://www.arduino.cc/en/Reference/PortManipulation

Lefty

waterhue

Thank you all for the help! Now I can access any port on 1280, just as using assembler from atmel... ;)

Go Up