We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all,
Im using LPC2136 and i want to use the UART0 serial port interrupt to receive data but it does not work. configure all the registers and I do not see any jump towards the interruption when receiving the data in U0RBR.
--------------------------------------------------------- int main(void) { int x, y, dx, dy; init_PLL(); SPI_init(); Serial0_init(); init_gpiox(); UART0_Interrupt_EN(); while(!(U0LSR&0x20)); //THRE = 0 stay here U0THR= 'T'; while(!(U0LSR&0x20)); //THRE = 0 stay here U0THR= 'E'; while(!(U0LSR&0x20)); //THRE = 0 stay here U0THR= 'S'; while(!(U0LSR&0x20)); //THRE = 0 stay here U0THR= 'T'; IO0SET |= 0x00000080; delay(); IO0CLR |= 0x00000080; while(1); }
--------------------------------------------------------------------- it is not jumping here!!!
void UART0Handler (void) __irq { while(!(U0LSR & 0x01)){}; //RDR = 0 stay here rxdat = U0RBR; IO0SET |= 0x00000080; delay(); IO0CLR |= 0x00000080; VICVectAddr= 0x00000000; } --------------------------------------------------------------------------- void UART0_Interrupt_EN(void) { VICIntSelect = 0x00000000; VICVectAddr6 = (unsigned) UART0Handler; //Vector 6 VICVectCntl6 = 0x00000020 | 6; //select UART0 VICIntEnable = 0x00000040; //interrupt } ---------------------------------------------------- startup.s configuration
Vectors LDR PC, Reset_Addr LDR PC, Undef_Addr LDR PC, SWI_Addr LDR PC, PAbt_Addr LDR PC, DAbt_Addr NOP ; Reserved Vector ; LDR PC, IRQ_Addr LDR PC, [PC, #-0x0FF0] ; Vector from VicVectAddr LDR PC, FIQ_Addr
Reset_Addr DCD Reset_Handler Undef_Addr DCD Undef_Handler SWI_Addr DCD SWI_Handler PAbt_Addr DCD PAbt_Handler DAbt_Addr DCD DAbt_Handler DCD 0 ; Reserved Address IRQ_Addr DCD IRQ_Handler FIQ_Addr DCD FIQ_Handler
Undef_Handler B Undef_Handler SWI_Handler B SWI_Handler PAbt_Handler B PAbt_Handler DAbt_Handler B DAbt_Handler IRQ_Handler B IRQ_Handler FIQ_Handler B FIQ_Handler