Wednesday, 12 July 2017

How do Electronic Systems Communicate ?

One of the many things that get thrown upon you while learning about embedded systems is communication protocols.  Now unlike humans, computers are dumb (always remember that!). The way we convey messages by speaking, writing and even gestures is intrinsic and is often taken for granted. On the other hand machines have to be given a complete set of instructions about how to talk. They have to be told what to say and when to speak. But, before talking about I must first digress to something more basic.



Computers only work on the basis of 0’s and 1’s. Where a ‘0’ means ‘OFF’ and a ‘1’ means ‘ON’. But, what do they turn ON and OFF? All microcontrollers have I/O PORTS which as you can see are used for providing output and to receive input signals. Each PORT generally consists of 8 pins which are connected to internal transistors-acting as switches, these can be turned ON and OFF like a switch. In software terms each PORT is of 1 Byte where each bit is individually addressable. We use 0’s and 1’s to switch these pins ON and OFF to control various devices like LEDs and Motors.

Now consider that we want to display certain text on an LCD. Say we want to display ‘ABCD’. But, computers have no intrinsic way of knowing how to display or write these letters. To a computer A-B-C-D are just names of certain values which are designated using a certain code. For example ‘A’ is the name of the value ‘65’ in ASCII code which is 01000001 in binary that is in terms of 0’s and 1’s. Each LCD module has 4 pins called data lines through which the message to be displayed is transferred. So the binary code 0100-0001 is sent 4 bits at a time. Now this was pretty easy up till now. We give a message to our microcontroller, which is converted to binary and sent across data lines to the LCD module which also has a microcontroller on its side. This controller converts the binary back to English and displays it. At this point I would like to return back to the point where I said computers are dumb. And here are some issues which strengthen my case.

1. The LCD Module doesn’t know when the message starts and when does it end.

2. The microcontroller and the LCD may be operating at different clock speeds, someone has to tell them that and make them agree on a common clock speed.

3. Messages are transmitted across wires, in the form of currents and voltages. Each 0 and 1 represents a voltage. What value voltage will that be?

4. What if an error creeps into the message? Because believe me the LCD will display it.

5. What if the LCD wants to send a message back across the data lines? Which fortunately it doesn’t, but say some other similar device wants to reply. They might end up talking at the same time and distort each other’s messages.

To help computers jump these and other hurdles, engineers developed protocols or rules. There are many such protocols like Serial Communication, SPI-Serial Peripheral Interface, I2C, USB, Ethernet and many more. In the coming articles I will not discuss them in detail, because it has been done. You will find excellent links below to study about them. In the next article I will discuss about a relatively unknown standard because it is not used in commercial systems. This standard is the MIL-STD-1553 a communication protocol used to connect electronic devices in planes, tanks and even spaceships. Using this as an example I will explain how various standards are created.

Until next time,

Abhijeet Dutt Srivastava   

P.S Here are the links

No comments:

Post a Comment