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

How to define the interrupt function ( UART0 )

hi
i whant define function "UART0_IRQHandler" in my library ( uart library )
but i dont whant use
#include <lpc17xx.h>
and
startup_LPC17xx.s

I tried this code but did not work
void (*test) (void) = (void (*) (void)) 0x54;

in file "LPC176x/5x User manual ( UM10360 )" and "Table 50" :

Interrupt_ID : 5
Exception_Number : 21
Vector_Offset : 0x54
Function : UART0
Flag(s) : Rx Line Status (RLS) Transmit Holding Register Empty (THRE) Rx Data Available (RDA) Character Time-out Indicator (CTI) End of Auto-Baud (ABEO) Auto-Baud Time-Out (ABTO)

Parents Reply Children
  • Until you understand what startup_LPC17xx.s does, you will not be able to add its functionality somewhere else and add your own interrupt handler routines.

    fortunately, if you do use startup_LPC17xx.s, you can just write a c function with the same name as in startup_LPC17xx.s and the Default handler will be replaced with your function.

    In main (or somewhere)

    void UART0_HandlerIRQ(void)
    {
        your code here
    }
    

    Will cause your UART0_HandlerIRQ{) function to be called every time it is activated.

    You really do need to understand what startup_LPC17xx.s does before you can remove it. it is only about 250 lines. It would be helpful if you did not post again until you understand what startup_LPC17xx.s does and how you plan on making sure startup happens properly without using startup_LPC17xx.s