您当前的位置:五五电子网电子知识单片机-工控设备PIC单片机用PIC16F877的c语言写的一个时闹钟程序(转贴) 正文
用PIC16F877的c语言写的一个时闹钟程序(转贴)

用PIC16F877的c语言写的一个时闹钟程序(转贴)

点击数:7643 次   录入时间:03-04 11:39:06   整理:http://www.55dianzi.com   PIC单片机
            lcd_write_inst(lcd_addr | 0x80);            //    resume cursor location
        }
        if (Alarm1Enable)
        {
            if  ((AlarmTime1.hourh == CurrentTime.hourh) & (AlarmTime1.hourl == CurrentTime.hourl)
                 & (AlarmTime1.minuteh == CurrentTime.minuteh) & (AlarmTime1.minutel == CurrentTime.minutel)
                 & (AlarmTime1.secondh == CurrentTime.secondh) & (AlarmTime1.secondl == CurrentTime.secondl))
             {
                 Alarm1Alarm = true;
                 CCP1CON = PWM_on;
                 BackLightEn = 0;
             }
            if (Alarm1Cnt > 120)    //    two minutes
            {
                Alarm1Alarm = false;
                Alarm1Cnt = 0;
                BackLightEn = 1;
                BackLightTimer = 0;
            }
        }
        else
        {
            Alarm1Alarm = false;
            Alarm1Cnt = 0;
        }
        if (Alarm2Enable)
        {
            if  ((AlarmTime2.hourh == CurrentTime.hourh) & (AlarmTime2.hourl == CurrentTime.hourl)
                 & (AlarmTime2.minuteh == CurrentTime.minuteh) & (AlarmTime2.minutel == CurrentTime.minutel)
                 & (AlarmTime2.secondh == CurrentTime.secondh) & (AlarmTime2.secondl == CurrentTime.secondl))
             {
                 Alarm2Alarm = true;
                 CCP1CON = PWM_on;
                 BackLightEn = 0;
             }
             if (Alarm2Cnt > 120)    //    two minutes
             {
                 Alarm2Alarm = false;
                 Alarm2Cnt = 0;
                 BackLightEn = 1;
                 BackLightTimer = 0;
             }
         }
        else
        {
            Alarm2Alarm = false;
            Alarm2Cnt = 0;
        }
    }
}


上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] 


本文关键字:程序  C语言  PIC单片机单片机-工控设备 - PIC单片机