Embedded system Interrupt Service subroutine (ISR) _ Embedded

Source: Internet
Author: User

Interrupts are an important part of embedded systems, which leads to a lot of compiler developers providing an extension-letting standard C support break. The representative fact is that a new keyword __interrupt has been produced. The following code uses the __interrupt keyword to define an interrupt service subroutine (ISR), please comment on this code.

__interrupt Double Compute_area (double radius)
{

Double area = PI * radius * RADIUS;
printf ("area =%f", area);
return area;
}

1). ISR cannot return a value.
2). ISR cannot pass parameters.

3. In many processors/compilers, floating-point is generally not reentrant. Some processors/compilers need to allow the registers of the frontal register to stack, and some processors/compilers do not allow floating-point operations in the ISR. In addition, the ISR should be short and efficient, and it is unwise to do floating-point operations in the ISR.
4. In the same vein as 3rd, printf () often has the problem of reentrant and performance.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.