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

void main(void)
{
    unsigned char counter = 0;
    unsigned char dirChanged = 0;
    
    DDRA = 0xFF;    
                  
    while(1)
    {   
        if(dirChanged == 0)
        {
            PORTA = 1 << (7 - counter);
        }
        else
        {
            PORTA = 1 << counter;
        }        
        
        counter++;
        if(counter >= 8)
        {      
            dirChanged = !dirChanged;
            counter = 1;
        }
        
        delay_ms(100);
    }
}
   