|
大家好,我现在用79F8212遇到了一个问题:
void System_Init(void)
{
/********init cpu*********/
PCC = 0x00;
PPCC = 0x00; /*set CPU clock to fx 8M*/
LSRSTOP = 0; /*internal Low clock run*/
IF0 = 0x00;
MK0 = 0xFF;
LVIM = 0x00;
/*******init I/O port*****/
PM2 = 0b11111110;
PM3 = 0b11110100;
PM4 = 0b11011110;
PMC2 = 0b00001100;
PU2 = 0b00000000;
PU3 = 0b00000100;
PU4 = 0b00000000;
P2.0 = 0;
/******init TM000 ,interval time is 1ms*******/
TMIF000 = 0; //clear the interrupt flag
TMMK000 = 1; //disable the interrupt
TMC00 = 0; //stop the timer
CRC00 = 0; //CR000 used as compare register
CR000 = 500; //select the duty about 500*0.5us=250us
TOC00 = 0x0;
PRM00 = 0x01;
TMC00 = 0X0C;
INTM0 = 0B00000100; /*Both rising and falling edges 0B00000000; */
/*****initialize the Watchdog***************/
WDTM = 0x67; /*set watchdog OSC=Fx,maxtime=104.86ms*/
/*****initialize the variable***************/
PMK0 = 1;
PMK1 = 1;
TMMK000 = 0; /*enable the INTTM000 interrupt*/
}
void Stop_mode(void)
{
PMK0 = 0;
PMK1 = 0;
NOP();
NOP();
__asm("STOP");
NOP();
NOP();
NOP();
NOP();
PMK0 = 1;
PMK1 = 1;
初试话这样用的,主程序我也清看门狗了,第一次上电没按 按键,我设定的时间到就进入STOP模式,当我按下开关时候系统却是复位了,然后,设定的时间到了单片机复位,再一次设置的时间到才进入STOP模式,哪位大神帮我解答一下,不胜感激。 |
|