isn

csharp Singapore
  • 13 years ago

    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?

     

     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“God could create the world in six days because he didn't have to make it compatible with the previous version.”