Program runs only one time

Thread Starter

krkarkarkmak678

Joined Mar 13, 2023
7
I want to know how to make this program run more than one time, I've been tryng using "for" and while but it didn't work. This is the program normal program:
C-like:
void main(void) {

    TRISD = 0;

    PORTD = 0;   

    while(1) {     

        PORTD = 0b00000001

        while(!RD5){

            PORTD = PORTD << 1;

            __delay_ms(100);

        }

        __delay_ms(500);

        while(!RB0){

            PORTD = PORTD >> 1;

            __delay_ms(100);

        }

    }

    return;

}
 
Last edited by a moderator:

JohnInTX

Joined Jun 26, 2012
4,787
A lot of things but line 21 should reference RD0, not RB0. It's going to shift the bit past bit 0 and then PORTD will always be 00000000.
 
Top