First, the header file:
#ifndef __isr_h#define__isr_h 1#include"include.h"/*redefine interrupt vector table * First cancels the default interrupt vector element macro definition #undef VECTOR_XXX * is redefined to the interrupt function you wrote #define Vecto R_xxx Xxx_irqhandler * For example: * #undef vector_003 * #define VECTOR_003 hardfault_handler redefining hardware petition Interruption service letter Number * * Extren void Hardfault_handler (void); Declare the function, and then define it in ISR.C.*/////////////////////////timed Interrupt Mapping////////////////#undefvector_084#definevector_084 Pit0_irqhandlerextern voidPit0_irqhandler (void);/*#undef vector_085#define vector_085 pit1_irqhandlerextern void Pit1_irqhandler (void);*////////////////Pulse Count Mapping////////////////////////#undefVector_101#defineVector_101 Lpt_handlerextern voidLpt_handler (void);////////////////serial Interrupt/////////////////#undefvector_061#definevector_061 Uart0_irohandlerextern voidUart0_irohandler (void);//////////////////potrc Port capture Interrupt////////////////////#undefvector_105#definevector_105 Portc_irqhandlerextern voidPortc_irqhandler (void);/*//////////////////potra-Port capture interrupt////////////////////#undef vector_103#define vector_103 Porta_irqhandlerextern void Porta_irqhandler (void);//////////////////POTRD-Port capture interrupt////////////////////#undef vector_106#define VECTOR_106 Portd_irqhandlerextern void Portd_irqhandler (void);*///////////////////DMA Channel 1 interrupt///////////////#undefvector_016#definevector_016 Dma_ch4_handlerextern voidDma_ch4_handler (void);#endif //__isr_h/*End of "Isr.h"*/
Second, the source file:
#include"Common.h"#include"include.h"/******2ms timed Interrupt * * * **/voidPit0_irqhandler (void) {pit_flag_clear (PIT0);//clear Interrupt Flag bit }//////////////Pulse count Interrupt Service function//////////////volatileU32 lpt_int_count=0;voidLpt_handler (void) {LPTMR0_CSR|=Lptmr_csr_tcf_mask; Lpt_int_count++;}/**///////////////////DMACH0 Interrupt/////////////voidDma_ch4_handler (void) {Dma_irq_clean (DMA_CH4);//clears the channel transmit interrupt flag bit (so that it can enter the interrupt again)Dma_en (DMA_CH4);//Enable channel CHN hardware request (this will continue to trigger DMA transfer)}/** * * Serial Interrupt * * * **/voidUart0_irohandler (void){} voidPortc_irqhandler (void){ }
Smart Car Learning (23)--K60 single chip microcomputer registration interrupt function