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

void main(void)
{       
    unsigned char counter = 0;    
    unsigned char blinkCnt = 0;  
    unsigned char inc = 0;

    // Input 
    DDRC = ~((1 << 3) | (1 << 0));
    // Pullup  
    PORTC |= ((1 << 3) | (1 << 0));   
    
    DDRA = 0xFF;   
    
    
    while(1)
    {    
        // Enter              
        if(PINC.3 == 0)
        {
            while(PINC.3 == 0)
            {                 
                // do nothing
            }   
                 
            for(blinkCnt = 0; blinkCnt < inc; blinkCnt++)
            {   
                PORTA = 0xFF;
                delay_ms(500);
                PORTA = 0x00;
                delay_ms(500);    
            }   
            inc = 0;                                      
        }  
                
        // Inc
        if(PINC.0 == 0)
        {             
            while(PINC.0 == 0)
            {
            }     
                         
            inc++; 
            PORTA = inc;
        }
                      
    }
}
   