Embedded systems - Port Communication

Many PCs and compatible computers are equipped with two serial ports and one parallel port. Although these two types of ports are used for communicating with external devices, they work in different ways.

What is Serial port communication?

A serial port sends and receives data one bit at a time over one wire. While it takes eight times as long to transfer each byte of data this way, only a few wires are required. In fact, two-way (full duplex) communications is possible with only three separate wires - one to send, one to receive, and a common signal ground wire.

Serial Connection

What is a parallel port communication?

A parallel port sends and receives data eight bits at a time over 8 separate wires. This allows data to be transferred very quickly; however, the cable required is more bulky because of the number of individual wires it must contain. Parallel ports are typically used to connect a PC to a printer and are rarely used.

Parallel Connection

Serial VS parallel communication

Sr. No.Serial CommunicationParallel Communication
1In a serial connection, the data are sent one bit at a time over the transmission channel.Parallel connection means simultaneous transmission of N bits. These bits are sent simultaneously over N different channels.
2These operations are performed by a communications controller (normally a UART(Universal Asynchronous Receiver Transmitter) chip).Each bit is sent on a physical line which is divided into several sub-channels by dividing up the bandwidth. In this case, each bit is sent at a different frequency.
3The serial-parallel transformation is done in almost the same way using a shift register. The shift register shifts the register by one position to the left each time a bit is received, and then transmits the entire register in parallel when it is full.The parallel-serial transformation is performed using a shift register. The shift register, working together with a clock, will shift the register (containing all of the data presented in parallel) by one position to the left, and then transmit the most significant bit (the leftmost one) and so on.


Simplex transmission

A simplex connection is a connection in which the data flows in only one direction, from the transmitter to the receiver. This type of connection is useful if the data do not need to flow in both directions,for example, from your computer to the printer or from the mouse to your computer.

Half duplex

A half-duplex (HDX) system provides communication in both directions, but only one direction at a time (not simultaneously). Typically, once a party begins receiving a signal, it must wait for the transmitter to stop transmitting, before replying (antennas are of trans-receiver type in these devices, so as to transmit and receive the signal as well).

An example of a half-duplex system is a two-party system such as a walkie-talkie, where in one must use "Over" or another previously designated command to indicate the end of transmission, and ensure that only one party transmits at a time, because both parties transmit and receive on the same frequency.

Full Duplex

A full-duplex (FDX), or sometimes double-duplex system, allows communication in both directions, and, unlike half-duplex, allows this to happen simultaneously. Land-line telephone networks are full-duplex(Technically they are half-duplex but they transmit at such a high rate of speed that it appears to be full duplex.), since they allow both callers to speak and be heard at the same time, the transition from four to two wires being achieved by a hybrid coil. A good analogy for a full-duplex system would be a two-lane road with one lane for each direction.

Types of Serial Communication

Given the problems that arise with a parallel-type connection, serial connections are normally used. However, since a single wire transports the information, the problem is how to synchronize the transmitter and receiver, in other words, the receiver can not necessarily distinguish the characters (or more generally the bit sequences) because the bits are sent one after the other. There are two types of serial transmission that address this problem.

  • Asynchronous connection - An asynchronous connection, in which each character is sent at irregular intervals in time (for example a user sending characters entered at the keyboard in real time). So, for example, imagine that a single bit is transmitted during a long period of silence. The receiver will not be able to know if this is 00010000, 10000000 or 00000100. To remedy this problem, each character is preceded by some information indicating the start of character transmission (the transmission start information is called a START bit) and ends by sending end-of-transmission information (called STOP bit, there may even be several STOP bits).

  • Synchronous connection - In a synchronous connection, the transmitter and receiver are paced by the same clock. The receiver continuously receives (even when no bits are transmitted) the information at the same rate the transmitter send it. This is why the transmitter and receiver are placed at the same speed. In addition, supplementary information is inserted to guarantee that there are no errors during transmission. During synchronous transmission, the bits are sent successively with no separation between each character, so it is necessary to insert synchronization elements; this is called character-level synchronization.

The main disadvantage of synchronous transmission is recognising the data at the receiver, as there may be differences between the transmitter and receiver clocks. That is why each data transmission must be sustained long enough for the receiver to distinguish it. As a result, the transmission speed can not be very high in a synchronous link.

SBUF Register

SBUF is an 8-bit register used solely for serial communication. For a byte data to be transferred via the TxD line, it must be placed in the SBUF register. The moment a byte is written into SBUF, it is framed with the start and stop bits and transferred serially via the TxD line. SBUF holds the byte of data when it is received by 8051 RxD line.When the bits are received serially via RxD, the 8051 deframes it by eliminating the stop and start bits, making a byte out of the data received.

Kickstart Your Career

Get certified by completing the course

Get Started