Pages: [1]   Go Down
Author Topic: How to change pin mapping in Arduino Mega?  (Read 1505 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 36
Posts: 5519
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1245229578
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16540
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

B0100111001000011, USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1503
I'm confused.  Wait, maybe not..
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16540
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: February 16, 2010, 09:37:51 pm by retrolefty » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you all for the help! Now I can access any port on 1280, just as using assembler from atmel... smiley-wink
Logged

Pages: [1]   Go Up
Jump to: