microcontroller - COMMUNICATIONS

Micro controller Communication means, communicating the internal data or status of a micro controller to external world through its pins as voltage or reading the voltage from its external pins and saving it its registers for further processing as per its program.  The communication happens so many ways with micro-controller.  We will discuss the concepts of micro controller communication one-by-one.

All the Communcation process, values and direction is dependent on the bit(s) set in the related registers of the micro-controller.  These bit(s) may be varied by the program code as per your requirement.

Analog Communication:


In micro controllers, using Analog comminication is limited.  But, the human world works on analog values,  the micro controllers are provided with ADC (Analog to Digital Converter) and DAC (Digital to Analog Converter) features. 

The ADC converts the analog value (input voltage) to suiable digital form and saves in its registers for further processing as per the program.

The DAC converts the digital value set in its register to suiable analog value (output voltage) for further external equipment control or display.

The processing and features about ADC/DAC are discussed seperately and press here for ADC/DAC concepts.

Digital Communication :

The digital communication mainly works on logic 0 and logic 1 as either input or output.  Normally voltage level towards ground level or zero volts is considered as Logic 0.  Where as for Logic 1, voltage towards 5VDC as TTL (Transistor Transistor Logic) or some times 3.3V  or Vcc are considered for most of the micro controllers.

One or multi bit Status: The highly used coomunication is one or more bit(s) status input or output.  This is achieved by setting the required bits in the data direction register(s).  By setting 1 or 0 in the data direction register, the pins connected to the register, reads input logic from the specified pin or sends output logic to the specified pin.  Generally, any pin may be programmed as input or output pin, except for special purpose pins indicated in the data sheet(s).

This communication is useful to read one or more button status or status from other electronic equipment or drive one or more LEDs or any other digital devices like displays etc.


Parallel Data Communication : The parallel communication is reading or writing a number of data bits simultaneously.  Normally, EIGHT number of bits (named as BYTE, identified using ASCII) are used for transmission.  Normally, a clock pulse is also sent with the 8 bit data to validate the data on transmission.

Serial Data Communication: 


Serial Communication is highly used in micro-controller projects.  The main advantage with Serial Communication is, it uses less number of conductors (wires) for data transmission when compared to parallel data communication and long distance data transmission is also possible with serial communication.

The main disadvantage with the serial communication is all the data bits has to be transmitted through single wire sequentially, which takes much time compared to parallel data transmission.

Univeral Serial Data Communication: 


USART (Universal Synchronuous Asynchronous Receiver and Transmitter) or UART (Universal Asynchronous Receiver and Transmitter) are common and Universal serial data communication method used in most of the micro-controllers.

The parallel data is converted to serial bits and transmitted through Transmitter pin or the serial data is received from Receiver pin and converted to parallel data in USART/UART communication.

In synchronous method, a clock is generated by the master processor and slave(s) transimit or receive the serial data using the clock.  Where as in Asynchronous method, all the processors generate their own clock matching to same frequency and data is transmitted and received using their clock frequency by eliminating the transimission of clock connection to all the processors.

The registers in the micro-controllers may be set for Full-Duplex (Transmit or Receive simultaneously) or Half-Duplex ( Only Transmit or Receive at-a-time) or Simplex (Uni-direction, either Transmit or Receive) as per the requirement and feature(s) supported by the micro-controller.

The USART/UART communication is normally used to connect to PC (personal Computer) through COM port using Voltage level managing board as interface.

SPI  Communication: 

SPI (Serial Peripheral Interface) uses three wires for communication (MOSI MISO and SCK).

The data direction will be controlled by the master processor, which also generates clock pulses for accuracy of communication. The slave processor on the other hand communcates with the master synchronising the clock from the master.  This is a full-duplex (two way) stable communication.

MOSI = Master Out Slave In, means data is transferred from master to slave processor.

MISO = Master In Slave Out, means data is transferred from slave to master processor.

SCK = Serial Clock, is generated by the master processor for stable and accurate communication

SS = Slave Select, the slave select pin for selecting as master or slave using hardware or software. A single master processor may be connected to multiple slaves and control them selecting the SS pin of slave processor.

Two Wire  Communication: 

Most of the micro controllers support the Two Wire communication, which is well known as Inter Integrated Circuit  or TWI or IIC or I2C (pronouced as I squared C) communication.  Only two wires (SDA and SCK) are used for communication with multiple devices like micro-controllers, sensors , EEPROMs,  ADC ICs, DAC ICs and other ICs which support IIC.  

All the devices will be connected to the same bus (two wires) and identified by their IDs marked inside the chip by hardware or software.  A standard protocal will be followed to access / communicate with each device using master and slave concept.

The ICs marked as slave works as slave only, where as other ICs and micro-controllers may work as either master or slave as per its programming. 

Univeral Serial Bus (USB)  Communication: 

Some micro-controllers support USB communcation, which is very useful for data transfer or data backup from / to devices like pen-drives and connecting external gadgets like keyboard/mouse etc. 

Four wires are used from USB connection. Two wires are for power supply (+5V and Ground) and Two wires for Data transmission (D+ and D-).  So, the micro controller which supports USB marked with D+ and D- pins.

Various data transmission speeds are available, for USB data transfer, depending on the versions.  They are Low speed 1.5Mbps or Full speed 12Mbps in USB version 1; High speed 480 Mbps in USB version 2; more than 4.8 Mbps and upto 6Mbps in USB version 3.

Most of the micro-controllers support USB version 1 speeds only which are useful HID ( Human Interfac Devices ) interfacing, like keyboard, mouse, sensors etc.

All the USB devices uses standand individual protocols.  The micro-controller used in a project has to support and communicate with the devices using the proper protocols.


The type of communication is used based on the requirement , speed and type of interface avaialble on the sensor / device, that is to be controlled or communicated.  The micro-controller has to be selected accordingly.