C166: Handling Unused Interrupts
Information in this article applies to:
We would like to account for all interrupts in a C167/XC16x/XC2000 system - i.e.Â all unused interrupts would go to a common interrupt routine for logging or error handling. How do we do this? We see how to assign individual interrupt routines to the "table", but not how to load the same vector/function for multiple interrupt sources.
The solution depends on the C166 version you are using.
C166 < 4.10a:
There is no easy way (in C) to assign a single interrupt routine to multiple traps or vectors. However, you can easily implement several interrupt routines that invoke a general purpose unused interrupt handler.
For example, the following code shows you how to trap and "handle" the serial transmit and receive interrupts. Note that these interrupts use the same register bank. This may be undesirable.
Note that in this example, the interrupt functions pass the trap number to the bad IRQ handler. This may or may not be useful depending on your application.
C166 > 4.10a:
With version 4.10a, the L166 linker directive INTNO (interrupt_name (FILL)) was introduced. This directs all unused interrupt vectors to one common interrupt service routine.
Example interrupt service routine:
Example L166 linker directive:
In µVision, you can specify the directive INTNO (MYINT (FILL)) in the dialog Options for Target - L166 Misc - Misc Controls.
Last Reviewed: Thursday, February 25, 2021
of your data.