Technical Support

C51: FLOATING-POINT REENTRANCY IN ISR?


Information in this article applies to:

  • C51 All Versions

QUESTION

The documentation states floating-point operations are fully reentrant. Does that apply to interrupt routines as well?

ANSWER

Floating point operations the compiler generates code for (+ - * /) are fully reentrant. But only a few functions in math.h are reentrant.

Those that are not reentrant must be protected from interrupts. One way this can be accomplished is to put a wrapper that disables and re-enables interrupts around the floating point math calls. For example:

#pragma disable        // Disable Interrupts for this function
float ISR_sin (float x)
{
return (sin(x));
}

MORE INFORMATION

SEE ALSO

Last Reviewed: Friday, July 15, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure