| ||||||||
Technical Support Support Resources Product Information | C51: FLOATING-POINT REENTRANCY IN ISR?Information in this article applies to:
QUESTIONThe documentation states floating-point operations are fully reentrant. Does that apply to interrupt routines as well? ANSWERFloating 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 | |||||||
| ||||||||