S12Z Interrupt catcher for unexpected interrupts

Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12Z Interrupt catcher for unexpected interrupts

No ratings

S12Z Interrupt catcher for unexpected interrupts

Interrupt catcher example code catches all unexpected interrupts.

It can be used for debugging or directly in the application software.

The Machine Exception routine is used here as example of expected interrupt.


A few notes:

1. For each expected interrupt you must remove a code line for given interrupt

    from the part of the code "A Set of unimplemented interrupts" and

    create your own service routine as it is, for example, made

    for interrupt 5 void Machine_Exception_ISR(void)


2. All interrupt vectors have 32bit size, however, addresses have only 24bit,

    therefore the most significant byte in interrupt vector is not used.

    Definitions with the keyword "interrupt XX" where XX represents vector

    order in the interrupt vector is used to define interrupt service function.


3. Interrupt number 0 is assigned to POR reset vector,

                     1 is assigned to Unimplemented page1 op-code trap vector

                     2 is assigned to Unimplemented page2 op-code trap vector

                     3  ...

                     4  ...

    Interrupt number = (0x1FC-Vector Address)/4. See Table 1-11. Interrupt

    Vector Locations at RM(page 62-65).

    For Example: Interrupt number of SCI0 = (0x1FC-0x19C)/4 = 0x18 = 24.

    So you can use either form

               interrupt VectorNumber_Vsci0 void SCI0_isr(void)


               interrupt 24 void SCI0_isr(void)


               interrupt ((0x1FC-0x19C)/4) void SCI0_isr(void)


    Note: VectorNumber_Vsci0 is defined in mc9s12zvl32.h      

Labels (1)


1. What version of CW is recommended for Toledo v6,4 or v10.7?

2. Has someone tested API timer with Bus clock (32MHz) on Toledo? Are there any issues?


Rajiv Bandodkar.

Version history
Last update:
‎04-04-2016 02:07 AM
Updated by: