void alarm()
{
unsigned int x=0;
TR1=1; //turn on timer 1
for (x=0;x<1500;x++)
{
TH1 = 0xFC;
TL1 = 0x45;
while (TF1 == 0);
TF1 = 0;
LED=~LED;
buzzer=~buzzer; //buzzer cont to play
delay(30000);
if (PB1==0 || PB2==0 || PB3==0 || PB4==0 )
{
break;
}
}
buzzer=0;
}
void compare()
{
unsigned int x;
unsigned char alarm_menu[]="ALARM ACTIVATED";
if(alarm_switch==0xFF)
{
if(hour==alarm_hour&&min==alarm_min)
{
lcd_command(0x01);
lcd_command(0x02);
for (x=0;x<15;x++)
{
lcd_print(alarm_menu[x]);
}
alarm();
alarm_switch=0x00;
display_name();
}
}
}
my coding doesn't work. the LED does not light up and buzzer does not sound. ? is my coding correct, please help?
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).