#include <io.h>
#include <delay.h>

void main(void)
{   
    unsigned char counter = 0; 
    unsigned char stateChanged = 0;
    DDRA = 0xFF;
    
    while(1)
    {                  
        if(stateChanged == 0)
        {
            PORTA |= (1 << counter);
        }
        else
        {
            PORTA &= ~(1 << counter);
        }        
        
        counter++;
        if(counter >= 8)
        {              
            counter = 0; 
            stateChanged = !stateChanged;
        }
        
        delay_ms(500);
        
    }
}
   