首页 > 其他 > 详细

嵌入式编程 中断 一题

时间:2015-01-15 10:41:28      阅读:286      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!