Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

UART Basic Before Writing Code

Presidint

New Member
I have 8051 microcontroller and using Keil, and before jumping into coding, I feel it's better to get a solid understanding of some basic concepts.

I have a couple of questions that I’m a bit confused about:

When we talk about terms like UART, do we refer to it as hardware, software, or protocol? Sometimes I see them used in different ways, and it’s not always clear to me.

To keep it simple, can I refer to it as hardware modules inside the microcontroller? Is that a correct way to think about it?

Also, if UART is considered a software protocol, how can it be full duplex? In code, I usually see we either send or receive a character, not both at exactly the same time. But as per the definition, full duplex should mean sending and receiving can happen simultaneously. Could you please clarify how that works in practice?
 
A UART is a hardware item, nowadays usually a module within an MCU, but originally a separate peripheral device.
(One of the originals is the AY-5-1013: https://rocelec.widen.net/view/pdf/bvesdj0cqf/GSIIS01845-1.pdf )

"Software serial" is an emulation if a UART is not available. And, full duplex in software is possible; it's a lot simpler if the MCU has hardware timers, but possible regardless.
 
Also to add to JRW, some people will tell you Software serial is a) too slow b) non interrupt

Both comments are wrong.. I have implemented a full duplex software Uart. But it will hog the interrupt. On the old 8052 series, you can use an interrupt pin and stick it on a decent priority.
Nothing will be better than hardware though...

As regards to protocol.. this is just the "method" of transfer.
You can use the RS232 protocol on a RS485 hardware it just means what bits are what. RS232 has this protocol..
"BAUD","stop bits" and "Parity" Just so both connections can talk to each other.

9600 baud, 1 stop bit and even parity is pretty much the norm for me.
 
You can and should think of UART as a hardware peripheral that follows a protocol.
When you're using UART on the 8051, you're using a hardware module inside the microcontroller that implements the UART communication protocol.
 
When you're using UART on the 8051, you're using a hardware module inside the microcontroller that implements the UART communication protocol.

The first character in UART stands for Universal - there is no "UART protocol".

You can configure the device to support different speeds, different numbers of data bits, no parity / even parity / odd parity, different stop bits, and (with a fully capable UART) different hardware handshake configurations.

Serial communications protocols for different devices can be wildly different, but the same UART can work with just about any asynchronous serial device by using the appropriate software configuration.

As the old saying: RS-232 is probably the most non-standardised "standard" ever invented!
 

Latest threads

New Articles From Microcontroller Tips

Back
Top