SlideShare a Scribd company logo
UART
(Universal Asynchronous Receiver/Transmitter)
• UART (Universal Asynchronous Receiver/Transmitter) is a serial
communication protocol in which data is transferred serially bit by bit at a time.
• Asynchronous serial communication is widely used for byte oriented
transmission.
• UART serial communication protocol uses a defined frame structure for their
data bytes.
• Frame structure in Asynchronous communication consists :
• 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 UART
• 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.
• UART0 and UART1 are identical other than the fact that UART1 has modem
interface included.
• Features of UART0
• 16 byte Receive and Transmit FIFOs
• Built-in fractional baud rate generator with autobauding capabilities
• Software flow control through TXEN bit in Transmit Enable Register
• UART0 :
• TXD0 (Output pin): Serial Transmit data pin.
• RXD0 (Input pin): Serial Receive data pin.
• U0RBR (UART0 Receive Buffer Register)
• Contains the recently received data
• U0THR (UART0 Transmit Holding Register)
• Contains the data to be transmitted
• U0DLL and U0DLM (UART0 Divisor Latch Registers)
• LSB and MSB of the UART buad rate generated value
• U0FDR (UART0 Fractional Divider Register)
• Controls the clock prescalar for the baud rate
• U0LCR (UART0 Line Control Register)
• Controls the UART frame formatting
• U0LSR (UART0 Line Status Register)
• Provides status information on the UART
• U0TER (UART0 Transmit Enable Register)
• Transmit holding register
Programming steps
• 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 baud rate.
• Example,
• PCLK = 15MHz. For baud rate 9600, without using fractional divider
register, from the baud rate formula, we have,
• On reset, MulVal = 1 and DivAddVal = 0 in the Fractional Divider
Register.
• Hence
• (256 x U0DLM + U0DLL ) = 97.65
We can consider it to be 98 or 97. It will make the baud rate slightly less or
more than 9600. This small change is tolerable. We will consider 97.
Since 97 is less than 256 and register values cannot contain fractions, we will
take U0DLM = 0. This will give U0DLM = 97.
• Make DLA = 0 using U0LCR register.
#include<LPC214X.h>
char *msg="HELLO WORLD n";
int main()
{
PINSEL0=0X5;
U0LCR=0X83;
U0DLM=0X00;
U0DLL=0X61; //baud rate=7200 then 82 if baud rate=9600 then 61
U0LCR=0X03;
while (*msg!=0x00)
{
while(!(U0LSR & 0x20));
U0THR=*msg;
msg++;
}
}

More Related Content

Similar to UART.pptx

UART
UARTUART
Serial Communication Part-16
Serial Communication Part-16Serial Communication Part-16
Serial Communication Part-16
Techvilla
 
Uart
UartUart
Llpc2148 sci
Llpc2148 sciLlpc2148 sci
Llpc2148 scianishgoel
 
Serial Communication In Atmega 16
Serial Communication In Atmega 16Serial Communication In Atmega 16
Serial Communication In Atmega 16Suren Kumar
 
The presentation is about USART and serial communication
The presentation is about USART and serial communicationThe presentation is about USART and serial communication
The presentation is about USART and serial communication
sinaankhalil
 
Firmware implementation of UART using Bare metal programming
Firmware implementation of UART using Bare metal programmingFirmware implementation of UART using Bare metal programming
Firmware implementation of UART using Bare metal programming
IRJET Journal
 
Implementation of UART with Status Register using Multi Bit Flip-Flop
Implementation of UART with Status Register using Multi Bit  Flip-FlopImplementation of UART with Status Register using Multi Bit  Flip-Flop
Implementation of UART with Status Register using Multi Bit Flip-Flop
IJMER
 
Bluetooth Home Automation
Bluetooth Home AutomationBluetooth Home Automation
Bluetooth Home Automation
Apoorv Gupta
 
Serial Communication Uart soc
Serial Communication  Uart socSerial Communication  Uart soc
Serial Communication Uart soc
Satyam Sharma
 
Raspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication ProtocolsRaspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication Protocols
Mohamed Abdallah
 
Doc32059
Doc32059Doc32059
32059 sistem
32059 sistem32059 sistem
32059 sistem
Alfredo Santillan
 
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications
Premier Farnell
 

Similar to UART.pptx (20)

UART
UARTUART
UART
 
Serial Communication Part-16
Serial Communication Part-16Serial Communication Part-16
Serial Communication Part-16
 
