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

Problem in using timer and uart interrupt

I am working in LPC2124 controller , but now problem issue is sending serial data communication(uart) ,not properly received the application end.

When did enable the both UART and TIMER in same time , the sending serial data is stop in particular time,without timer enable its receiving serial data(Uart) working good.

I think both(timer&uart) interrupt occur in at same time,so that may be problem is coming.

Please if you any sample code for using both timer and uart at time configuration file.

kindly for your reference attached code please find it.

#define VIC_TIMER0_bit (1 << VIC_TIMER0)
typedef unsigned int U16;

void UART_initialisation()
{ VPBDIV_bit.VPBDIV=1; //pclk = cclk U0LCR = 0x83; U0DLL = DIVISOR % 256; U0DLM = DIVISOR / 256; U0LCR = 0x03; U0FCR = 0x05; U0IER=0x01;

U1LCR = 0x83; U1DLL = DIVISOR1 % 256; U1DLM = DIVISOR1 / 256; U1LCR = 0x03; U1FCR = 0x05; U1IER=0x01; VICIntSelect &= ~(1<<VIC_UART0); // Timer 0 intrpt is an IRQ VICVectAddr0 = (unsigned int)&UART0; // Install ISR in VIC addr slot VICVectCntl0 = 0x20 | VIC_UART0; // IRQ type, TIMER 0 int enabled VICIntEnable |= (1<<VIC_UART0);

VICIntSelect &= ~(1<<VIC_UART1); // Timer 0 intrpt is an IRQ VICVectAddr1 = (unsigned int)&UART1; // Install ISR in VIC addr slot VICVectCntl1 = 0x20 | VIC_UART1; // IRQ type, TIMER 0 int enabled VICIntEnable |= (1<<VIC_UART1); // Turn on Timer0 Interrupt PICQRSDet(0,1); __enable_interrupt(); // Global interrupt enable

}

void TMER0_INITIALIZE(void)
{ T0TCR = 0x00; // diable timer T0PR = 59; // To set the prescale register value T0PC = 0X00000000; // To set the prescale counter reg value to 0 T0TC = 0X00000000; // To set the timer counter value to 0 T0MR0 = 1000; // To set the match register value //1000000 for 1 sec T0MCR = 0X00000003; // To set match control register value to generate an interrupt T0TCR = 0x01; // diable timer

VICDefVectAddr = (U16)&TimerInterrupt; VICIntSelect &= ~VIC_TIMER0_bit; // IRQ on timer 0 line. VICVectAddr3 = (U16)&TimerInterrupt; VICVectCntl3 = 0x20 | VIC_TIMER0; // Enable vector interrupt for timer 0. VICIntEnable = VIC_TIMER0_bit; // Enable timer 0 interrupt.

}

static void TimerInterrupt(void)
{

displayname();

T0IR = 0x01; // Clear timer 0 interrupt line. VICVectAddr = 0; // Dummy write to transfer the control to main program return;

}