#include<avr/io.h>
#include<util/delay.h>
int main(){
unsigned char number[] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x98};
unsigned char number_dot[] = {0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x18};
int location[] = {0B11111110, 0B11111101, 0B11111011, 0B11110111};
DDRA = 0xff;
DDRC = 0xff;
DDRF = 0xff;
int s=0, m=0, h=12, tm=0;
int s1,s10,m1,m10,h1,h10,tm1,tm10;
s1=s%10;
s10=s/10;
h1=h%10;
h10=h/10;
while(1){
if(PINF !=0){
switch(PINF){
case 1:
s++;
h=12;
while(1){
tm1=tm%10;
tm10=tm/10;
h1=h%10;
h10=h/10;
PORTA=number[h10]; PORTC=location[0]; _delay_ms(30);
PORTA=number_dot[h1]; PORTC=location[1]; _delay_ms(30);
PORTA=number[tm10]; PORTC=location[2]; _delay_ms(30);
PORTA=number[tm1]; PORTC=location[3]; _delay_ms(30);
tm++;
if(tm>59)
{
h++;
tm=0;
}
if(h>23)
{
h=0;
}
}////////////////////////////////////////////////////// while끝
case 2:
s++;
m=0;
while(1){
s1=s%10;
s10=s/10;
m1=m%10;
m10=m/10;
PORTA=number[m10]; PORTC=location[0]; _delay_ms(30);
PORTA=number_dot[m1]; PORTC=location[1]; _delay_ms(30);
PORTA=number[s10]; PORTC=location[2]; _delay_ms(30);
PORTA=number[s1]; PORTC=location[3]; _delay_ms(30);
s++;
if(s>59)
{
m++;
s=0;
}
}////////////////////////////////////////////////////// while끝
}////////////////////////////////////////////////////// switch끝
}////////////////////////////////////////////////////// if끝
}////////////////////////////////////////////////////// while끝
}// main끝