智能车制作
标题:
我的程序怎么也进 不了中断, 不知道怎么回事?
[打印本页]
作者:
yangjingwei128
时间:
2011-4-16 14:41
标题:
我的程序怎么也进 不了中断, 不知道怎么回事?
#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
#include <hidef.h> /* common defines and macros */
#include <MC9S12XS128.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12xs128"
void SetBusClock(void)
{
CLKSEL=0x00; //禁止PLL
PLLCTL_PLLON=1; //turn on PLL
SYNR=0X43;
REFDV=0X81; //pllclock=2*20M*(1+SYNR)/(1+REFDV)=80MHz;
POSTDIV=0X00; //总线=40M 总线时钟= pllclock/2
_asm(nop);
_asm(nop);
while(!(CRGFLG_LOCK==1)); //当PLL稳定,系统允许调用
CLKSEL_PLLSEL =1; //使能PLL;
}
void Dly_ms(int ms) //{
int i,j;
for(i=0;i<ms;i++)
for(j=0;j<0x7ff;j++);
}
void main(void) {
/* put your own code here */
EnableInterrupts;
SetBusClock();
DDRB_DDRB0=1;
DDRB_DDRB7=1;
PIEJ_PIEJ7=1; //中断使能
PPSJ_PPSJ7=0; //上升沿触发
for(;;)
{
PTS=0X00;
Dly_ms(500);
PTS=0XA0; }
// for(;;) {
// _FEED_COP(); /* feeds the dog */
// } /* loop forever */
/* please make sure that you never leave main */
}
#pragma CODE_SEG __NEAR_SEG NON_BANKED
void interrupt 24 PortJ7RisingInterrupt(void)
{
PIFJ_PIFJ7=1; //清除标记位
PTP=0X00;
}
复制代码
作者:
yangjingwei128
时间:
2011-4-16 14:41
回复
1#
yangjingwei128
请大侠们帮忙解决一下
作者:
yangjingwei128
时间:
2011-4-16 18:28
回复
1#
yangjingwei128
欢迎光临 智能车制作 (http://dns.znczz.com/)
Powered by Discuz! X3.2