关于AVR STUDIO的中断函数的写法(哎,知道的高手告诉我吧)
大家都知道avr的环境一般有 iccavravrstudio我从 iccavr过度到studio 中间总有些别扭的地方,就比如说 中断函数的写法问题。那到底avrstudio的各种avr芯片的中断函数怎么写才是正确的呢?被这个问题搞糊涂了,貌似不同的avr的写法很不一样啊,如果可以的话,请各位尽量用不同的型号举例,并说明原因,多谢。还有就是 avr芯片手册里面的中断向量 表格 那个 在编程的时候怎么用呢?尤其studio环境下?? ISR(vect_name){// vect_name 看avr-libc手册.....
} 呵呵我也很蛋疼 2楼正解~ 搭车问一下如何关总中断啊 中断函数参考2楼
vect_name可以看这个
例SIGNAL(SIG_INTERRUPT0) 苦行僧 发表于 2012-6-7 23:12 static/image/common/back.gif
搭车问一下如何关总中断啊
是说AVR GCC吧?
学新开发平台,先看其系统头文件
<interrupt.h>里有你想要的
#if defined(__DOXYGEN__)
/** \def cli()
\ingroup avr_interrupts
\code #include <avr/interrupt.h> \endcode
Disables all interrupts by clearing the global interrupt mask. This function
actually compiles into a single line of assembly, so there is no function
call overhead. */
#define cli()
#else/* !DOXYGEN */
# define cli()__asm__ __volatile__ ("cli" ::)
#endif /* DOXYGEN */ AVR Sstudio5/6整合了 GCC,直接写c源程序。开总中断:sei();//asm("sei"); 关总中断:cli();//asm("cli"); 中断服务函数ISR(INT0_vect){//、、、} ISR(INT1/2_vect){//、、、、 } 也可以将ISR写成SIGNAL 但好像SIGNAL是要被淘汰的,建议写成ISR. 楼上正解 学习学习,谢谢 学习了,多谢多谢
页:
[1]