Communication

Report
TECHKRITI LECTURE SERIES
Communication
BY:
Ashutosh Kumar
COMMUNICATION
SCOPE OF COMMUNICATION
Telephones and Cell Phones
SCOPE OF COMMUNICATION
Internet
SCOPE OF COMMUNICATION
Wireless
networks
SCOPE OF COMMUNICATION
Satellite Networks
ESSENTIALS OF COMMUNICATION
Communication Link
Sender
Data
Receiver
But this simple model requires many guarantees.
GUARANTEES IN COMMUNICATIONS
The communication link exists.
 The communication link is sound.
 The sender and receiver are the correct nodes.
 The sender is sending the correct data.
 The receiver is able to correctly interpret the
incoming data.

PROTOCOLS IN COMMUNICATION

The standard rules that defines the parameters
of communications and ensures these guarantees
are called protocol.
ADVANTAGES OF PROTOCOLS
Standardized, so interoperability is ensured.
 Usually include error-detection and errorcorrection mechanisms.
 Are available as implemented chips that can be
directly used.

TYPES OF PROTOCOLS
There are different ways of categorizing
protocols
 First Categorization :

Serial Mode
Transfer

Parallel Mode
Transfer
Second Categorization :
Synchronous
Mode Transfer
Asynchronous
Mode Transfer
SERIAL AND PARALLEL MODE
SENDER
PARALLEL MODE
SERIAL MODE
RECIEVER
SERIAL VS PARALLEL MODE
Parameter
Reliability
Speed
Power
Cost
Complexity
Range
Serial Mode
Parallel Mode
Reliable
Slow
Low
Low
High
Long
Serialiser/Deserialiser
Unreliable
Fast
High
High
Low
Short
SYNCHRONOUS AND ASYNCHRONOUS
MODE
Pertains to sender-receiver synchronization.
 Sender sends data at a certain speed. For
flexibility, protocols allow for multiple speeds.

NEED OF SYNCHRONIZATION
T/2
T
RECEIVER
SENDER
1
1
1
1 1 1
0 0 0
111
000
11 1
000
Suppose Sender sends data with a Time Period of T
What if Receiver doesn’t know the speed and assume it to be say T/2
The Data received will be
SYNCHRONOUS MODE

Sender sends a clock signal along with data at every
rising / falling edge of the clock, the data value is read
by the receiver.
SENDER
0
1
0
1
SENDER CLOCK
0
RECIEVER
1
1
0
ASYNCHRONOUS MODE
There is no clock signal.
 The receiver and the sender communicate at a
predetermined speed (bauds or bits per second).
 Baud Rate : Baud Rate is a measurement of
transmission speed in asynchronous
communication.

The devices that allows communication must all
agree on a single speed of information
'bits per second'.
SYNCHRONOUS VS ASYNCHRONOUS MODE
Parameter
Reliability
Cost
Complexity
Synchronous
Reliable
Expensive
Complicated
Asynchronous
Error Prone
Inexpensive
Simple
TRANSMISSION MODES
SENDER
RECIEVER
Simplex
Only one way transmission takes place
TRANSMISSION MODES
SENDER
RECIEVER
Half-Duplex
Two way transmission takes place but only
one end can communicate at a time
TRANSMISSION MODES
SENDER
RECIEVER
Full-Duplex
Two way transmission takes place and both
end can communicate simultaneously
WIRED
WIRELESS
SERIAL COMMUNICATION
POPULAR SERIAL COMMUNICATION
STANDARDS
RS-232 (using UART)
Serial peripheral interface (SPI)
System management bus (SMBus)
Serial ATA (SATA)
UART: Universal asynchronous
receiver/transmitter
ASYNCHRONOUS SERIAL COMMUNICATION
TERMS








Start bit—indicates the beginning of the data
word
Stop bit—indicates the end of the data word
Parity bit—added for error detection (optional)
Data bits—the actual data to be transmitted
Baud rate—the bit rate of the serial port
Throughput—actual data transmitted per sec
(total bits transmitted-overhead)
Example: 115200 baud = 115200 bits/sec
If using 8-bit data, 1 start, 1 stop, and no parity
bits, the effective throughput is:
115200 * 8 / 10 = 92160 bits/sec
ASYNCHRONOUS SERIAL COMMUNICATION



Serial communication implies sending data bit by bit
over a single wire
Asynchronous transmission is easy to implement but less
efficient as it requires an extra 2-3 control bits for every 8
data bits.
This method is usually used for low volume transmission
CONNECTIONS
Device1
RX
TX
GND
TX
Device2
RX
GND
ERROR DETECTION
•Parity bit is HIGH when number of 1’s in the
Data is odd.
 •Respectively, it is LOW when number of 1’s in
the Data is even

CODING
Two simple commands :
 putchar(char);
sends 8-bit characters through UART
 getchar();
receives 8-bit characters via UART
WHERE TO CODE
TRANSMITTER CODE
RECIEVER CODE
ANY QUESTIONS THIS FAR?
WHAT IS A X-BEE
XBee is the brand name from Digi International
for a family of form factor compatible radio
modules.
HOW DOES THE XBEE WORK / HOW TO
CONTROL IT?
Every XBee works as a wireless serial connection (or network) and can be used like a normal COM port.
 You can easily hook up the XBee to a laptop or an
arduino and you can send and receive data over long
range. In fact, the only thing you need to do is connect
power and connect one wire to the XBee for data
receive or data send (or two if you want both).

HOW TO CONFIGURE XBEE USING
X-CTU?
XCTU is a small utility program written by
Digi/Maxstream.
 You can download this utility from the Digi
website, www.Digi.com , under Supports/Drivers.
 Download the latest drivers onto you PC.

