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

RE: LPC2378 UART simulator

I have problem with UART.LPC2378 is sended data to computer.
I use: MSEL=5,NSEL=1,CCLKsel=4->cclk=(12*5*2)/4=30MHz PCLK_UART2=cclk
this is my programe:
#include <LPC23xx.H>
#define tem (1<<6)

void tao(void)
{ unsigned long Fdiv; PCONP=0x03000000; PINSEL0 = 0x00000050; /* RxD0 and TxD0 */

U2LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */ Fdiv = ( 30000000 / 16 ) / 9600 ; /*baud rate */ U2DLM = Fdiv / 256; U2DLL = Fdiv % 256; U2LCR = 0x03; /* DLAB = 0 */ U2FCR = 0x07; /* Enable and reset TX and RX FIFO. */
} int main(void)
{int i,a;
char c[]="tran luc";
tao();
a=200;
while(a) {i=0; while (c[i]) {U2THR=c[i]; i++; } U2THR=0xA; U2THR=0xD; while (!(U2THR & tem)); a--; }
}

0