How do I can use PIN PD6 in custom ATMEGA2560 Board

Hi

I design custom Atmega2560 board and I need access pin PD6.

Thank you

Use direct port access via PORTD, PIND, DDRD and _BV(PD6).

You might like MegaCore:

It defines Arduino pin numbers for all the IO pins on the ATmega2560:

It also uses optiboot, which frees up 7 kB of flash memory without any downsides. True, flash memory is not often in shortage on the ATmega2560, but it never hurts to have an extra 7 kB to play with!

Thanks, I have tried all but not working

pin 24, 40,PIN_PD6,DDRD = B11111111; PORTD = B11111111; non works

void setup() {
// put your setup code here, to run once:
// Serial1.begin(115200);
// Serial1.println("Test");
portMode(24,OUTPUT);
portWrite(24,HIGH);
}

void loop() {
// put your main code here, to run repeatedly:
portWrite(24,HIGH);
}

I build custom ATmega2560 board with no crystal and I want use Megacore to program it but nothing happen after successful program
All I want to do turn on LED on port PD6(or any other pin), which I have tried pin 79, PIN_PD6,PORTD = B11111111; and not working

I have upload bootloader using megacode below: (First try with internal clock)

// make atmega2560 AVR_FREQ=8000000L BAUD_RATE=115200 UART=0 LED=B7 LED_START_FLASHES=2 -BIGBOOT


void setup() {
  // put your setup code here, to run once:
//  Serial1.begin(115200);
//  Serial1.println("Test");
portMode(40,OUTPUT);
portWrite(PIN_PD6,HIGH);
}


void loop() {
  // put your main code here, to run repeatedly:
portWrite(PIN_PD6,HIGH);
}

Topics merged

Why did you start a second one ?

This is different questions one was related how to access PD6 the other one is how to use MEGA core, since every time I put UART in bootloader nothing happen but when I select No bootloader it works

Problem Solved Thanks

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.