user60497: 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--->22
PORTC =  B0000000; //37--->30
PORTD =  B0000000; //45--->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


user4143: 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--->22
    PORTC =  B0000000; //37--->30
    PORTD =  B0000000; //45--->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.

60497: <p>So I am trying to use Port Manipulation to turn on LEDS but I need to use PORT Manipulations for specific reasons. </p>

<pre><code>//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
</code></pre>
 4143: <p>You need to set the ports to output first, before you can use them.</p>

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

<pre><code>//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);             
}
</code></pre>

<p>You can read more about direct port manipulation <a href="https://www.arduino.cc/en/Reference/PortManipulation" rel="nofollow noreferrer">here</a>.</p>
