智能车制作
标题:
输入捕捉为什么进不了中断``哪位帮忙看看```
[打印本页]
作者:
leaf19881122
时间:
2009-6-18 21:50
标题:
输入捕捉为什么进不了中断``哪位帮忙看看```
#include <hidef.h> /* common defines and macros */
#include <mc9s12dg128.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"
unsigned char Pulsecnt;
/************************pllclock=48MHz*******************************/
void SET_PLL(void)
{
CLKSEL=0X00; //disengage PLL to system
PLLCTL_PLLON=1; //turn on PLL
SYNR=2;
REFDV=1; //pllclock=2*osc*(1+SYNR)/(1+REFDV)=48MHz;
_asm(nop); //If PLL is selected (PLLSEL=1), Bus Clock = PLLCLK / 2=24MHz
while(CRGFLG_LOCK!=1)
_asm(nop); //when pll is steady ,then use it;
CLKSEL_PLLSEL =1; //engage PLL to system;
}
/***************************main()*********************************/
void main(void)
{
/* put your own code here */
SET_PLL();
DDRB=0x00;
PORTB=0xff;
asm sei;
TIOS=0x00;
TSCR1=0x80;
TSCR2=0x01;
TCTL4=0x01;
TIE=0x01;
TFLG1=0x01;
Pulsecnt=0x00;
asm cli;
for(;;) {} /* wait forever */
}
#pragma CODE_SEG NON_BANKED
void interrupt 8 IC0_ISR(void)
{
TFLG1=0x01;
Pulsecnt++;
if(Pulsecnt==255)
Pulsecnt=0;
for(;;) PORTB=0x00; //说明进入中断
}
一次中断都无法进入```
作者:
zhulin
时间:
2009-6-19 08:51
加上场中断
作者:
雪山飞狐
时间:
2009-8-10 15:38
for(;;)前面加上EnableInterrupts;就好了
作者:
海军10291147
时间:
2012-2-12 17:15
还是不行
欢迎光临 智能车制作 (http://111.231.132.190/)
Powered by Discuz! X3.2