keil_examples/UART/uart.c
/*****************************************************************************
** Function name:		UARTSend
**
** Descriptions:		Send a block of data to the UART 0 port based
**						on the data length
**
** parameters:			portNum, buffer pointer, and data length
** Returned value:		None
** 
*****************************************************************************/
Function name:         UARTSend
Descriptions:          Send a block of data to the UART 0 port based
on the data length

portNum, buffer pointer, and data length
Returned value:                None
Function name : UARTSend Descriptions : Send a block of data to the UART 0 port based on the data length portNum buffer pointer and data length Returned value : None
void UARTSend( uint32_t portNum, uint8_t *BufferPtr, uint32_t Length )
{
  if ( portNum == 0 )
  {
    while ( Length != 0 )
    {
	  while ( !(UART0TxEmpty & 0x01) );	
	  LPC_UART0->THR = *BufferPtr;
	  UART0TxEmpty = 0;	
	  BufferPtr++;
	  Length--;
	}
  }
  else
  {
	while ( Length != 0 )
    {
	  while ( !(UART1TxEmpty & 0x01) );	
	  LPC_UART1->THR = *BufferPtr;
	  UART1TxEmpty = 0;	
	  BufferPtr++;
	  Length--;
    }
  }
  return;
}
void UARTSend ( uint32_t portNum , uint8_t * BufferPtr , uint32_t Length ) { if ( portNum == 0 ) { while ( Length != 0 ) { while ( ! ( UART0TxEmpty & 0x01 ) ) ; LPC_UART0 -> THR = * BufferPtr ; UART0TxEmpty = 0 ; BufferPtr ++ ; Length -- ; } } else { while ( Length != 0 ) { while ( ! ( UART1TxEmpty & 0x01 ) ) ; LPC_UART1 -> THR = * BufferPtr ; UART1TxEmpty = 0 ; BufferPtr ++ ; Length -- ; } } return ; }
Function name:         UARTSend
Descriptions:          Send a block of data to the UART 0 port based
on the data length
Function name : UARTSend Descriptions : Send a block of data to the UART 0 port based on the data length
/* THRE status, contain valid data */ /* not empty in the THR until it shifts out */ /* THRE status, contain valid data */ /* not empty in the THR until it shifts out */