AVR编程中 (GCC) SIGNAL与ISR的区别
来源:互联网 发布:淘宝网物美时尚生活馆 编辑:程序博客网 时间:2024/05/23 05:07
/*
/def ISR(vector [, attributes])
/ingroup avr_interrupts
/code #include <avr/interrupt.h> /endcode
Introduces an interrupt handler function (interrupt service
routine) that runs with global interrupts initially disabled
by default with no attributes specified.
The attributes are optional and alter the behaviour and resultant
generated code of the interrupt routine. Multiple attributes may
be used for a single function, with a space seperating each
attribute.
*/
# define ISR(vector, [attributes])
#else /* real code */
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# define __INTR_ATTRS used, externally_visible
#else /* GCC < 4.1 */
# define __INTR_ATTRS used
#endif
#ifdef __cplusplus
# define ISR(vector, ...) /
extern "C" void vector (void) __attribute__ ((signal,__INTR_ATTRS)) __VA_ARGS__; /
void vector (void)
#else
# define ISR(vector, ...) /
void vector (void) __attribute__ ((signal,__INTR_ATTRS)) __VA_ARGS__; /
void vector (void)
#endif
/*
/def SIGNAL(vector)
/ingroup avr_interrupts
/code #include <avr/interrupt.h> /endcode
Introduces an interrupt handler function that runs with global interrupts
initially disabled.
This is the same as the ISR macro without optional attributes.
/deprecated Do not use SIGNAL() in new code. Use ISR() instead.
*/
# define SIGNAL(vector)
由上可知:ISR是用SIGNAL属性写的,都是不能中断嵌套。区别是ISR(vector [, attributes])参数可变,,而SIGNAL(vector)只有一个参数vector。GCC建议使用ISR,代替SIGNAL。SIGNAL 是为了相容旧程序代码而保留下来的。
所谓不能中断嵌套,是指执行中断服务时不能再响应其他中断。因为进入中断程序后,立即会禁止总中断,而中断返回前使能总中断。
要中断嵌套,须进入中断程序后使能总中断,中断返回之前禁止总中断。响应的代码分别为:“ sei(); ” 、“ cli(); ”。
- AVR编程中 (GCC) SIGNAL与ISR的区别
- AVR GCC中 ISR 与 SIGNAL 的关系
- AVR单片机GCC编程
- AVR 单片机与GCC 编程之存储器操作
- AVR 单片机与GCC 编程之存储器操作
- AVR 单片机与GCC 编程之存储器操作(转载)
- STM32-RTX中signal与semaphore的区别
- Avr-Gcc中关于delay函数的应用
- AVR-GCC中sprintf函数转换浮点数的方法
- AVR-GCC 中如何使用volatile 关键字
- unix环境高级编程(阅读笔记)------signal函数与sigaction的区别
- 多线程编程--gcc中-pthread和-lpthread的区别
- ISR中清中断标志的时机
- AVR单片机状态与编程
- avr-gcc的EEPROM的api
- AVR-GCC里定义的API
- AVR-GCC里定义的API
- AVR-GCC的I/O端口API
- VC缺省链接库的顺序不对导致链接错误error LNK2005: "void __cdecl operator delete(void *)"
- vs 2008 连接 tfs 2010
- 2011高德杯中国位置应用大赛
- sqlite
- Sql 2005分区示例
- AVR编程中 (GCC) SIGNAL与ISR的区别
- JavaScript eval用法
- webhavest+nutch1.2抓数据,建索引流程
- PerfHud使用小结
- 堆和栈的区别(转过无数次的文章)
- php调用MSSQL存储过程日期格式问题
- android RSS解析器创建步骤
- dbms_xplan的增强xplan
- 绑定数据时,时间格式的转换