CurrentDate.year2 = 0;
CurrentDate.year1++;
}
else
CurrentDate.year2++;
}
else
CurrentDate.year3++;
}
else
CurrentDate.year4++;
}
else if(CurrentDate.monthl == 9)
{
CurrentDate.monthl = 0;
CurrentDate.monthh++;
}
else
CurrentDate.monthl++;
}
else if(CurrentDate.dayl == 9)
{
CurrentDate.dayl=0;
CurrentDate.dayh++;
}
else
CurrentDate.dayl++;
}
else
CurrentTime.hourl++;
}
else
CurrentTime.minuteh++;
}
else
CurrentTime.minutel++;
}
else
CurrentTime.secondh++;
}
else
CurrentTime.secondl++;
if ((Alarm1Alarm == false) & (Alarm2Alarm == false))
{
led = 0;
CCP1CON = PWM_off;
}
else
{
if (led == 1)
{
led = 0;
PR2 = PWM_period; // set pwm period
CCPR1L = PWM_DC; // set pwm duty cycle
//CCP1CON = PWM_on;
}
else
{
led = 1;
PR2 = PWM_period/2; // set pwm period
CCPR1L = PWM_DC/2; // set pwm duty cycle
//CCP1CON = PWM_off;
}
}
Alarm1Cnt++;
Alarm2Cnt++;
if (BackLightEn == 0)
if (((BackLightTimer++)>=60) & (Alarm1Alarm == false) & (Alarm1Alarm == false))
BackLightEn = 1; // dISAble backlight
PORTC = PORTC_MAP;
//TMR1IF = 0;
//PIR1 = PIR2 = 0x00;
CCP2IF = 0;
}
// -------------------------------------------------------
unsigned char get_key(void)
{
unsigned char key_in,tmp;
TRISC = 0x03;
KeyLine = 0xf0;
PORTC = KeyLine | PORTC_MAP;
#asm
nop
nop
nop
#endasm
if ((PORTA & 0x0f) != 0)
{
tmp = 0x10;
for (KeyLine = tmp;KeyLine!=0;KeyLine = tmp)
{
PORTC = KeyLine | PORTC_MAP;
tmp = KeyLine <<1;
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] 下一页
本文关键字:程序 C语言 PIC单片机,单片机-工控设备 - PIC单片机