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()
时间: 2024-11-08 00:08:17