Why is this code not working? So I am trying to use Port Manipulation to turn on LEDS but I need to use PORT Manipulations for specific reasons. 

//22-29PORTA (0x01-0x80)
//30-37PORTC (0x80-0x01)
//38-45PORTD (0x80-0x01)

void setup(){
PORTA =  B0000000; //29---&gt;22
PORTC =  B0000000; //37---&gt;30
PORTD =  B0000000; //45---&gt;38
}

void loop(){
 PORTA =  B1000100;
 PORTC =  B0101000;
 PORTD =  B0000010;
 delay(1000);

 PORTA =  B1010000;
 PORTC =  B0001010;
 PORTD =  B0100000;
 delay(1000);

 PORTA =  B0010100;
 PORTC =  B0100010;
 PORTD =  B0001000;
 delay(1000);             



}```
Heres the code for Arduino Mega 2560
You need to set the ports to output first, before you can use them.

To do that you use the DDRx (Data Direction) registers.  Your code should look like:

//22-29PORTA (0x01-0x80)
//30-37PORTC (0x80-0x01)
//38-45PORTD (0x80-0x01)

void setup(){
    // Set the pins all to output
    DDRA = 0xFF;
    DDRC = 0xFF;
    DDRD = 0xFF;

    PORTA =  B0000000; //29---&gt;22
    PORTC =  B0000000; //37---&gt;30
    PORTD =  B0000000; //45---&gt;38
}

void loop(){
    PORTA =  B1000100;
    PORTC =  B0101000;
    PORTD =  B0000010;
    delay(1000);

    PORTA =  B1010000;
    PORTC =  B0001010;
    PORTD =  B0100000;
    delay(1000);

    PORTA =  B0010100;
    PORTC =  B0100010;
    PORTD =  B0001000;
    delay(1000);             
}


You can read more about direct port manipulation here.