The following code shown in Visual 5.0 DSP help is incorrect if run in release mode
You need to make all functions aware that number of interrupts is a volatile
To define a function as an ISR, the sys/exception.h header file must be included and the function must be declared and defined using macros defined within this header file. There is a macro for each of the three kinds of events the compiler supports:
By default, ISRs generated by the compiler are not re-entrant; they disable the interrupt system on entry, and re-enable it on exit. You may also define ISRs for interrupts that are re-entrant, and which re-enable the interrupt system soon after entering the ISR.