码迷,mamicode.com
首页 > 其他好文 > 详细

嵌入式编程 中断 一题

时间:2015-01-15 10:42:10      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:

Interrupts are an important part of embedded systems. Consequently, many compiler vendors offer an extension

to standard C to support interrupts. Typically, the keyword is _interrupt. The following routine(ISR), point out

the errors in the code.

_interrupt double compute_area(double radius)
{
    double area = PI * radius * radius;

    printf("\nArea = %f", area);

    return 0;
}

 

析:

1)ISR不能返回一个值
2)ISR不能传递参数
3)在许多处理器或编译器中,浮点一般都是不可重入的,此外,ISR应是短而有效率的,在ISR中做浮点去处是不明智的
4)printf()经常有重入和性能上的问题,所以一般不使用printf()

嵌入式编程 中断 一题

标签:

原文地址:http://www.cnblogs.com/aqing1987/p/4225439.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!