Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

UART Problem

2005-03-02 by mobilsiten

I cant get this to work. I only want to turn on a led if I recive
something on UART1. 
This is the code:

void init_serial (void)      // Initialize Serial Interface  
{ 
	unsigned dummy;
	unsigned short baud = 9600, baud_rate;     

	PINSEL0 = 0x00050000;    /* Enable RxD1 and TxD1 */
	
	U1LCR = 0x0D3;            /* 8 bits, no Parity, 1 Stop bit */
	U1IER = 0;               /* Disable UART1 Interrupts */
	
	VICVectAddr0 = (unsigned long)ElsyIRQ;
	VICVectCntl0 = 0x20 | 7; /* UART1 Interrupt */
	VICIntEnable = 1 << 7;   /* Enable UART1 Interrupt */

 	baud_rate	  = UART_BAUD(baud);
	U1DLL 		  = (signed char)(baud_rate);			//LSB
  	U1DLM 		  = (signed char)((baud_rate) >> 8); //MSB 
 	U1LCR 		  = 0x00000003;              // DLAB = 0 

	dummy = U1IIR;   /* Read IrqID - Required to Get Interrupts Started */
	U1IER = 3;       /* Enable UART1 RX and THRE Interrupts */

}

void ElsyIRQ (void) 
{
	IOSET1 = 0x000F0000;           // Turn on LEDs
	VICVectAddr = 0x00000000;
}

Can someone please help me?

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.