智能车制作

标题: 我的程序怎么也进 不了中断, 不知道怎么回事? [打印本页]

作者: yangjingwei128    时间: 2011-4-16 14:41
标题: 我的程序怎么也进 不了中断, 不知道怎么回事?
  1. #include <hidef.h> /* common defines and macros */
  2. #include "derivative.h" /* derivative-specific definitions */

  3. #include <hidef.h> /* common defines and macros */
  4. #include <MC9S12XS128.h> /* derivative information */
  5. #pragma LINK_INFO DERIVATIVE "mc9s12xs128"

  6. void SetBusClock(void)
  7. {
  8. CLKSEL=0x00; //禁止PLL
  9. PLLCTL_PLLON=1; //turn on PLL
  10. SYNR=0X43;
  11. REFDV=0X81; //pllclock=2*20M*(1+SYNR)/(1+REFDV)=80MHz;
  12. POSTDIV=0X00; //总线=40M 总线时钟= pllclock/2
  13. _asm(nop);
  14. _asm(nop);
  15. while(!(CRGFLG_LOCK==1)); //当PLL稳定,系统允许调用
  16. CLKSEL_PLLSEL =1; //使能PLL;
  17. }

  18. void Dly_ms(int ms) //{
  19. int i,j;
  20. for(i=0;i<ms;i++)
  21. for(j=0;j<0x7ff;j++);
  22. }

  23. void main(void) {
  24. /* put your own code here */
  25. EnableInterrupts;
  26. SetBusClock();
  27. DDRB_DDRB0=1;
  28. DDRB_DDRB7=1;
  29. PIEJ_PIEJ7=1; //中断使能
  30. PPSJ_PPSJ7=0; //上升沿触发

  31. for(;;)
  32. {
  33. PTS=0X00;
  34. Dly_ms(500);
  35. PTS=0XA0; }

  36. // for(;;) {
  37. // _FEED_COP(); /* feeds the dog */
  38. // } /* loop forever */
  39. /* please make sure that you never leave main */
  40. }
  41. #pragma CODE_SEG __NEAR_SEG NON_BANKED
  42. void interrupt 24 PortJ7RisingInterrupt(void)
  43. {
  44. PIFJ_PIFJ7=1; //清除标记位
  45. PTP=0X00;

  46. }

复制代码

作者: yangjingwei128    时间: 2011-4-16 14:41
回复 1# yangjingwei128


    请大侠们帮忙解决一下
作者: yangjingwei128    时间: 2011-4-16 18:28
回复 1# yangjingwei128


   




欢迎光临 智能车制作 (http://111.231.132.190/) Powered by Discuz! X3.2