lcd_write_data(’:’);
lcd_write_data(CurrentTime.minuteh + ’0’);
lcd_write_data(CurrentTime.minutel + ’0’);
lcd_write_data(’:’);
lcd_write_data(CurrentTime.secondh + ’0’);
lcd_write_data(CurrentTime.secondl + ’0’);
lcd_write_inst(lcd_addr | 0x80); // resume cursor location
}
if (CurrentMode == mode_time)
{ // refresh date display
lcd_addr = lcd_read_addr() & 0x7f; // save cursor location
lcd_write_inst(0xc0 + 3); // set LCD line2
lcd_write_data(CurrentDate.year1 + ’0’);
lcd_write_data(CurrentDate.year2 + ’0’);
lcd_write_data(CurrentDate.year3 + ’0’);
lcd_write_data(CurrentDate.year4 + ’0’);
lcd_write_data(’/’);
lcd_write_data(CurrentDate.monthh + ’0’);
lcd_write_data(CurrentDate.monthl + ’0’);
lcd_write_data(’/’);
lcd_write_data(CurrentDate.dayh + ’0’);
lcd_write_data(CurrentDate.dayl + ’0’);
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;
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] 下一页
本文关键字:程序 C语言 PIC单片机,单片机-工控设备 - PIC单片机