NIOS IO口边沿中断的问题

[复制链接]
2633|3
 楼主| wangjun403 发表于 2011-10-15 16:55 | 显示全部楼层 |阅读模式
SOPC里已经正确设置

  1. #include "system.h"
  2. #include "altera_avalon_pio_regs.h"
  3. #include "alt_types.h"
  4. #include <stdio.h>
  5. #include <sys/alt_irq.h>
  6. #define mLED_OUT_BASE           LED_OUT_BASE
  7. #define mINPUTSIGNAL_BASE       INPUTSIGNAL_BASE

  8. int main (void) __attribute__ ((weak, alias ("alt_main")));
  9. void        Initialize();
  10. void        Ext_interrupts(void* context, alt_u32 id);

  11. volatile alt_u32    flag = 0;
  12. void alt_main (void)
  13. {
  14. //   void        *context;
  15.    
  16. //   alt_irq_register(INPUTSIGNAL_IRQ,context,Ext_interrupts);               //注册中断函数
  17.    
  18.     Initialize();
  19.    
  20.     while(1)
  21.     {
  22.         
  23.         if(flag == 1)
  24.         {
  25.               ……;
  26.         }
  27.     }
  28.    
  29. }
  30. void Initialize()
  31. {
  32.     IOWR_ALTERA_AVALON_PIO_IRQ_MASK(mINPUTSIGNAL_BASE, 0x01);               //允许IO中断
  33.     IOWR_ALTERA_AVALON_PIO_EDGE_CAP(mINPUTSIGNAL_BASE, 0x00);               //清中断捕获寄存器
  34.     alt_irq_register(INPUTSIGNAL_IRQ,NULL,Ext_interrupts);               //注册中断函数
  35. }


  36. void       Ext_interrupts(void* context, alt_u32 id)
  37. {
  38.     IOWR_ALTERA_AVALON_PIO_EDGE_CAP(mINPUTSIGNAL_BASE, 0x00);               //清中断捕获寄存器   
  39.     flag = 1;
  40. }


请帮我看下上面的代码有上面问题?为什么进不了中断函数?

非常急,麻烦各位了
lwq030736 发表于 2011-10-15 21:22 | 显示全部楼层
确定SOPC里的都配置对了吗
 楼主| wangjun403 发表于 2011-10-16 17:01 | 显示全部楼层
肯定对的
shuhao125 发表于 2011-11-2 16:33 | 显示全部楼层
头文件是不是要包含这个:#include "altera_avalon_timer_regs.h"
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:数学才不是浮云

0

主题

629

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部