Thursday 11 August 2016

Communication in Microcontroller

“In this blog we will discussed about wired communication modules in microcontroller, types of communications such as parallel, serial, synchronous or asynchronous communication.”

Main function of communication modules in microcontroller is for interacting with other microcontroller, peripherals, PC or other modules. These communications modules are inbuilt in microcontrollers. Communication protocols are the rules and regulation which both devices follow to communicate with each other. For example if two microcontrollers wants to communicates with UART it requires that both microcontroller should configure for same baud rate, no of stop bits and data bit to be communicated.

Parallel Communication
In parallel communication two devices communicates through several lines by communicating more than one bit at a time. In parallel communication transmitter will uses serial in and parallel out shift registers. The receive data can be directly read through 8-bit GPIO Register.


Parallel communication used for short distance communication. Example of parallel communication can be found in LCD interfacing through microcontroller. Parallel communication requires large numbers of electrical conductors wires and expensive to setup it. In parallel communication number of conductor wires increases as increase in numbers of bits to be transmitted at one time.

Serial Communication
In serial communication two devices communicates through single wire by communicating single bit at a time.  Data bits are transferred sequentially. At transmitter side there will be a parallel in serial out shift register and at receiver there will be serial in parallel out shift register.  In serial communication data is communicated in packet format by adding start and stop bits in the data.


Data is transmitted from one device to another device through single electrical conductor. Serial communication used in long distance communication and less expensive then parallel communication. Examples of serial communications protocol are as UART, USARTSPI, and I2C etc.
If both Serial and parallel channels for 1-byte communication are operated on same clock than Parallel communication speed will be 8 time faster than serial communication.
Serial communication can be Synchronous or Asynchronous.

Synchronous communication
In Synchronous communication transmitter and receiver work on the same clock signal.  This clock signal is provided by the master device who initiates the communication.  Receiver will detect the data according to timing of clock signal. Data transfer rate in Synchronous communication is faster as compare to asynchronous communication.


In synchronous communication there will be one master device and all devices are slave device. To start communication master will first generate start communication frame. In synchronous communication all the slave devices are addressed or selected through control signal from master device. Example of Synchronous communication protocols are SPI and I2C.

Asynchronous Communication
In asynchronous communication there is common clock signal between transmitter and receiver. To start communication it is required that sender and receiver should be configured on the same communication parameters such and data communication speed etc. In asynchronous communication bits are grouped together and control bit such as Start and stop bit also added with data to be transfer. To properly receives data receiver will oversampling the data.


Asynchronous communication is slow due to increase in extra control bit with every byte of data. If we are transmitting 8 bit data with two control bit start and stop bits than there will be 25% overhead.  Example of asynchronous communication is UART.




Continued...........

No comments:

Post a Comment