Uart LPC2148
Uart LPC2148
Uart LPC2148
Asynchronous serial communication is widely used for byte oriented transmission. In Asynchronous
serial communication, a byte of data is transferred at a time.
• START bit: It is a bit with which indicates that serial communication has started and it is always
low.
• Data bits packet: Data bits can be packets of 5 to 9 bits. Normally we use 8 bit data packet,
which is always sent after the START bit.
• STOP bit: This usually is one or two bits in length. It is sent after data bits packet to indicate the
end of frame. Stop bit is always logic high.
LPC2148 has two inbuilt UARTs available i.e. UART0&UART1. So, we can connect two UART enabled
devices (GSM module, GPS module, Bluetooth module etc.) with LPC2148 at a time.
The transmitter of device-A connected to receiver of device-B and receiver of device-A connected to
transmitter of device-B. This is how devices can send data simultaneously to each other, a mode of
communication called ‘full duplex’.
Features of UART0:
Features of UART1
Programming of UART0
Initialization of UART0
• Configure P0.0 and P0.1 as TXD0 and RXD0 by writing 01 to the corresponding bits in PINSEL0.
• Using U0LCR register, make DLAB = 1. Also, select 8-bit character length and 1 stop bit.
• Set appropriate values in U0DLL and U0DLM depending on the PCLK value and the baud rate
desired. Fractional divider can also be used to get different values of baudrate.
Transmitting character:
• Monitor the THRE bit in U0LSR register. When this bit becomes 1, it indicates that U0THR
register is empty and the transmission is completed.
Receiving character:
• Monitor the RDR bit in U0LSR register to see if valid data is available in U0RBR register.