void Sys_Init(void)
{
WDTCON = 0x10; //1--1 -- 00 ¿ªWDT,WDTÇå0,WDT 524.288msÒç³ö;ÉÕ¼ʱ£¬¿ÉCode OptionÑ¡ÔñENWDT
//TK¶ÔÓ¦µÄIOÉèÖÃΪǿÍÆÍìÊä³ö1
P0CON = 0xFF;
P0PH = 0xFF;
P1CON = 0x00;
P1PH = 0xFE;
P2CON = 0x00;
P2PH = 0xFF;
P5CON = 0xFF;
P5PH = 0xFF;
P0 = 0xFE;
P1 = 0xFF;
P2 = 0xFF;
P5 = 0x00;
EA = 1;
TimerInit();
void main(void)
{
Sys_Init();
//´¥¿Ø°´¼ü³õʼ»¯
TouchKeyInit();
LED1 = 0;
LED2 = 0;
LED3 = 0;
while(1)
{
WDTCON = 0x10;
if(TimerFlag_1ms == 1)
{
TimerFlag_1ms=0;
Timercount++;
if(Timercount>10)
{
Timercount=0;
Sys_Scan();
}
if(P10 == 1)
{ //按键程序
if(++R_u16KeyONCountTime > 3)
{
R_u16KeyONCountTime = 0;
if(bitKeyOnFlag == 0)
{
bitKeyOnFlag = 1;
}
}
}
else
{
bitKeyOnFlag = 0;
R_u16KeyONCountTime = 0;
}
}
}
}
如上程序,在打开TouchKeyInit();这个函数后,按键程序就运行不进去了,只有屏蔽了TouchKeyInit();后按键程序才能进去,是什么原因好奇怪?
|