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.
i wrote a code for uart3 but the data was not receiving ,i checked all pheripherals like power control and pinsel regsistery and baudrate too, here i posted my code please do the needfull as soon as possible.
#include <LPC23xx.H>
unsigned int data;
/********************************INTI UART0**********************************************/ void Init_Uart0(void) { PINSEL0 |= 0x00000050; //UART0 CCLKCFG = 0x05; PCONP |= 0X08; //Powerup for UART0 // PINSEL0=0X050; //ENABLE UART0 U0FCR =0x07; //Fifo Enable U0LCR=3|(1<<7); //ENABLE DLAB AND 8-BIT CHARACTER LENGTH U0DLL=0X4E; //SET BAUD RATE =9600 FOR 12MHZ U0LCR&=0X0F; //DISABLE DLAB }
/********************************INTI UART3**********************************************/ void init_uart3(void) { PINSEL1 |= 0x003C0000; //UART3 CCLKCFG = 0x05; PCONP |= 0X02000000; //Powerup for UART3 U3FCR =0x07; //Fifo Enable U3LCR=3|(1<<7); //ENABLE DLAB AND 8-BIT CHARACTER LENGTH U3DLL=0X4E; //SET BAUD RATE =9600 FOR 12MHZ U3LCR&=0X0F; //DISABLE DLAB U3IER = 0X0; U3FCR = 0xc1; //Fifo Enable } /********************************************************************************************************/ void receive_uart0(void)
{ while(!(U0LSR &0x01)); data=U0RBR; }
/********************************************************************************************************/ void transmit_uart0(int data) { while(!(U0LSR &0x60)); U0THR =data;
}
void receive_uart(void) { while(!(U3LSR &0X01)); data=U3RBR; }
void transmit_uart(int data) { while(!(U3THR&0X60)); U0THR=data; }
int main() { init_uart3(); Init_Uart0(); receive_uart0(); transmit_uart0(data);
receive_uart(); transmit_uart(data); }