[SOLVED]UART Program Limitations?

Thread Starter

MTech1

Joined Feb 15, 2023
161
I've noticed in many places that UART is described as full-duplex, implying it can transmit and receive simultaneously. However, I believe these references are regarding hardware. I think UART program can only transmit or receive, not both simultaneously. Refrance PIC18F45K22.

What's your opinion on this?
 

ericgibbs

Joined Jan 29, 2010
18,848
Hi MT,
Read this PDF app for the PIC UART
Clip:
ASYNCHRONOUS OPERATION
The USART uses two I/O pins to transmit and receive
serial data. Because there is no separate clock signal
for asynchronous operation, one pin (TX) is used for
transmission and the other pin (RX) is used for reception.
Both transmission and reception can occur at the
same time and this is known as ‘full duplex’ operation.
Transmission and reception can be independently
enabled, but when the serial port is enabled the
USART will control both pins, and one cannot be used
for general purpose I/O when the other is being used
for transmission or reception.
 

Attachments

MrChips

Joined Oct 2, 2009
30,805
Every UART hardware that I have encountered can operate in full duplex. The only time that I have seen half duplex operation is in RS-485 networks. Other members might suggest different situations.
 

nsaspook

Joined Aug 27, 2009
13,269
I've noticed in many places that UART is described as full-duplex, implying it can transmit and receive simultaneously. However, I believe these references are regarding hardware. I think UART program can only transmit or receive, not both simultaneously. Refrance PIC18F45K22.

What's your opinion on this?
Yes, a program that uses a normal hardware UART(like what's inside thePIC18F45K22 ) can be full-duplex, most of them are because data flow control is usually easier (more logical to program) when you can ransmit and receive simultaneously using flag polling or interrupts.

If there are limitations, it's on the beginner programmer. ;)
 

WBahn

Joined Mar 31, 2012
30,055
I've noticed in many places that UART is described as full-duplex, implying it can transmit and receive simultaneously. However, I believe these references are regarding hardware. I think UART program can only transmit or receive, not both simultaneously. Refrance PIC18F45K22.

What's your opinion on this?
Why do you think this?

If it's because you think that a program can only execute one instruction at a time and therefore it can both send and receive at the same time, then this is a fallacy of not recognizing that programs routinely have the illusion of doing multiple things at the same time (multitasking). Even without any UART hardware at all -- if all you have is two I/O pins that you have to bit-band -- your program just ping pongs back and forth between sending and receiving at a fast enough rate that both processes proceed in parallel.
 

Papabravo

Joined Feb 24, 2006
21,225
Why do you think this?

If it's because you think that a program can only execute one instruction at a time and therefore it can both send and receive at the same time, then this is a fallacy of not recognizing that programs routinely have the illusion of doing multiple things at the same time (multitasking). Even without any UART hardware at all -- if all you have is two I/O pins that you have to bit-band -- your program just ping pongs back and forth between sending and receiving at a fast enough rate that both processes proceed in parallel.
I have implemented a bit banging UART that did full duplex operation. It is true that it was 2400 baud, but it was also1978.
 

Picbuster

Joined Dec 2, 2013
1,047
Hi,
The pic series are able to rx and tx at the same time however; your program must be able to do so.
I normal use input interrupts and fill a buffer at the same time I transmit data during receive no problem.
Again your program must be able to handle it.
tx on interrupts is also possible.

Split baudrate is not possible @ full duplex.

Picbuster
 
Top