Pages: [1]   Go Down
Author Topic: How to use PORTD,PORTB in Arduino ADK Mega  (Read 1587 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 Hello everybody
Code:
// Example 43.1
// tronixstuff.wordpress.com/tutorials > chapter 43
// John Boxall - October 2011
// Digital 0~7 set to outputs, then on/off using port manipulation
//http://tronixstuff.wordpress.com/2011/10/22/tutorial-arduino-port-manipulation/
void setup()
{
  DDRD = B11111111; // set PORTD (digital 7~0) to outputs
}

void loop()
{
  PORTD = B11110000; // digital 4~7 HIGH, digital 3~0 LOW
  delay(1000);
  PORTD = B00001111; // digital 4~7 LOW, digital 3~0 HIGH
  delay(1000);
}

This code run good with Arduino ATMega32 ,but can not run with Arduino ADK Mega
I don't know why ?
Can you help me ?
Thanks.
« Last Edit: November 06, 2012, 06:36:18 pm by taipscode » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello John,

Have you found a solution? I have a similar situation: For an Arduino UNO project I'm using the PIND variable. In the UNO PORTD maps to Arduino digital pins 0 to 7. PIND is a variable for the Port D Input Pins Register - read only. I need the same information for the Mega ADK board - what is the equivalent variable for the digital input pin register 0 - 7?

thanks,

andrew
Logged

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

Hello John,

Have you found a solution? I have a similar situation: For an Arduino UNO project I'm using the PIND variable. In the UNO PORTD maps to Arduino digital pins 0 to 7. PIND is a variable for the Port D Input Pins Register - read only. I need the same information for the Mega ADK board - what is the equivalent variable for the digital input pin register 0 - 7?

thanks,

andrew


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

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I have an Arduino ADK board. I'm trying to use a built-in variable to monitor the digital input pins. For example, on my Arduino UNO
PORTD maps to Arduino digital pins 0 to 7
PIND - The Port D Input Pins Register - read only

With the UNO I can use the PIND variable successfully to monitor activity on the pins 0-7. However, this is not working with the ADK board. Although the "PIND" variable is defined I don't know what it maps to and I cannot find the info. For the UNO, there is this web page:
http://www.arduino.cc/en/Reference/PortManipulation

However, the page doesn't include the ADK's ATmega2560. How can I find the correct variable to use (if there even is one)?
Thanks,
andrew
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 496
Posts: 19047
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

In any case, this is not an installation and troubleshooting issue.

Threads merged.

- Moderator
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Was this ever solved? I have the same problem and I can not find a solution.
Logged

Pages: [1]   Go Up
Jump to: