Dear all my code is written for serial transmission and reception on interrupt at 9600 baud rate its working fine but my problem is in continous loop I kept U0IER =0x06; for both transmission and reception on interrupt but reception occurs only once please suggest solution for continous reception.
Thnaks in advance.... void InitUART0(void) { PINSEL0 = 0x50; // Pin function UART0 U0LCR = 0x83; // Data length 8bits,stop bit 1,parity none DLAD enable U0DLM = Div / 256 ; U0DLL = Div % 256 ; U0LCR =0x03 ; // Reset DLAB bit U0FCR =0x07 ; // Clear tx FIFO and Enable RX TX FIFO U0IER =0x04; //Interrupt enable on Rx } void InitVIC(void) { VICIntEnClr = 0xFFFFFFFF; //Clear all interrupts VICVectAddr = 0; VICIntSelect = 0; //All are IRQ
VICIntEnClr = 0x40; VICVectAddr6 = (unsigned long)UART0_ISR; //Set vector address VICVectPriority6 = 0x01; VICIntEnable = 0x40; //BIT 6 OF Interrupt sources bit allocation table } void UART0_ISR(void) __irq { U0IER = 0; while (!(U0LSR & 0x01)) {} // Wait untill there is valid data in U0RBR Rchar = U0RBR ; buff1[l++]=Rchar; U0IIR=0x0; VICVectAddr = 0x00000000; } int main(void) { InitCPU(); InitVIC(); // Initalization of VIC InitUART0(); InitUART1(); SCS |= 0x00000001; // set GPIOx to use Fast I/O FIO2DIR = 0x000000FF; // Direction of P2.0 to P2.8 Output while(1) { U0IER =0x06; if(buff1[0]=='x') { clear_Rxbuffer(); TransmitChar0('W');TransmitChar0('E');TransmitChar0('L'); TransmitChar0('C');TransmitChar0('0');TransmitChar0('M'); TransmitChar0('E'); U0IER =0x04; }
}
Easy. You read the documentation for the processor just as carefully as you read the instructions on how to post source code (the text directly above the message input box). Repeat your post, but this time do it correctly - no one will bother to read the above garbled noise.
By the way: Do you really think "while (!(U0LSR & 0x01)) {}" is good to have in your ISR?
the text directly above the message input box:
www.danlhenry.com/.../keil_code.png