HOW TO PROGRAM A XBEE
Connect the Xbee to the usb wireless module or
the breakout board or Xbee Explorer.
 Connect the board to the PC/laptop.
 Open X-CTU.
 And select PC Settings Tab from the Tabs Menu
on the top of the page.

QUERY
1. Select USB COMM. Port to the value of A-B Cable,
display in the Device Manager setting.
2. Set the setting to the values of A-B Cable.
3. Click the Test/Query button
4. If the Com test / Query Modem dialogue appear with an
error message: Check if you have set the baud rate,
flow control, data bits, parity and stops bits in the
dialogue same as the Cable settings.
5. If everything goes well, you will see the dialogue
displayed as in step 4 in the picture below. You should
take note of the firmware version displayed in the
dialogue. This is important for upgrading your firmware
later. Then click OK.
Now, let's move on to do the configuration on
the XBee.
1. Select the Modem Configuration Tab on the Main
Tab Menu.
2. Click Read button, if this is your first time running
the XCTU software, you will see the Question dialogue
appear, and it asks if you want to update the
configuration files, which is recommended.
3. If you click Yes button, You will see the Get new
versions dialogue pop up
1. Then click the Web/file button. XCTU
will start loading all the available
firmware to your PC.
2. When XCTU is done with uploading,
click the Done button. The Update
Summary dialogue will pop up,
displaying all the firmware for the
XBee module.
3. Click OK.
Baud Rate
1. With the Modem Configuration Tab Menu still
selected,
2. click the Read button again. You will see all the
current settings show up in the display area.
3. Scroll down to find Serial Interfacing folder.
4. Change the baudrate to 57600 bit/s. (This is the
prefered value we are using .You can use any value
you like.)
5. Click the Write button, (the one next to Read
button), to save the setting.
PAN ID
• To set the PAN ID or Personnal Area Network ID, which
is the unique number to assign to XBee so XBee can talk
to the right Xbee in the same Network Area.
• For example, if you are building a robot, and using only
two XBees to communicate to each other, and you may
want to avoid others that also using XBees for
communication to be in the same Network Area.
• You can specify any number from 0000 to FFFF for your
PANID. The factory PANID default value is 3332.
1. Still select the Modem Configuration Tab,
2. scroll up to the top of display area,
3. Click at the PAN ID to change the value.
4. Then click the Write button again to save the
PAN ID setting to the XBee flash memory.
Ready to use
• Now, you are set, the XBee modem is ready to
use.
• If you have another XBee, you can repeat the
steps to configure the modem.
• You are now ready to move to the next step for
upgrading the firmware.
• In case, you want to update your XBee firmware
without using the XCTU utility program, you
can use the Terminal program to do that as
well.
SPI – SERIAL PERIPHERAL INTERFACE
SPI
Serial ??
 Because it works on serial mode of transfer. It is
also synchronous and full duplex.
 Peripheral Interface.
 Because it has the capability of communicate
with many nodes.
 How?? Let us see.

SPI
In SPI, the sender and receiver follows a masterslave relationship.
 There may be multiple nodes in the network.
 One node is master, the rest are slaves.
 The communication is always initiated by the
master.
 The slaves can communicate only with the
master.
 How do master selects the slave??

SPI SCHEMATICS: SINGLE SLAVE
SPI PINS
CLK is generated by Master and is used as the
mode is synchronous.
 MOSI is Master Out Slave In: Data sent by
Master to Slave.
 MISO is Master In Slave Out: Data sent by
Slave to Master.
 S̅S̅ is slave select: Slave communicates with
Master only if this pin’s value is set as LOW.

SPI SCHEMATICS: SINGLE SLAVE
Note one thing, if you use a single slave, you could save yourself a pin by
hooking up the SS pin on the slave to GND and the SS on the master to VCC.
SPI SCHEMATICS: MULTIPLE SLAVES
DATA TRANSFER IN SPI
M0
MASTE
R
MOSI
MISO
S0
M1
S1
M2
S2
M3
S3
M4
S4
M5
S5
M6
S6
M7
S7
SLAVE
DATA TRANSFER IN SPI
M1
MASTE
R
MOSI
MISO
S1
M2
S2
M3
S3
M4
S4
M5
S5
M6
S6
M7
S7
S0
M0
SLAVE
DATA TRANSFER IN SPI
M2
MASTE
R
MOSI
MISO
S2
M3
S3
M4
S4
M5
S5
M6
S6
M7
S7
S0
M0
S1
M1
SLAVE
DATA TRANSFER IN SPI
S0
MASTE
R
MOSI
MISO
M0
S1
M1
S2
M2
S3
M3
S4
M4
S5
M5
S6
M6
S7
M7
SLAVE
SPI IN ATMEGA 8
SPI CODING
SIMPLE SPI CODE
char data = SPITransmit(‘a’);
In case of master, the data is written on the
register and send to the slave.
In case of slave the data is written on the register
and it waits for the master to transmit the data,
when it also transmits its own data.
MASTER CODE
DDRB = 0b10110000; // configure SPI Master Pins
ISR(INT0_vect)
{
// External Interrupt 0
data = SPITransmit(0x01); // when switch is
pushed
// send data
}
SLAVE CODE
DDRB = 0b10000000; // configure SPI Slave Pins
ISR(SPI_STC_vect)
{
// SPI Transceiver Interrupt
data = SPDR ; // read the data
if(data == 0x01){
PORTA = ~PORTA; // if data is correct toggle
Led
}
}
ANY QUESTIONS LEFT?
CONTACT DETAILS
Ashutosh Kumar
[email protected]
261,hall-III
9005907695

similar documents