DMC Lab Manual
DMC Lab Manual
Lab Manual
Data and Mobile Communication
Second Year B. Tech.
Computer Science & Engineering
Trimester-V
2018
MITWPU, PUNE
COURSE STRUCTURE
Text Books:
1. Behrouz A. Forouzan, “Data Communications and Networking”, 5th Edition, McGraw-
Hill Publications.
2. Jochen H. Schiller, "Mobile Communications", 2nd Edition, Pearson Education.
Reference Books:
1. William Stallings, "Data and Computer Communications", 6th Edition, Prentice Hall
of India Pvt.
2. William C. Y. Lee, " Mobile Cellular Telecommunications: Analog and Digital
Systems", 2nd Edition, McGraw- Hill Publications.
Supplementary Readings:
1. Prakash C. Gupta, “Data Communication and Computer Network”, PHI, 4th Edition.
Web Resources:
E-books
Web links:
http://www.linktionary.com/re/datacomm.html
MOOCs:
http://nptel.ac.in/courses/106105082/
https://www.coursera.org/learn/data-communication-network-services
Pedagogy:
Power Point Presentation
White-board and Pen
Smart Board and Audio and Video aids
Assessment Scheme:
Class Continuous Assessment (CCA)- 50 Marks
60% - - - - 40%
Digital Transmission
Digital Transmission: Digital-to-Digital conversion (line coding, block
2 coding, scrambling), Analog-to-Digital conversion (Pulse Code Modulation, 7
Delta Modulation), Multiplexing techniques: Frequency Division
Multiplexing, Time Division Multiplexing, Network Model, Networking
Devices
Workload
Module in Hrs
Title of Assignment
No.
Lab
LAN setup
Modulation Technique
2 02
Analyze and test Amplitude / Frequency Modulation Technique.
PCM modulation
3 02
Analyze and test PCM modulation technique.
Error detection and correction
4 Write a program for error detection and correction codes using 04
Hamming Codes/CRC.
Sliding window protocol
5 04
Write a program to implement sliding window protocol.
Line coding techniques
6 02
Analyze and test different line coding techniques.
PC to PC communication
7 02
Study PC to PC communication using RS232 or USB.
LABORATORY PLANNER
Sr. No. Title of Assignment Weeks
LAN setup
Establish wired/wireless network using: UTP Cable, Crimping Tool, 1st
1
Week
Connectors etc.
Modulation Technique
2 2nd Week
Analyze and test Amplitude / Frequency Modulation Technique.
PCM modulation
3 3rd Week
Analyze and test PCM modulation technique.
Error detection and correction
Write a program for error detection and correction codes using 4th -5th
4
Week
Hamming Codes/CRC.
Sliding window protocol
6th -7th
5
Write a program to implement sliding window protocol. Week
Line coding techniques
6 8th Week
Analyze and test different line coding techniques.
PC to PC communication
7 9th Week
Study PC to PC communication using RS232 or USB.
Establish wired/wireless network using: UTP Cable, Crimping Tool, Connectors etc.
Date:
Remark:
ASSIGNMENT NO: 1
Aim:
To establish wired / wireless network using: UTP Cable, Crimping Tool, Connectors etc.
Objectives:
1. To get familiar with transmission media and networking tools
2. To study of various LAN topologies and their creation using network devices, cables and
computers
3. To understand the use of crimping tool
Theory:
Introduction to Transmission media
Transmission media is a pathway that carries the information from sender to receiver. We use
different types of cables or waves to transmit data. Data is transmitted normally through
electrical or electromagnetic signals.
An electrical signal is in the form of current. An electromagnetic signal is series of
electromagnetic energy pulses at various frequencies. These signals can be transmitted through
copper wires, optical fibers, atmosphere, water and vacuum Different Medias have different
properties like bandwidth, delay, cost and ease of installation and maintenance. Transmission
media is also called as communication channel.
I. Guided Media:
It is also referred to as Wired or Bounded transmission media. Signals being transmitted are
directed and confined in a narrow pathway by using physical links.
Features:
High Speed
Secure
Used for comparatively shorter distances
Advantages:
Least expensive
Easy to install
High speed capacity
Disadvantages:
Susceptible to external interference
Lower capacity and performance in comparison to STP
Short distance transmission due to attenuation
Advantages:
Better performance at a higher data rate in comparison to UTP
Eliminates crosstalk
Comparatively faster
Disadvantages:
Comparatively difficult to install and manufacture
More expensive
Bulky
Advantages:
High Bandwidth
Better noise Immunity
Easy to install and expand
Inexpensive
Disadvantages:
Single cable failure can disrupt the entire network
Advantages:
Increased capacity and bandwidth
Light weight
Less signal attenuation
Disadvantages:
Difficult to install and maintain
High cost
Fragile
II. Unguided Media:
It is also referred to as Wireless or unbounded transmission media. No physical medium is
required for the transmission of electromagnetic signals.
Features:
(iii) Infrared
Infrared waves are used for very short distance communication. They cannot penetrate through
obstacles. This prevents interference between systems. Frequency Range: 300GHz – 400THz. It
is used in TV remotes, wireless mouse, keyboard, printer, etc.
To create a straight-through cable, you'll have to use either T-568A or T-568B on both
ends of the cable. The diagram depicted on the left and right shows clip of the RJ-45
connector down.
To create a cross-over cable, you'll wire T-568A on one end and T-568B on the other end of
the cable.
The straight-through cables are used when connecting Data Terminating Equipment (DTE) to
Data Communications Equipment (DCE), such as computers and routers to modems (gateways)
or hubs (Ethernet Switches).
The cross-over cables are used when connecting DTE to DTE, or DCE to DCE equipment; such
as computer to computer, computer to router; or gateway to hub connections. The DTE
equipment terminates the signal, while DCE equipment do not.
RJ45 Connector
RJ stands for Registered Jacks. These are used in telephone and data jack wiring registered with
FCC. RJ-11 is a 6-position, 4-conductor jack used in telephone wiring, and RJ-45 is a 8-position,
8-conductor jack used in 10BaseT and 100BaseT Ethernet wiring.
To use this crimping tool, each wire is first placed into the connector. Once all the wires are in
the jack, the connector with wires are placed into the crimping tool, and the handles are squeezed
together. Crimping punctures the plastic connector and holds each of the wires, allowing for data
to be transmitted through the connector.
Switches
A switch, in the context of networking is a high-speed device that receives incoming data packets
and redirects them to their destination on a local area network (LAN). A LAN switch operates at
the data link layer (Layer 2) or the network layer of the OSI Model and, as such it can support all
types of packet protocols. Essentially, switches are the traffic cops of a simple local area
network.
A switch in an Ethernet-based LAN reads incoming TCP/IP data packets/frames containing
destination information as they pass into one or more input ports. The destination information in
the packets is used to determine which output ports will be used to send the data on to its
intended destination. Switches are similar to hubs, only smarter. A hub simply connects all the
nodes on the network -- communication is essentially in a haphazard manner with any device
trying to communicate at any time, resulting in many collisions. A switch, on the other hand,
creates an electronic tunnel between source and destination ports for a split second that no other
traffic can enter. This results in communication without collisions.
Switches are similar to routers as well, but a router has the additional ability to forward packets
between different networks, whereas a switch is limited to node-to-node communication on the
same network
Implementation of Local Area Network with switch
Apparatus:
CAT5 cable, RJ45 connector, crimping tool, Cable tester, Computers etc.
Platform Specifications:
Windows / Linux Operating System
Conclusion:
Hence, we have learned the use of transmission media, RJ45 connector, crimping tool, LAN
tester and established LAN for sharing of files.
FAQs:
1) What types of cables are commonly used in wired LANs?
2) Which connector is used to connect a new device in the bus topology?
3) Explain the structure and applications of twisted pair cable
4) How do I setup a wireless connection?
Assignment No: 2
Title:
Modulation Technique
Date:
Remark:
ASSIGNMENT NO: 2(A)
Aim:
To analyze and test Amplitude Modulation/ Demodulation Technique.
Objectives:
1. To learn amplitude modulation process
2. To compare the modulated signal and the demodulated wave envelope
3. To measure amplitude and frequency of modulating and carrier wave
4. To calculate modulation index and observe its effect on modulated waveform
APPARATUS:
1. Amplitude Modulation & Demodulation trainer kit.
2. CRO / DSO
3. Connecting chords & probes
Theory:
Amplitude modulation is defined as the process in which the amplitude of the carrier wave c(t) is
varied about a mean value, linearly with the baseband signal. An AM wave may thus be
described, in the most general form, as a function of time as follows.
S(t)=Ac{1+Kam(t)}cos(2πfct)
Where
The amplitude of Ka m(t) is always less than unity, that is Ka m(t) <1 for all t.
It ensure that the function 1+Ka m(t) is always positive. When the amplitude sensitivity Ka of
the modulator is large enough to make Ka m(t)>1 for any carrier wave becomes over modulated,
resulting in carrier phase reversal whenever the factor 1+Kam(t) crosses zero. The modulate
wave then exhibits envelope distortion. The absolute maximum value of Ka m(t) multiplied by
100 is referred to as the percentage modulation.
Vmax-Vmin
Or Percentage modulation = ---------------- ×100
Vmax +Vmin
The carrier frequency fc is much greater than the highest frequency component ω of the message
signal m(t),that is fc >>W. Where W is the message bandwidth.
If the condition is not satisfied, and envelope cannot be visualized satisfactorily. The trainer kit
has a carrier generator, which can generate the carrier wave of 100 KHz when the trainer is
switched on.
The circuit’s carrier generator, modulator and demodulator are provided with the built in
supplies, no supply connections are to be given externally.
In case of AM amplitude of high frequency carrier signal varies in accordance with instantaneous
value of low frequency modulating signal.
Thus it contains two side band frequencies fc+fm & fc-fm and bandwidth required twice the
frequency of modulating signal
Pt=V2c/R+V2LSB/R+V2USB/R
=Pc+m2 /2Pc
=Pc(1+m2 /2)
This is total power in the modulated wave. The maximum power in the AM wave is pt=1.5 pc
when m =1.
It shows that 66% power is lost in carrier wave itself. It can be avoided using Double side band
transmission & single side band transmission. In case of double side band transmission carrier is
suppressed before transmission. Waveforms are as shown.
If RC time constant of low pass filter is very low then it gives ripple in output waveform. If RC
time constant of low pass filter is high then it gives slope overload i.e. output cannot track
changes in modulation signal due to time constant & it gives diagonal clipping. In our kit we
have different capacitor & potentiometer to observe all this effect.
PROCEDURE:
1. Switch on the power supply
2. Adjust O/P of carrier generator to 1Vp-p & that modulating signal to 500 mVp-p , 1KHz.
3. Connect carrier output to fc I/P of adder & modulating signal to fm I/P of adder
4. Observe O/P of adder & connect it to I/P of tunned circuit
5. Observe O/P of tunned circuit which is required AM signal. Adjust oscillator coils provided
on panel such that AM O/P is maximum. Also keep pot near to tunned circuit to maximum
position.
6. Connect AM output to input of detector.
7. Keep detector pots to maximum position
8. Observe O/P of diode detector. Adjust amplitude of modulating signal such that detected
O/P is a neat sine wave
9. Observe effect of RC time constant on O/P by varying pot next to diode detector.
10. Observe effect of volume control pot
11. Measure DC voltage at AGC O/P
12. Now vary the amplitude of AM signal using pot next to tunned circuit & observe its effect
on AGC O/P.
CONNECTION DIAGRAM:
For simple diode detector two capacitor C1 and C2 [0.01 uf] & [0.1 uf] respectively, are given
and 10k pot is provided on panel. By varying 10k pot we can vary RC time constant of detector
section and observe its effect on reconstructed O/P at cathode of detector diode.
PROCEDURE
APPLICATIONS:
1. Tele communications.
2. TV Transmitters.
CONCLUSION:
In this way we have analyzed and tested Amplitude Modulation and Demodulation Technique
and observed the effect of modulation index on output waveform
QUESTIONS:
1. Define AM and draw its spectrum?
2. Give the significance of modulation index?
3. Explain how AM wave is detected?
4. Define detection process?
ASSIGNMENT NO: 2 (B)
Aim:
To analyze and test Frequency Modulation / Demodulation Technique.
Objectives:
1. To learn frequency modulation and demodulation process
2. To compare the modulated signal and the demodulated wave envelope
3. To measure amplitude and frequency of modulating and carrier wave
4. To calculate modulation index and observe its effect on modulated waveform
APPARATUS:
1. Frequency Modulation & Demodulation trainer kit.
2. CRO / DSO
3. Connecting chords & probes
Theory:
In case of Frequency Modulation, frequency of high frequency carrier signal varies in
accordance to modulating signal. Frequency modulation has higher noise immunity. In our Kit
FM generator is obtained using function generator IC 8038. Frequency if IC8038 depends on
voltage at pin No.8. Modulating signal is given to pin No. 8 through decoupling capacitor. O/p of
IC 8038 is buffered. For FM demodulation phase lock loop IC 565 is used. Free running
frequency. PPL tracks FM Generator O/p & O/p of phase detector is demodulation signal. This
O/p is filtered using second order low pass filter.
PROCEDURE:
1. Switch on the power supply.
2. Adjust Carrier i. e O/p of IC 8038 to 50 KHz using frequency adjust pot.
3. Adjust free running frequency of PLL 565 to 50 KHz using frequency adjust pot.
4. Connect buffered O/p of IC 8038 to input of PLL.
5. Now slightly vary the frequency of 8038 & observe its effect on O/p of PLL & verify
whether PLL tracks the frequency of 8038.
6. Now connect O/p o signal generator i. e. modulating signal to I/p of 8038. Keep signal gen.
freq. minimum & Amplitude 500mV p-p.
7. Observe FM O/P together with modulating signal on CRO. We cannot observe stable output,
since frequency of FM output changes at every instant. Use spectrum analyzer to study effect
of amplitude modulation index.
8. Observe output of PLL & Connect it to filter & observe filter output.
9. If you are not getting proper o/p slightly adjust PLL Freq. If there is over modulation reduce
the amplitude of modulating signal.
10. Now increase Freq. of modulating signal. At higher Freq. o/p of Receiver (After LPF)
decreases. You can apply amplitude of modulating signal. Why?
In case of FM modulation index depends on freq. of modulating signal. As frequency increases
index decreases. So in practical system pre-emphasis & De-emphasis circuits are used.
If you don’t have spectrum analyzer to calculate modulation index follow the following procedure.
1. Observe the frequency of 8038 buffered O/p & adjust it to 50 KHz using frequency adjust pot
& measure the voltage at the variable Point of potentiometer given on front panel. Say ‘V’.
Now suppose we are going to apply modulating signal of amplitude 1 Vp-p & frequency 1
KHz. Due to this maximum DC voltage at pin 8 of IC 8038 will be V+0.5 & minimum DC
voltage will be V-0.5.
2. Adjust the DC voltage to V+0.5 using pot & measure the Freq. at the O/p of IC 8038 Say F1.
(Note: - We are not actually applying any I/P to IC 8038).
3. Adjust the DC voltage to V+0.5 using pot & measure the Freq. at the O/p of IC 8038 Say F2.
4. Calculate (F2-F1) & maximum deviation from center frequency.
CONNECTION DIAGRAM:
OUTPUT WAVEFORMS
APPLICATIONS:
1. FM Radio Stations
2. Analog VCR systems
3. Sound synthesizer
CONCLUSION:
In this way we have analyzed and tested Frequency Modulation and Demodulation Technique
and observed the effect of modulation index on output waveform
QUESTIONS:
1. Define FM and draw its spectrum?
2. Give the significance of modulation index?
3. Compare AM and FM
4. Note down applications of FM
5. Why stable FM Waveform cannot be observed on normal CRO?
6. What is the advantage of FM over AM?
Assignment No: 3
Title:
PCM modulation
Date:
Remark:
ASSIGNMENT NO: 3
Aim:
To analyze and test Pulse Code Modulation / Demodulation Technique.
Objectives:
1. To demonstrate the Pulse Code Modulation technique
2. To analyze PCM performance with respect to the sampling frequency.
3. To demonstrate Pulse Code Demodulation technique
4. To analyze the reconstructed waveform, compare with selection of different sampling
frequencies.
Theory:
Pulse code modulation is a method that is used to convert an analog signal into a digital signal,
so that modified analog signal can be transmitted through the digital communication network.
PCM is in binary form, so there will be only two possible states high and low (0 and 1). We can
also get back our analog signal by demodulation. The Pulse Code Modulation process is done in
three steps Sampling, Quantization, and Coding.
Sampling is a process of measuring the amplitude of a continuous-time signal at discrete
instants, converts the continuous signal into a discrete signal. For example, conversion of a
sound wave to a sequence of samples. The Sample is a value or set of values at a point in time or
it can be spaced. Sampler extract samples of a continuous signal, it is a subsystem ideal sampler
produces samples which are equivalent to the instantaneous value of the continuous signal at the
specified various points. The Sampling process generates flat- top Pulse Amplitude Modulated
(PAM) signal.
Sampling frequency, Fs>=2*fmax to avoid Aliasing Effect. If the sampling frequency is very
higher than the Nyquist rate it become Oversampling, theoretically a bandwidth limited signal
can be reconstructed if sampled at above the Nyquist rate. If the sampling frequency is less than
the Nyquist rate it will become under- sampling.
Basically two types of techniques are used for the sampling process. Those are 1. Natural
Sampling and 2. Flat- top Sampling.
Quantization
In quantization, an analog sample with an amplitude that converted into a digital sample with an
amplitude that takes one of a specific defined set of quantization values. Quantization is done by
dividing the range of possible values of the analog samples into some different levels, and
assigning the center value of each level to any sample in quantization interval. Quantization
approximates the analog sample values with the nearest quantization values. So almost all the
quantized samples will differ from the original samples by a small amount. That amount is called
as quantization error. The result of this quantization error is we will hear hissing noise when play
a random signal. Converting analog samples into binary numbers that is 0 and 1.
In most of the cases we will use uniform quantizers. Uniform quantization is applicable when the
sample values are in a finite range (Fmin, Fmax). The total data range is divided into 2n levels, let it
be L intervals. They will have an equal length Q. Q is known as Quantization interval or
quantization step size. In uniform quantization there will be no quantization error.
4. Observe point A output from -:- 2 Network and connect it to the point B that is input to
the 8 network.
6. Connect output of second -:- 8 network to start conversion input of ADC 0809 i.e. SC
point on panel
7. Observe SC point and EOC point on panel simultaneously on dual trace oscilloscope and
find out conversion period of A/D. Conversion period: - time between falling edge of SC
and rising edge of EOC.
8. Observe the EOC point and OE point, i.e. output enable pin of 74373 latch
simultaneously on dual trace scope. Also observe RST point and clock point of IC 4040
along with OE.
9. Observe the PCM output point and connect it to the input to receiver i.e. serial input of
shift register 74198
10. Observe CLK of 74198 along with CLK of 4040 on dual trace scope.
11. Observe LE i.e. Latch Enable pin of 74373 latch next to shift register with CLK of 74198
13. First Connect fixed frequency sine wave to input of ADC 0809
14. Observe DAC output. Calculate its frequency and peak to peak amplitude. Observe this
with input fixed frequency sine wave.
15. Connect DAC output to input of filter and observe output of filter.
16. Externally, use variable frequency source and first keep frequency of sine wave
minimum. Observe DAC output along with input sine wave. Now slowly increase
frequency of sine wave to verify Nyquist criteria and to observe aliasing effect.
Precautions:
1. Avoid loose connections on the board.
2. Perform connection by keeping all the devices in Power OFF condition.
Input:
1. Specify the type of signal used with selected sampling frequency.
Observation Table:
Sr. No. Input Signal Sampling Frequency Output Signal
1 Sine wave Nyquist Criteria Appropriate sampling
2 Sine wave Don’t follow Nyquist Criteria Aliasing effect
OUTPUT:
1. Observe and draw reconstructed waveform for various sampling rate.
OUTPUT WAVEFORMS:
CONCLUSION:
Conclude with reference to the observation and readings regarding working of Pulse code
Modulation and demodulation. In case of PCM, system is able to provide reconstructed
waveform when Nyquist criteria is satisfied, otherwise aliasing effect is getting observed.
FAQs:
1) Describe the quantization steps specifying mathematical equations associated with it.
2) Comment on role of Pulse Amplitude Modulation in PCM technique.
3) Draw flat-top sampled waveform for any selected signal.
Assignment No: 4
Title:
Error detection and correction
Write a program for error detection and correction codes using Hamming Codes / CRC
Date:
Remark:
ASSIGNMENT NO: 4
Aim:
To write a program for error detection and correction codes using Hamming Codes / CRC
Objectives:
Theory:
Concept of Error Control:
The purpose of error control is to ensure that the information received by the receiver is
exactly the information transmitted by the sender. As the communication channel is highly
unreliable, the receiver must be able to deal with the received data, if it contains error. The term
error control is defined as the process of identification or correction of error occurred in the
transmitted data. There are two types of error control mechanisms. They are:
Forward error control: Additional redundant information is transmitted along with the useful
data. Hence, the receiver not only detects the error, but also determines the location of the error
in the data. This method is not widely used, because of the number of additional redundant
information (E.g. hamming code).
Feedback or (backward) error control: Along with each character, little additional information
is added only for error detection. The receiver performs no error correction. If the received data
contains error, then the entire data is retransmitted. Hence, the feedback techniques perform error
detection and retransmission (E.g. CRC).
Error Coding:
Error coding is a method of detecting and correcting these errors to ensure information is
transferred intact from its source to its destination. Error coding is used for fault tolerant
computing in computer memory, magnetic and optical data storage media, satellite and deep
space communications, network communications, cellular telephone networks, and almost any
other form of digital data communication. Error coding uses mathematical formulas to encode
data bits at the source into longer bit words for transmission. The "code word" can then be
decoded at the destination to retrieve the information. The extra bits in the code word provide
redundancy that, according to the coding scheme used, will allow the destination to use the
decoding process to determine if the communication medium introduced errors and in some
cases correct them so that the data need not be retransmitted.
Different error coding schemes are chosen depending on the types of errors expected, the
communication medium's expected error rate, and whether or not data retransmission is possible.
Faster processors and better communications technology make more complex coding schemes,
with better error detecting and correcting capabilities, possible for smaller embedded systems,
allowing for more robust communications. However, tradeoffs between bandwidth and coding
overhead, coding complexity and allowable coding delay between transmissions, must be
considered for each application.
There are two basic strategies for dealing with errors. One way is to include enough
redundant information (extra bits are introduced into the data stream at the transmitter on a
regular and logical basis) along with each block of data sent to enable the receiver to deduce
what the transmitted character must have been. The other way is to include only enough
redundancy to allow the receiver to deduce that error has occurred, but not which error has
occurred and the receiver asks for a retransmission. The former strategy uses Error-Correcting
Codes and latter uses Error-detecting Codes.
Types of Errors
Interferences can change the timing and shape of the signal. If the signal is carrying
binary encoded data, such changes can alter the meaning of the data. These errors can be divided
into two types: Single-bit error and Burst error.
Single-bit Error
The term single-bit error means that only one bit of given data unit (such as a byte, character, or
data unit) is changed from 1 to 0 or from 0 to 1 as shown in Following Fig.
Figure 3. Example of even parity when total no of 1’s in original data stream are odd
If transmitted bit stream contains even number of ‘1’s then to keep it even we add parity bit as
‘0’ (Or we simply make it ‘Low’). For. e.g.
Bit stream Parity bit
1 1 1 1 1 0 1 0
S R
Transmission Medium
Figure 4. Example of even parity when total no of 1’s in original data stream are even
Odd Parity
If transmitted bit stream contains even number of ‘1’s then to make it odd we add parity bit as
‘1’ (Or we simply make it ‘High’). For. e.g.
Figure 5. Example of odd parity when total no of 1’s in original data stream are even
If transmitted bit stream contains odd number of ‘1’s then to keep it odd we add parity bit as ‘0’
(Or we simply make it ‘Low’). For. e.g.
Figure 6. Example of odd parity when total no of 1’s in original data stream are odd
Cyclic Redundancy Check:
Cyclic Redundancy Check is the most powerful and easy to implement technique. Unlike
checksum scheme, which is based on addition, CRC is based on binary division. In CRC, a
sequence of redundant bits, called cyclic redundancy check bits, are appended to the end of data
unit so that the resulting data unit becomes exactly divisible by a second, predetermined binary
number. At the destination, the incoming data unit is divided by the same number. If at this step
there is no remainder, the data unit is assumed to be correct and is therefore accepted. A
remainder indicates that the data unit has been damaged in transit and therefore must be rejected.
The generalized technique can be explained as follows.
If a k bit message is to be transmitted, the transmitter generates an r-bit sequence, known as
Frame Check Sequence (FCS) so that the (k+r) bits are actually being transmitted. Now this r-bit
FCS is generated by dividing the original number, appended by r zeros, by a predetermined
number. This number, which is (r+1) bit in length, can also be considered as the coefficients of a
polynomial, called Generator Polynomial. The remainder of this division process generates the r-
bit FCS. On receiving the packet, the receiver divides the (k+r) bit frame by the same
predetermined number and if it produces no remainder, it can be assumed that no error has
occurred during the transmission. Operations at both the sender and receiver end are shown in
following figure.
Example:
Algorithm:
Platform:
64-bit Open source Linux or its derivatives.
Open Source C++ Programming tool like G++ / Eclipse Editor.
Input:
For Encoding: Data bits, generator polynomial (in the form of bit stream).
For Decoding: Valid Code word / Invalid Code word, generator polynomial (in the form of bit
stream).
Output:
Encoding: Remainder of CRC division, Code word (data words + remainder)
Decoding: Remainder of CRC division, Display message (Data Accepted if remainder is Zero,
Otherwise display Data Rejected)
Conclusion:
We have implemented error control Cyclic Redundancy Check protocol for Data Stream
accepted from user along with generator polynomial which will further encode data stream and
generates Code word that to be transmitted. As well we have compared two scenarios of Valid
and Invalid code word received which will further undergo decoding process and gives us
remainder. If remainder is Zero we assume that code word received is correct otherwise not.
FAQs:
1) Why do you need error detection?
2) Explain different types of errors?
3) Explain CRC Algorithm?
Practice Assignments:
1) Obtain CRC code for Message: 11010111 and Generator Polynomial: 101?
2) Obtain CRC code for the Data bit sequence: 00111011001 using the Generator Polynomial:
10101?
Program Code:
/* Program FOR CRC */
#include<stdio.h>
#include<conio.h>
void main()
{
int gen[5],data[14],r[5],dn,gn,i,j,cnt,tra[14],res[14],c=0;
clrscr();
{//data
printf("\n Enter how many data bits:: ");
scanf("%d",&dn);
printf("\n Enter %d data bits:: ",dn);
for(i=0;i<dn;i++)
scanf("%d",&data[i]);
}
{//generator
printf("\n Enter the length of generator polynomial:: ");
scanf("%d",&gn);
printf("\n Enter %d generator bits:: ",gn);
for(i=0;i<gn;i++)
scanf("%d",&gen[i]);
}
{//zero bits
for(i=dn;i<(gn+dn-1);i++)
data[i]=0;
printf("\n After adding zero bits:: ");
for(i=0;i<(gn+dn-1);i++)
printf(" %d ",data[i]);
}
{//selecting bits from data
for(cnt=0;cnt<gn;cnt++)
r[cnt]=data[cnt];
}
{//crc bits
printf("\n\n CRC bits are:: ");
for(i=0;i<gn;i++)
printf(" %d ",r[i]);
}
getch();
clrscr();
//Receiver side:::::::::::::::::::::::::::::::::
{//received data
printf("\n\n Recived data:: ");
for(i=0;i<(gn+dn-1);i++)
scanf("%d",&res[i]);
}
{//selecting bits from received data
for(cnt=0;cnt<gn;cnt++)
r[cnt]=res[cnt];
}
{//calculation of remainder
while(cnt<gn+dn)
{
while(r[0]==0)//shift
{
if(cnt==gn+dn-1)
break;
for(i=0;i<gn-1;i++)
r[i]=r[i+1];
r[gn-1]=res[cnt++];
}
if(r[0]==0)
break;
for(j=0;j<gn;j++)
r[j]=r[j]^gen[j];
}
}
{//crc bits
printf("\n\n CRC bits:: ");
for(i=0;i<gn;i++)
printf(" %d ",r[i]);
}
{//checking remainder
for(i=0;i<gn;i++)
if(r[i]==0)
c++;
if(c==gn)
printf("\n\n correct");
else
printf("\n\n incorrect");
}
getch();
}
Assignment No: 5
Title:
Sliding window protocol
Date:
Remark:
ASSIGNMENT NO: 5
Aim:
To write a program to implement sliding window protocol
Objectives:
1. To realize the significance of flow control
2. To understand the working of sliding window protocol
3. To demonstrate reliable in-order delivery of packets
Theory:
❖ Flow Control
In data communications, flow control is the process of managing the rate of data transmission
between two nodes to prevent a fast sender from overwhelming a slow receiver. It provides a
mechanism for the receiver to control the transmission speed, so that the receiving node is not
overwhelmed with data from transmitting node. Flow control should be distinguished
from congestion control, which is used for controlling the flow of data when congestion has
actually occurred.
Flow control is important because it is possible for a sending computer to transmit information at
a faster rate than the destination computer can receive and process it. This can happen if the
receiving computers have a heavy traffic load in comparison to the sending computer, or if the
receiving computer has less processing power than the sending computer.
Figure 1 depicts the scenario under flow control.
The figure shows that the data-link layer at the sending node tries to push frames toward the
data-link layer at the receiving node. If the receiving node cannot process and deliver the packet
to its network at the same rate that the frames arrive, it becomes overwhelmed with frames. Flow
control in this case can be feedback from the receiving node to the sending node to stop or slow
down pushing frames.
Although flow control can be implemented in several ways, One of the solutions is normally to
use two buffers; one at the sending data-link layer and the other at the receiving data-link layer.
(A buffer is a set of memory locations that can hold packets at the sender and receiver.). The
flow control communication can occur by sending signals from the consumer to the producer.
When the buffer of the receiving data-link layer is full, it informs the sending data-link layer to
stop pushing frames.
In a simple situation, the acknowledgment is sent for flow control. The lack of acknowledgment
means that there is a problem in the sent frame. A frame that carries an acknowledgment is
normally called an ACK to distinguish it from the data frame.
Simple Protocol
The first protocol is a simple protocol with neither flow nor error control. We assume that the
receiver can immediately handle any frame it receives. In other words, the receiver can never be
overwhelmed with incoming frames. Figure 3 shows the layout for this protocol.
1. Lost data: Sender waits for acknowledgement and receiver waits for data for an infinite
amount of time. Figure 5 represents this scenario.
5) If acknowledgement of frame comes in time, the sender transmits the next frame in
queue.
6) If acknowledgement does not come in time, the sender assumes that either the frame or its
acknowledgement is lost in transit. Sender retransmits the frame and starts the timeout
counter.
7) If a negative acknowledgement is received, the sender retransmits the frame. The Figure
7 depicts the working:
The Stop & Wait ARQ may cause big performance issues as sender always waits for
acknowledgement even if it has next packet ready to send. Consider a situation where you have a
high bandwidth connection and propagation delay is also high (you are connected to some server
in some other country though a high speed connection). To solve this problem, we can send more
than one packet at a time with a larger sequence numbers.
So Stop and Wait ARQ may work fine where propagation delay is very less for example LAN
connections, but performs badly for distant connections like satellite connection.
❖ In Networking, Window simply means a buffer which has data frames that needs to be
transmitted.
❖ Both sender and receiver agrees on some window size. If window size=w then after sending
w frames sender waits for the acknowledgement (ack) of the first frame.
❖ As soon as sender receives the acknowledgement of a frame it is replaced by the next frames
to be transmitted by the sender. If receiver sends a collective or cumulative
acknowledgement to sender then it understands that more than one frames are properly
received, for eg:- if ack of frame 3 is received it understands that frame 1 and frame 2 are
received properly. Figure 8 depicts the scenario.
Algorithm:
1. Accept the window size (w) from the user
2. Accept number of frames (f) to transmit from the user
3. for i=1 to f
a. Accept the frames from the user
4. for i=1 to f
a. if (i mod w) ==0
i. print the frames
ii. print “Acknowledgement of above frames sent is received by sender”
b. else print frames
5. End for
6. If (f mod w)!=0
a. print “Acknowledgement of above frames sent is received by sender”
7. End
Platform:
● 64-bit Open source Linux or its derivatives.
● Open Source C++ Programming tool like G++ / Eclipse Editor.
Input:
Window size, number of frames to transmit, frames
Output:
Enter window size: 3
Enter number of frames to transmit: 5
Enter 5 frames: 12 5 89 4 6
With sliding window protocol the frames will be sent in the following manner (assuming no
corruption of frames)
After sending 3 frames at each stage sender waits for acknowledgement sent by the receiver
12 5 89
Acknowledgement of above frames sent is received by sender
46
Acknowledgement of above frames sent is received by sender
Conclusion:
We have implemented sliding window protocol that ensures flow control at data link layer in
networking.
FAQs:
1) What is usage of sequence number in reliable transmission?
2) What is the difference between Stop-and-Wait & Stop-and-Wait Automatic Repeat
Request (ARQ)?
3) How does sliding window protocol overcome the drawback of Stop-and-Wait ARQ?
Sample Code:
#include<stdio.h>
int main()
{
int w,i,f,frames[50];
printf("Enter window size: ");
scanf("%d",&w);
printf("\nEnter number of frames to transmit: ");
scanf("%d",&f);
printf("\nEnter %d frames: ",f);
for(i=1;i<=f;i++)
scanf("%d",&frames[i]);
printf("\nWith sliding window protocol the frames will be sent in the following manner
(assuming no corruption of frames)\n\n");
printf("After sending %d frames at each stage sender waits for acknowledgement sent by the
receiver\n\n",w);
for(i=1;i<=f;i++)
{
if(i%w==0)
{
printf("%d\n", frames[i]);
printf("Acknowledgement of above frames sent is received by sender\n\n");
}
else
printf("%d ",frames[i]);
}
if(f%w!=0)
printf("\n Acknowledgement of above frames sent is received by sender\n");
return 0;
}
Assignment No: 6
Title:
Line coding techniques
Date:
Remark:
ASSIGNMENT NO: 6
AIM:
To Analyze and test different line coding techniques
OBJECTIVES:
1. To learn various line coding schemes
2. To analyze the output signals of line coder / decoder
3. To understand applications of line coding
APPARATUS:
1. Line Coding Scheme Trainer Kit
2. Connecting chords & probes.
THEORY:
There are many reasons for using line coding. Each of the line codes you will be examining
offers one or more of the following advantages:
Spectrum shaping and relocation without modulation or filtering. This is important in telephone
line applications, for example, where the transfer characteristic has heavy attenuation below 300
Hz.
Bit clock recovery can be simplified.
DC component can be eliminated; this allows AC (capacitor or transformer) coupling between
stages (as in telephone lines). Can control baseline wander (baseline wander shifts the position of
the signal waveform relative to the detector threshold and leads to severe erosion of noise
margin).
Error detection capabilities.
Bandwidth usage; the possibility of transmitting at a higher rate than other schemes over the
same bandwidth.
At the very least the LINE-CODE ENCODER serves as an interface between the TTL level
signals of the transmitter and those of the analog channel. Likewise, the LINE-CODE
DECODER serves as an interface between the analog signals of the channel and the TTL level
signals required by the digital receiver.
The modules
The two new modules to be introduced are the LINE-CODE ENCODER and the LINE-CODE
DECODER. You will not be concerned with how the coding and decoding is performed. You
should examine the waveforms, using the original TTL sequence as a reference.
In a digital transmission system line encoding is the final digital processing performed on the
signal before it is connected to the analog channel, although there may be simultaneous band
limiting and wave shaping.
Thus, the LINE-CODE ENCODER accepts a TTL input, and the output is suitable for
transmission via an analog channel.
At the channel output is a signal at the TIMS ANALOG REFERENCE LEVEL, or less. It could
be corrupted by noise. Here it is re-generated by a detector. The TIMS detector is the DECISION
MAKER module. Finally the TIMS LINE-CODE DECODER module accepts the output from
the DECISION MAKER and decodes it back to the binary TTL format.
The LINE-CODE ENCODER serves as a source of the system bit clock. It is driven by a master
clock at 8.333 kHz (from the TIMS MASTER SIGNALS module). It divides this by a factor of
four, in order to derive some necessary internal timing signals at a rate of 2.083 kHz. This then
becomes a convenient source of a 2.083 kHz TTL signal for use as the system bit clock.
Because the LINE-CODE DECODER has some processing to do, it introduces a time delay. To
allow for this, it provides a re-timed clock if required by any further digital processing circuits
(e.g, for decoding, or error counting modules).
Terminology
The word mark, and its converse space, often appear in a description of a binary
waveform. This is an historical reference to the mark and space of the telegraphist. In
modern day digital terminology these have become HI and LO, or '1' and '0' , as
appropriate.
Unipolar signaling: where a '1' is represented with a finite voltage V volts, and a '0'
with zero voltage. This seems to be a generally agreed-to definition.
Those who treat polar and bipolar as identical define these as signaling where a '1' is
sent as +V, and '0' as -V. They append AMI when referring to three- level signals which
use +V and -V alternately for a '1' , and zero for '0' (an alternative name is
Pseudoternary).
You will see the above usage in the TIMS Advanced Modules User Manual, as well as in this
text. However, others make a distinction.
Polar signaling: where a ’1’ is represented with a finite voltage +V volts, and a '0' with -V
volts.
Bipolar signaling: where a '1' is represented alternately by +V and -V, and a '0' by zero
voltage.
The term 'RZ' is an abbreviation of 'return to zero'. This implies that the particular
waveform will return to zero for a finite part of each data '1' (typically half the interval). The
term 'NRZ' is an abbreviation for 'non-return to zero', and this waveform will not return to
zero during the bit interval representing a data '1 '.
The use of 'L' and 'M' would seem to be somewhat illogical (or inconsistent) with each other.
For example, see how your text book justifies the use of the 'L' and the 'M' in NRZ-
L and NRZ-M.
Two sinusoids are said to be antipodal if they are 180° out of phase.
NRZ-L
Non return to zero - level (bipolar): this is a simple scale and level shift of the input TTL
waveform.
NRZ-M
Non return to zero - mark (bipolar): there is a transition at the beginning of each '1', and no
change for a '0'. The 'M' refers to 'inversion on mark'. This is a differential code. The decoder
will give the correct output independently of the polarity of the input.
UNI-RZ
Uni-polar - return to zero (uni-polar): there is a half-width output pulse if the input is a '1'; no
output if the input is a '0'. This waveform has a significant DC component.
BIP-RZ
Bipolar return to zero (3-level): there is a half-width +ve output pulse if the input is a '1'; or a
half-width -ve output pulse if the input is a '0'. There is a return-to-zero for the second half of
each bit period.
RZ-AMI
Return to zero -alternate mark inversion (3-level): there is a half-width output pulse if the input
is a ’1’; no output if the input is a '0'. This would be the same as UNI-RZ. But, in addition, there
is a polarity inversion of every alternate output pulse.
Biphase-L
Biphase - level (Manchester): bipolar ±V volts. For each input ’1’ there is a transition from +V
to -V in the middle of the bit-period. For each input ’0’ there is a transition from -V to +V in the
middle of the bit period.
DICODE-NRZ
Di-code non-return to zero (3-level): for each transition of the input there is an output pulse, of
opposite polarity from the preceding pulse. For no transition between input pulses there is no
output.
In this kit we have provided two different bit pattern to study different data formats.[RZ, NRZ,
Bipolar NRZ and Biphase or split phase]
1. RZ:- In case of RZ i.e. return to v zero formats, if bit is ‘1’ then logic high level is
transmitted for first half bit period & then logic low level is transmitted.
2. NRZ:- in case of NRZ i.e. not return zero, if bit is ’1’ then logic high level is transmitted for
full bit period & if bit is ‘0’ then logic level is transmitted.
3. BIPOLAR RZ:- If bit is ‘1’ then high level is transmitted for first high bit period and then
low level for remaining half bit period & then low level for remaining half bit period.
4. BIPOLAR NRZ: - If bit is ‘1’ then high level is transmitted for full bit period. If next bit is
also ‘1’ then negative high level is transmitted i.e. for every ‘1’ sign of high level is altered.
If bit is zero then logic low level is transmitted.
5. SPLITPHASE:- If bit is ‘1’, then logic high level is transmitted for first half bit period
followed by logic low level for next half bit period. I f bit is ‘0’ then logic low level is
transmitted for first half bit period followed by logic high level for next half bit period.
PROCEDURE:
1. Switch on the power supply.
2. Connect one of the bit patterns as I/P to data formats section.
3. Observe bit pattern together with different data formats on dual scope CRO.
4. Repeat the procedure for other bit operations.
5. Connect O/P of Unipolar RZ (Code Gen.) to I/P of Unipolar RZ (Decoder), adjust the pot &
observe O/P.
6. Connect O/P of Bipolar RZ (Code Gen.) to I/P of Bipolar RZ (Decoder), adjust the point ‘A’
& observe O/P.
7. Connect O/P of Bipolar NRZ (Code Gen.) to I/P of Bipolar NRZ (Decoder), observe points
‘B’, ‘C’ and O/P.
8. Connect O/P of Manchester (Code Gen.) to I/P of Manchester (Decoder), observe points
‘S’,’R’ and O/P.
CONNECTION DIAGRAM:
DATA FORMATS AND SIGNAL REPRESENTATIONS:
CONCLUSION:
We have implemented the different line encoding schemes and observed the digital signal
representation of input bit pattern.
Assignment No: 7
Title:
PC to PC communication
Date:
Remark:
ASSIGNMENT NO: 7
Aim:
To study PC to PC communication using RS232 or USB.
OBJECTIVES:
APPARATUS:
THEORY:
The Full- Duplex PC to PC communication (Chatting) via RS-232 serial port using 'C' language
is carried out. Implementing the serial communication this way does not require the reader to be
familiar with serial port registers & their programming and there is no need for constructing
user-defined functions for setting the baud rate and format of data, parity & stop bits. Moreover,
the speed of data transfer is also greater and the function used for serial programming along with
its arguments makes its purpose self-explanatory.
A PC can accommodate at most four serial ports but usually a PC has two RS- 232 serial ports,
viz, COM1 and COM2. Any one of the serial ports can be used in each PC for linking them
together. A serial port at the back of a PC is in the form of 9-pin (or some-times 25-pin) D-type
male connector. Table 1. shows pin functions.
Function
_bios_serialcom();
Function Declaration/Syntax
Unsigned _bios_serialcom(int cmd, int port, char abyte);
BRIEF DESCRIPTION:
The function _bios_serialcom() uses BIOS interrupt 0x14 to perform various RS-232
communications over the I/O port given in the port. The function arguments along with their
significance are given in Table 2.
F u n c t i o n A r g u m e n t Specifications
Port Argument- The serial port that is selected for RS-232 communication is specified in the
port argument as given in Table 3.
Table 3. Port Argument Specification
Cmd Argument- The I/O operation to be performed is specified by means of 'cmd' argument as
given in Table 4.
Table 4. Cmd Argument Specifications
When the value of 'cmd' argument is set to either _COM_RECEIVE or _COM_STATUS, the
value in 'abyte' argument is ignored.
Abyte Argument- When the value of 'cmd' argument is set to _COM_INIT, the COM port
settings are specified by the 'abyte' argument. The 'abyte' argument is an OR combination of the
following values (one from each group in Table 5.).
Return Value:
For all values of 'cmd' argument, the function _bios_serialcom() returns a 16- bit unsigned
integer. The upper 8 bits of the return value are status bits.
If one (or more) error status bit(s) is (are) set to 1, an error has occurred. If no error status bit is
set to 1, the byte was received without error. The lower 8 bits vary depending upon the value of
'cmd' argument specified as given in Table 6.
The following format shows the details of all the return bits:
The connection diagram shows the wiring of the null-modem that is intended for RS232
asynchronous communications (most PC-based systems). This configuration is called so because
each PC terminal feels as if some modem is connected to it rather than the other PC. The two PC
terminals are connected through TxD, RxD and GND pins. The Data Terminal Ready (DTR,
pin4) is looped back to Data Set Ready (DSR, pin 6) and Data Carrier Detect (DCD, pin 1) on
both the PCs. When DTR is asserted active, then the DSR and DCD immediately become active.
Data bits: 8
Stop bit: 1
PRECAUTIONS:
1. Avoid loose Connections.
2. Switch off the power supply of PC during connections
CONCLUSION:
Thus the PC to PC serial communication is established using RS 232 port successfully.
FAQs:
1. Name different types of serial interfaces
2. What are the advantages and limitations of RS-232?
3. Which are the timing pins of RS232.