int main(void) { __asm__("SEI"); MCUCR |= (1<<0);//make it on change GICR |= (1<<6); // PIE for INT0 DIO_u8WritePinDir(26,DIO_u8INPUT); DIO_u8WritePinDir(8,DIO_u8OUTPUT); DIO_u8WritePinDir(9,DIO_u8OUTPUT); while (1) { DIO_u8WritePinVal(8,LEDFlag); DIO_u8WritePinVal(9,DIO_u8HIGH); voidDELAY_MS(1000); DIO_u8WritePinVal(9,DIO_u8LOW); voidDELAY_MS(1000); } return 0; }
int main(void) { u8 Local_u8Row; u16 Local_u8Counter = 0; DIO_voidInit(); // For Testing, Turn on all Leds HC595_u8WriteByte(RAWS, DIO_u8PORTHIGH);/*All ROWS are ON*/ HC595_u8WriteByte(COLUMNS, DIO_u8PORTLOW); /*All Columns are Off*/ voidDELAY_MS(1000); // Delay 1 Sec // Turn off all Leds HC595_u8WriteByte(RAWS, DIO_u8PORTLOW); /*All ROWS are Off*/ HC595_u8WriteByte(COLUMNS, DIO_u8PORTLOW); /*All Columns are Off*/ voidDELAY_MS(1000); //Delay 1 Sec while (1) { for (Local_u8Row = 0; Local_u8Row < 8; Local_u8Row++) { HC595_u8WriteByte(RAWS, DIO_u8PORTLOW); //turn off all Rows HC595_u8WriteByte(COLUMNS, ~MyName[(Local_u8Counter/800)%6][Local_u8Row]); // assign the specific row's data to the corresponded columns HC595_u8WriteByte(RAWS, (1<<Local_u8Row)); //Turn on the specific Row } Local_u8Counter++; // increment the counter } return 0; }