Presentation is loading. Please wait.

Presentation is loading. Please wait.

TECHKRITI LECTURE SERIES Communication BY: Ashutosh Kumar.

Similar presentations


Presentation on theme: "TECHKRITI LECTURE SERIES Communication BY: Ashutosh Kumar."— Presentation transcript:

1 TECHKRITI LECTURE SERIES Communication BY: Ashutosh Kumar

2 C OMMUNICATION

3 S COPE OF C OMMUNICATION Telephones and Cell Phones

4 S COPE OF C OMMUNICATION Internet

5 Wireless networks S COPE OF C OMMUNICATION

6 Satellite Networks

7 E SSENTIALS OF C OMMUNICATION But this simple model requires many guarantees. Sender Receiver Communication Link Data

8 G UARANTEES IN C OMMUNICATIONS 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.

9 P ROTOCOLS IN C OMMUNICATION The standard rules that defines the parameters of communications and ensures these guarantees are called protocol.

10 A DVANTAGES OF P ROTOCOLS Standardized, so interoperability is ensured. Usually include error-detection and error- correction mechanisms. Are available as implemented chips that can be directly used.

11 T YPES OF P ROTOCOLS There are different ways of categorizing protocols First Categorization : Second Categorization : Serial Mode Transfer Parallel Mode Transfer Synchronous Mode Transfer Asynchronous Mode Transfer

12 S ERIAL AND P ARALLEL M ODE SENDER RECIEVER SERIAL MODE PARALLEL MODE

13 S ERIAL V S P ARALLEL M ODE Parameter Reliability Speed Power Cost Complexity Range Serial Mode Parallel Mode ReliableUnreliable SlowFast LowHigh HighLow LongShort Serialiser/Deserialiser

14 S YNCHRONOUS AND A SYNCHRONOUS M ODE Pertains to sender-receiver synchronization. Sender sends data at a certain speed. For flexibility, protocols allow for multiple speeds.

15 N EED OF S YNCHRONIZATION SENDER T RECEIVER T/ Suppose Sender sends data with a Time Period of T What if Receiver doesnt know the speed and assume it to be say T/2 The Data received will be

16 S YNCHRONOUS M ODE 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 SENDER CLOCK RECIEVER

17 A SYNCHRONOUS M ODE 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'.

18 S YNCHRONOUS V S A SYNCHRONOUS M ODE Parameter Reliability Cost Complexity Synchronous Asynchronous Reliable Error Prone Expensive Inexpensive Complicated Simple

19 T RANSMISSION M ODES SENDERRECIEVER Simplex Only one way transmission takes place

20 T RANSMISSION M ODES SENDERRECIEVER Half-Duplex Two way transmission takes place but only one end can communicate at a time

21 T RANSMISSION M ODES SENDERRECIEVER Full-Duplex Two way transmission takes place and both end can communicate simultaneously

22 WIRED

23 WIRELESS

24 S ERIAL C OMMUNICATION

25 POPULAR SERIAL COMMUNICATION STANDARDS RS-232 (using UART) Serial peripheral interface (SPI) System management bus (SMBus) Serial ATA (SATA) UART: Universal asynchronous receiver/transmitter

26 A SYNCHRONOUS S ERIAL C OMMUNICATION T ERMS Start bitindicates the beginning of the data word Stop bitindicates the end of the data word Parity bitadded for error detection (optional) Data bitsthe actual data to be transmitted Baud ratethe bit rate of the serial port Throughputactual data transmitted per sec (total bits transmitted-overhead) Example: baud = bits/sec If using 8-bit data, 1 start, 1 stop, and no parity bits, the effective throughput is: * 8 / 10 = bits/sec

27 A SYNCHRONOUS S ERIAL C OMMUNICATION 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

28 C ONNECTIONS Device1 RX TX GND TX Device2 RX GND

29 ERROR DETECTION Parity bit is HIGH when number of 1s in the Data is odd. Respectively, it is LOW when number of 1s in the Data is even

30

31 CODING Two simple commands : putchar(char); sends 8-bit characters through UART getchar(); receives 8-bit characters via UART

32 W HERE TO C ODE

33 T RANSMITTER C ODE

34 RECIEVER CODE

35 A NY QUESTIONS THIS FAR ?

36 WHAT IS A X-BEE XBee is the brand name from Digi International for a family of form factor compatible radio modules.Digi International

37 H OW DOES THE XB EE 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).

38 H OW TO CONFIGURE XB EE USING X-CTU? XCTU is a small utility program written by Digi/Maxstream. You can download this utility from the Digi website, under Supports/Drivers.www.Digi.com Download the latest drivers onto you PC.

39

40 H OW TO PROGRAM A XB EE 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.

41 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.

42

43 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

44

45 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.

46 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 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.

47

48 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 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.

49

50 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.

51 SPI – S ERIAL P ERIPHERAL I NTERFACE

52 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.

53 SPI In SPI, the sender and receiver follows a master- slave 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??

54 SPI S CHEMATICS : S INGLE S LAVE

55 SPI P INS 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 pins value is set as LOW.

56 SPI S CHEMATICS : S INGLE S LAVE 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.

57 SPI S CHEMATICS : M ULTIPLE S LAVES

58 D ATA T RANSFER IN SPI M0 M1 M2 M3 M4 M5 M6 M7 S0 S1 S2 S3 S4 S5 S6 S7 MASTE R SLAVE MOSIMISO

59 D ATA T RANSFER IN SPI M1 M2 M3 M4 M5 M6 M7 S0 S1 S2 S3 S4 S5 S6 S7 M0 MASTE R SLAVE MOSIMISO

60 D ATA T RANSFER IN SPI M2 M3 M4 M5 M6 M7 S0 S1 S2 S3 S4 S5 S6 S7 M0 M1 MASTE R SLAVE MOSIMISO

61 D ATA T RANSFER IN SPI S0 S1 S2 S3 S4 S5 S6 S7 M0 M1 M2 M3 M4 M5 M6 M7 MASTE R SLAVE MOSIMISO

62 SPI IN A TMEGA 8

63 SPI C ODING

64 S IMPLE SPI C ODE 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.

65 M ASTER C ODE DDRB = 0b ; // configure SPI Master Pins ISR(INT0_vect) { // External Interrupt 0 data = SPITransmit(0x01); // when switch is pushed // send data }

66 S LAVE C ODE DDRB = 0b ; // 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 }

67 A NY QUESTIONS LEFT ?

68 C ONTACT D ETAILS Ashutosh Kumar 261,hall-III


Download ppt "TECHKRITI LECTURE SERIES Communication BY: Ashutosh Kumar."

Similar presentations


Ads by Google