difference between ISR and normal functions - Embedded C interview Question

Embedded C interview Question

What is the difference between ISR and normal functions?

Answer

The difference between an ISR and a normal routine is very slight and has to do with CPU opcodes. ISR routines end their routine with an "Interrupt Return (IRET)" whereas normal procedures end their routines with "Return (RET)" or "Far Return (RETF)"

Some compilers do not have the ability to correctly create ISRs. Often a compiler introduces a non-ansi compliant keyword "_interrupt" or "interrupt". Compilers known to support this keyword are Watcom C/C++, Borland C/C++, and Microsoft C 6.0. However, GCC does not support this keyword for x86 architecture and it would seem Visual C/C++ does not.

/* example of clock tick routine in Watcom C/C++ */
Void _interrupt ISR_clock (void)
{
   Clock_count++;
}

No comments:

Post a comment