#include #include #include #include unsigned char PROGMEM displayCodes[10] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x00,0x09}; volatile char g_start_stop; volatile char g_direction; int main(void) { DDRB = 0xff; //set the direction to be output PORTB = __LPM((int)&displayCodes+8); // load the code needed to display an 8 from program memory while(1) { /* // code for debouncing button if(g_start_stop == 0xff) // value is 1 else if(g_start_stop == 0x00) // value is 0 else // value should remain unchanged from the last value if(g_direction == 0xff) // value is 1 else if(g_direction == 0x00) // value is 0 else // value should remain unchanged from the last value */ } return 0; } SIGNAL(SIG_OUTPUT_COMPARE0) { g_start_stop = (g_start_stop << 1) | (((PIND & (1 << PIND4)) >> PIND4) & 0x1); g_direction = (g_direction << 1) | (((PIND & (1 << PIND5)) >> PIND5) & 0x1); }