What is meant by communication in Microcontroller?
So, communication in an exchange of data between two devices. So, when we need to transfer an information from one device to another, we have to establish a communication between two devices.
What are Communication Protocols?
Now that we know about communication and the need of it, next thing we need is the set of rules so that we can transfer the data following the certain rules also known as “protocols”. So, there are various protocols we can follow in order to communicate.
Types of Communication –
One way to categorize communication is that there are two types of communication-Parallel and Serial communication. In parallel communication, information is sent by conveying multiple bits of data simultaneously while in serial communication, information is sent – “bit-by-bit”. So, naturally, parallel communication is way faster than the serial communication. Also, it is easier to program. But there is a catch!
It requires more transmission channel than serial communication which increases the cost of transmission. Another thing is- it’s going to consume a lot of bandwidth to transmit the data.
In this article, we will look at the communication protocols in Serial Transmission.
Terminologies in Serial Communication
- Simplex Communication- The information can only be transmitted via the transmitter to the receiver and not the other way. That is- information is flowing one way only.
- Half Duplex- It means that information is conveyed in one direction at a time. i.e. either from master to slave or from slave to master but not both.
- Full Duplex- Information is two way. The information can be transferred from transmitter to receiver and from receiver to transmission at the same time.
- Baud Rate – It is most commonly referred to as the number of bits per second.
Importance of Baudrate
For the communication between two microcontrollers, we need to match the baudrate between them otherwise communication will not occur. When we set the baudrate, we direct the microcontroller to receive the data at a particular speed. So, if the speed of transmission is different between two, there will not be a communication.
USART and UART Serial communication
It uses two wires-one is for transmission and another is for the reception of data. Atmega16/32 has one pair of these pins. You can use them for sending the data between two microcontrollers, or from the microcontroller to computer.
UART stands for Universal Asynchronous Receiver Transmitter, whereas USART stands for Universal Synchronous Asynchronous Receiver Transmitter
The difference between these two is USART supports synchronous(data is synchronized with clock) as well as asynchronous(Data is not synchronized)mode of communication while UART supports only Asynchronous.
Communication Protocols in Serial Communication
- SPI- Serial Peripheral Interface: It can be a three wire or four wire protocol(fourth wire is Slave Select). One wire each is for the master to slave and vice versa. The third wire is for clock pulses.
- I2C- Inter-Integrated Circuit- It is an advanced form of USART. It is two wire communication. The first wire is for clock and the second wire is for data which is bi-directional. It is comparatively new protocol invented by Phillips. There is one master and can be one or multiple slaves. Each slave has its own unique address through which the master communicates to the particular slave. Also, it’s much faster than UART communication.
- Ethernet– It is used in LAN cable and has 8 wires (4 pairs of Rx and Tx).
- USB- Universal Serial bus- Most popular of them all. It has 4 lines-Vcc, Ground, and data lines.
- RS-232 – Recommended Standard 232- RS232 is a standard protocol used for serial communication, it is used for connecting computer and its peripheral devices to allow serial data exchange between them. As it obtains the voltage for the path used for the data exchange between the devices. It is used in serial communication up to 50 feet with the rate of 1.492kbps. As EIA defines, the RS232 is used for connecting Data Transmission Equipment (DTE) and Data Communication Equipment (DCE).
That’s it for this article, in the coming post we are going to implement some of these communication protocols into our very own Atmega 16. If you have any query or questions or feedback, you can comment below.