16 #define SystemFrequency SystemCoreClock
37 IIRValue = LPC_UART->IIR;
43 LSRValue = LPC_UART->LSR;
50 Dummy = LPC_UART->RBR;
82 LSRValue = LPC_UART->LSR;
114 NVIC_DisableIRQ(UART_IRQn);
116 LPC_IOCON->PIO1_6 &= ~0x07;
117 LPC_IOCON->PIO1_6 |= 0x01;
118 LPC_IOCON->PIO1_7 &= ~0x07;
119 LPC_IOCON->PIO1_7 |= 0x01;
121 LPC_SYSCON->SYSAHBCLKCTRL |= (1<<12);
122 LPC_SYSCON->UARTCLKDIV = 0x1;
124 LPC_UART->LCR = 0x83;
125 regVal = LPC_SYSCON->UARTCLKDIV;
126 Fdiv = (((
SystemFrequency/LPC_SYSCON->SYSAHBCLKDIV)/regVal)/16)/baudrate ;
128 LPC_UART->DLM = Fdiv / 256;
129 LPC_UART->DLL = Fdiv % 256;
130 LPC_UART->LCR = 0x03;
131 LPC_UART->FCR = 0x07;
134 regVal = LPC_UART->LSR;
139 while ( LPC_UART->LSR &
LSR_RDR )
141 regVal = LPC_UART->RBR;
145 NVIC_EnableIRQ(UART_IRQn);
169 while ( Length != 0 )
173 while ( !(LPC_UART->LSR &
LSR_THRE) );
174 LPC_UART->THR = *BufferPtr;
178 LPC_UART->THR = *BufferPtr;
volatile uint32_t UARTCount
void UARTInit(uint32_t baudrate)
void UART_IRQHandler(void)
volatile uint8_t UARTBuffer[BUFSIZE]
volatile uint8_t UARTTxEmpty
void UARTSend(uint8_t *BufferPtr, uint32_t Length)
volatile uint32_t UARTStatus