Uart
UartUart
Uart
 
Tutorial
TutorialTutorial
Tutorial
 
Llpc2148 sci
Llpc2148 sciLlpc2148 sci
Llpc2148 sci
 
Serial Communication In Atmega 16
Serial Communication In Atmega 16Serial Communication In Atmega 16
Serial Communication In Atmega 16
 
Uart wiki
Uart wikiUart wiki
Uart wiki
 
The presentation is about USART and serial communication
The presentation is about USART and serial communicationThe presentation is about USART and serial communication
The presentation is about USART and serial communication
 
Firmware implementation of UART using Bare metal programming
Firmware implementation of UART using Bare metal programmingFirmware implementation of UART using Bare metal programming
Firmware implementation of UART using Bare metal programming
 
Uart
UartUart
Uart
 
Implementation of UART with Status Register using Multi Bit Flip-Flop
Implementation of UART with Status Register using Multi Bit  Flip-FlopImplementation of UART with Status Register using Multi Bit  Flip-Flop
Implementation of UART with Status Register using Multi Bit Flip-Flop
 
Bluetooth Home Automation
Bluetooth Home AutomationBluetooth Home Automation
Bluetooth Home Automation
 
NAVEEN UART BATCH 43
NAVEEN UART BATCH 43NAVEEN UART BATCH 43
NAVEEN UART BATCH 43
 
Serial Communication Uart soc
Serial Communication  Uart socSerial Communication  Uart soc
Serial Communication Uart soc
 
Raspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication ProtocolsRaspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication Protocols
 
UART
UARTUART
UART
 
Doc32059
Doc32059Doc32059
Doc32059
 
32059 sistem
32059 sistem32059 sistem
32059 sistem
 
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications
 
Intel Quark HSUART
Intel Quark HSUARTIntel Quark HSUART
Intel Quark HSUART
 

Recently uploaded

DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 

Recently uploaded (20)

DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 

UART.pptx

  • 2.
  • 3. • UART (Universal Asynchronous Receiver/Transmitter) is a serial communication protocol in which data is transferred serially bit by bit at a time. • Asynchronous serial communication is widely used for byte oriented transmission. • UART serial communication protocol uses a defined frame structure for their data bytes.
  • 4. • Frame structure in Asynchronous communication consists : • 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.
  • 5. • LPC2148 UART • 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. • UART0 and UART1 are identical other than the fact that UART1 has modem interface included. • Features of UART0 • 16 byte Receive and Transmit FIFOs • Built-in fractional baud rate generator with autobauding capabilities • Software flow control through TXEN bit in Transmit Enable Register
  • 6.
  • 7. • UART0 : • TXD0 (Output pin): Serial Transmit data pin. • RXD0 (Input pin): Serial Receive data pin.
  • 8. • U0RBR (UART0 Receive Buffer Register) • Contains the recently received data • U0THR (UART0 Transmit Holding Register) • Contains the data to be transmitted • U0DLL and U0DLM (UART0 Divisor Latch Registers) • LSB and MSB of the UART buad rate generated value • U0FDR (UART0 Fractional Divider Register) • Controls the clock prescalar for the baud rate • U0LCR (UART0 Line Control Register) • Controls the UART frame formatting • U0LSR (UART0 Line Status Register) • Provides status information on the UART • U0TER (UART0 Transmit Enable Register) • Transmit holding register
  • 9. Programming steps • 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 baud rate.
  • 10. • Example, • PCLK = 15MHz. For baud rate 9600, without using fractional divider register, from the baud rate formula, we have, • On reset, MulVal = 1 and DivAddVal = 0 in the Fractional Divider Register. • Hence
  • 11. • (256 x U0DLM + U0DLL ) = 97.65 We can consider it to be 98 or 97. It will make the baud rate slightly less or more than 9600. This small change is tolerable. We will consider 97. Since 97 is less than 256 and register values cannot contain fractions, we will take U0DLM = 0. This will give U0DLM = 97. • Make DLA = 0 using U0LCR register.
  • 12. #include<LPC214X.h> char *msg="HELLO WORLD n"; int main() { PINSEL0=0X5; U0LCR=0X83; U0DLM=0X00; U0DLL=0X61; //baud rate=7200 then 82 if baud rate=9600 then 61 U0LCR=0X03; while (*msg!=0x00) { while(!(U0LSR & 0x20)); U0THR=*msg; msg++; } }