各位好:我用的是GZ60,外部晶振8M;但是老在中断里面出不来,老是产生中断;请帮忙看一下CONFIG的设置对吗? 这样设置总线频率是多少啊? void MCU_init(void)
{ [color=#FF1493]CONFIG1 = 0x39; // COPRS LVISTOP LVIRSTD LVIPWRD LVI5OR3 SSREC STOP COPD
CONFIG2 = 0x48; //这里设置对吗? 0 MCLKSEL MCLK1 MCLK0 MSCANEN TBMCLKSEL OSCENINSTOP SCIBDSRC
PCTL_PLLON =0;
ports_init(); EnableInterrupts;
}
void ports_init(void)
{ DDRE_DDRE3 = 1; DDRE_DDRE2 = 1; DDRE_DDRE4 = 1; DDRE_DDRE5 = 1;
}
void Timer_init(void)
{ T1SC = 0x75; T1MOD = 30; T1SC_TSTOP = 0;
}
interrupt void T1TOF(void)
{
temp = T1SC; T1SC = (T1SC&0x7f); if(flag ==1) PTE_PTE2 = !PTE_PTE2; else PTE_PTE3 = !PTE_PTE3;
}
void main(void) { unsigned char data=0xaa; unsigned char j; MCU_init();
while(1) { Timer_init(); data=0xaa; for(j=0;j<8;j++) { if((data&0x80)==0x80) flag =1; else flag = 0;
data = (data<<1); while((T1SC&0x80)==0); //这里对吗? } }
} [此贴子已经被作者于2007-8-10 11:10:11编辑过] [此贴子已经被作者于2007-8-10 11:11:08编辑过]
[此贴子已经被作者于2007-8-11 15:45:42编辑过] |