/* showHOURS [2];// hours display character on LCD int

/* FInal ProjectCompe375817332354Alfonso Solis*/#include #define F_CPU 16000000#include #include #include #define    E   0 //assigning pin 0 on portD to be enable#define RS  2 //assigning pin 2 on PortD to RS(registerselection)void timer_scan(void);void timer_pwm(void);void SEND_A_COMMAND(unsigned char command);void SEND_A_CHARACTER(unsigned char character);void SEND_A_STRING(char *string_of_characters);ISR(TIMER1_COMPA_vect);static volatile int SECONDS =0; //making memory for storing secondsstatic volatile int MINUTES =0; //making memory for storing minutesstatic volatile int HOURS =0; //making memory for storing hoursint main(void){ DDRC = 0b11000000; //I need this to ensure only pin7 and pin8 of port C as output DDRD = 0xFF; _delay_ms(50);//giving delay of 50ms DDRB = 0xFF; //Taking portB as output. TCCR1B |=(1<0) { MINUTES–; //if second button is pressed and minute of TIME are //greater than zero, decrease minutes by one _delay_ms(220); } } if (bit_is_clear(PINC,2)) { if (HOURS<24) { HOURS++; //if third button is pressed and hours of TIME are less than 24, increment the hour by one } _delay_ms(220); if (HOURS==24) { HOURS=0;//if hour of TIME equal to 24, reset hour of TIME } } if (bit_is_clear(PINC,3)) { if (HOURS>0) { HOURS–;//if fourth button is pressed and hours of TIME are greater than ZERO, decrement the hour by one _delay_ms(220); } } } if (bit_is_clear(PINC,4))//if alarm adjust is set { if (bit_is_clear(PINC,0)) { if (alarmMINUTES<60) { alarmMINUTES++; _delay_ms(220); } if (alarmMINUTES==60) { if (alarmHOURS<24) { alarmHOURS++; } alarmMINUTES=0; _delay_ms(220); } } if (bit_is_clear(PINC,1)) { if (alarmMINUTES>0) { alarmMINUTES–; _delay_ms(220); } } if (bit_is_clear(PINC,2)) { if (alarmHOURS<24) { alarmHOURS++; } _delay_ms(220); if (alarmHOURS==24) { alarmHOURS=0; } } if (bit_is_clear(PINC,3)) { if (alarmHOURS>0) { alarmHOURS–; _delay_ms(220); } } } }}// Everything for TIMEISR(TIMER1_COMPA_vect) //loop to be executed on counter compare match{ if (SECONDS<60) { SECONDS++; } if (SECONDS==60) { if (MINUTES<60) { MINUTES++; } SECONDS=0; } if (MINUTES==60) { if (HOURS<24) { HOURS++; } MINUTES=0; } if (HOURS==24) { HOURS=0; }}void SEND_A_COMMAND(unsigned char command){ PORTD = command; PORTB &= ~(1< 0) { SEND_A_CHARACTER(*string_of_characters++); }}