#define sw1 PORTB.F0
#define Buzzer PORTC.F7
void main()
{
char segment[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d};
int i=0;
TRISC=0;
PORTC=segment[0];
while(1)
{
if(sw1==0)
{
Buzzer=1;
delay_ms(300);
i=i+1;
if(i>5)i=0;
PORTC=segment[i];
}
else if(i==5)Buzzer=1;
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น