This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Inperrupt Sevice Routines

Hello,
I am working on a project related to ST10 microcontroller. Can anybody help me to tell about how to set Interrupt service routines to the corresponding interrupts? My s/w tool is C166 compiler.

  • There are two formats for an ISR declaration:

    1)
    void ISR_Fcn( void ) interrupt INT# {}
    2)
    void ISR_Fcn( void ) interrupt INT# using isr_Rbank {}
    
    where:
    'ISR_Fcn' is the Interrupt Service Routine function name.
    'interrupt' is a keyword which tells the compiler to save ALL registers which are modified. The function will return using an interrupt return op code instead of a function return op code.
    'INT#' is the interrupt number assigned in hardware (not the vector address). These are listed in the data book.
    'using' is a keyword for allowing a context switch.
    'isr_Rbank' is a unique name given by the programmer which is assigned to the register bank used by this ISR. This is usually the only place in the entire source code where this name will be mentioned, though it will show up in the map file.

    Example:
    #define CC28INT 0x3C    // number from ST10 data book
    void ISR_Fcn( void ) interrupt CC28INT using isr_Rbank {
       input_Count++;
       ...
    }
    
    The vector at address 00'00F0 will be set to &ISR_Fcn (by the toolchain) so when the capture compare #28 requests an interrupt it will go to this function.

    Best
    Scott