Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
171 views67 pages

DMC Lab Manual

This document provides information about a lab manual for a course on Data and Mobile Communication. It outlines the course structure, objectives, outcomes, contents, pedagogy and assessment scheme. It also details the theory syllabus and laboratory assignments that cover topics such as LAN setup, modulation techniques, PCM, error detection/correction, sliding window protocol, line coding techniques and PC-to-PC communication. The lab assignments are planned over 9 weeks and include establishing wired/wireless networks, analyzing modulation techniques, PCM, coding programs, sliding window protocols, line coding and RS232/USB communication.

Uploaded by

VS creations
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
171 views67 pages

DMC Lab Manual

This document provides information about a lab manual for a course on Data and Mobile Communication. It outlines the course structure, objectives, outcomes, contents, pedagogy and assessment scheme. It also details the theory syllabus and laboratory assignments that cover topics such as LAN setup, modulation techniques, PCM, error detection/correction, sliding window protocol, line coding techniques and PC-to-PC communication. The lab assignments are planned over 9 weeks and include establishing wired/wireless networks, analyzing modulation techniques, PCM, coding programs, sliding window protocols, line coding and RS232/USB communication.

Uploaded by

VS creations
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

MITWPU

Lab Manual
Data and Mobile Communication
Second Year B. Tech.
Computer Science & Engineering
Trimester-V

2018

MITWPU, PUNE
COURSE STRUCTURE

Course Code CS223


Course Category Professional Core
Course Title Data and Mobile Communication
Teaching Scheme and Credits L T Laboratory Credits
Weekly load hrs. 3 - 2 2+1=3
Pre-requisites:
 CSIT I & II
 Computer Organization
Course Objectives:
1. To comprehend fundamentals of data communication
2. To study various analog and digital transmission techniques
3. To understand the flow and error control methods
4. To learn basics of cellular telephony .
Course Outcomes:
After completion of the course the students will be able to :-
1. Explain basic concepts of communication system.
2. Identify characterizing features of transmission techniques
3. Apply an appropriate techniques to solve the flow & error control problems
4. Understand wireless communication and cellular architecture
Course Contents:
1. Basics of Communication System
2. Digital Transmission
3. Data Flow and Error Control
4. Fundamentals of Mobile Communication

Laboratory Exercises / Practical:


1. LAN setup
2. Modulation Technique
3. PCM modulation
4. Error detection and correction
5. Sliding window protocol
6. Line coding techniques
7. PC to PC communication
Learning Resources:

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

Assignments Test Tutorial MCQ Attendance

20% 30% - 30% 20%

Laboratory Continuous Assessment (LCA)-50 Marks


Problem Any other
Oral based on Mini
Practical Site Visit based (Mock 1 and
practical Project
Learning Mock 2)

60% - - - - 40%

Term End Examination: 50 Marks (100% weightage)


Theory Syllabus:
Workload
Module
Contents in Hrs
No.
Theory

Basics of Communication System


Introduction to Data Communication, Analog and Digital Signal, Baseband
1 Transmission, Transmission Impairment, Data rate limits, Data Transmission 7
(parallel and serial: synchronous and asynchronous transmission), Analog
Transmission: Analog-to-Analog conversion, Digital-to-Analog conversion.

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

Data Flow and Error Control


Error Detection and Correction: Types of Errors, Redundancy, Hamming
3 Distance, Hamming Code, Cyclic Redundancy Check, Checksum, Framing: 7
Fixed Size and Variable Size, Flow and Error Control, protocols: Noiseless
and Noisy Channels.

Fundamentals of Mobile Communication


Introduction to Wireless communication, Spread Spectrum: Frequency
4 Hopping Spread Spectrum and Direct Sequence Spread Spectrum, FDMA, 7
TDMA, CDMA, Cellular Telephony: Frequency-Reuse Principle, Handoff,
Roaming, Mobile Generations, Architecture of GSM.
Laboratory Assignments:

Workload
Module in Hrs
Title of Assignment
No.
Lab
LAN setup

1 Establish wired/wireless network using: UTP Cable, Crimping 02


Tool, Connectors etc.

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.

Practical Examination 10 th Week


Assignment No: 1
Title:
LAN setup

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.

Types of Transmission Media


1. Wired or Guided Media or Bound Transmission Media: Bound transmission media are
the cables that are tangible or have physical existence and are limited by the physical
geography. Popular bound transmission media in use are twisted pair cable, co-axial cable
and fiber optical cable. Each of them has its own characteristics like transmission speed,
effect of noise, physical appearance, cost etc.

2. Wireless or Unguided Media or Unbound Transmission Media: Unbound transmission


media are the ways of transmitting data without using any cables. These media are not
bounded by physical geography. This type of transmission is called Wireless
communication. Nowadays wireless communication is becoming popular. Wireless LANs
are being installed in office and college campuses. This transmission uses Microwave, Radio
wave, Infrared are some of popular unbound transmission media.
Figure 1.Classification of Transmission Media

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

There are 3 major types of Guided Media:

(i) Twisted Pair Cable:


It consists of 2 separately insulated conductor wires wound about each other. Generally, several
such pairs are bundled together in a protective sheath. They are the most widely used
Transmission Media. Twisted Pair is of two types:

Figure 2.Twisted Cable


A. Unshielded Twisted Pair (UTP):
This type of cable has the ability to block interference and does not depend on a physical shield
for this purpose. It is used for telephonic applications.

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

B. Shielded Twisted Pair (STP):


This type of cable consists of a special jacket to block external interference. It is used in fast-
data-rate Ethernet and in voice and data channels of telephone lines.

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

(ii) Coaxial Cable:


It has an outer plastic covering containing 2 parallel conductors each having a separate insulated
protection cover. Coaxial cable transmits information in two modes: Baseband mode (dedicated
cable bandwidth) and Broadband mode (cable bandwidth is split into separate ranges). Cable
TVs and analog television networks widely use Coaxial cables.
Figure 3.Coaxial Cable

Advantages:

 High Bandwidth
 Better noise Immunity
 Easy to install and expand
 Inexpensive
Disadvantages:
Single cable failure can disrupt the entire network

(iii) Optical Fibre Cable


It uses the concept of reflection of light through a core made up of glass or plastic. The core is
surrounded by a less dense glass or plastic covering called the cladding. It is used for
transmission of large volumes of data.

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:

 Signal is broadcasted through air


 Less Secure
 Used for larger distances
There are 3 major types of Unguided Media:

(i) Radio waves


These are easy to generate and can penetrate through buildings. The sending and receiving
antennas need not be aligned. Frequency Range: 3 KHz – 1 GHz. AM and FM radios and
cordless phones use Radio-waves for transmission.

Further Categorized as: (i) Terrestrial and (ii) Satellite.

(ii) Micro waves


It is a line of sight transmission i.e. the sending and receiving antennas need to be properly
aligned with each other. The distance covered by the signal is directly proportional to the height
of the antenna. Frequency Range: 1GHz – 300GHz. These are majorly used for mobile phone
communication and television distribution.

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

 568 A and B color coding


RJ-45 conductor data cable contains 4 pairs of wires each consists of a solid coloured wire and a
strip of the same color. There are two wiring standards for RJ-45 wiring: T-568A and T-568B.
Although there are 4 pairs of wires, 10BaseT/100BaseT Ethernet uses only 2 pairs: Orange and
Green. The other two colors (blue and brown) may be used for a second Ethernet line or for
phone connections. The two wiring standards are used to create a cross-over cable (T-568A on
one end, and T-568B on the other end), or a straight-through cable (T-568B or T-568A on both
ends).
Types of connection:
1. Straight through connection
2. Cross over Connection

Figure 4.Colour Codes cable connection

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

Figure 5. RJ-45 Connector


 Crimping Tool
A crimping tool is a device used to conjoin two pieces of metal by deforming one or both of
them in a way that causes them to hold each other. The result of the tool's work is called a crimp.
A good example of crimping is the process of affixing a connector to the end of a cable. For
instance, network cables and phone cables are created using a crimping tool (shown below) to
join the RJ-45 and RJ-11 connectors to the both ends of either phone or CAT5 cable.

Figure 6. RJ-11 (6 Pin) and RJ-45 (8-Pin) Crimping Tool

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

Figure 7. Local Area Network

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

Analyze and test Amplitude / Frequency 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

Ka- Amplitude sensitivity of the modulator

S(t) –Modulated signal

Ac- carrier signal

m(t) –modulating signal

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.

V=VcSinWct + (mVc/2)Cos(Wc-Wm)t + (mVc/2)Cos (Wc + Wm)t

The equation for amplitude modulated wave is as above.

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

Pt=V2c/R+m2 V2 c/4R+m2 V2 c/4R

=Pc+m2 Pc/4+m2 Pc/4

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

In our AM Generator Transistorized Oscillator is given as a carrier generator. It's amplitude is


variable. IC 8038 based (Function generator) modulating signal with variable frequency and
variable amplitude is provided. For AM generation output of carrier generator & modulating
signal generator are given to OPAMP (LF351) adder. Modulation index can be vary, using
amplitude adjust pot given on front panel. Output of adder is given to tuned amplifier (Class C).It
gives required AM signal.
 AM Receiver
In case of receiver our aim is to reconstruct modulating signal from received modulated wave.
The simplest way of AM detection is to use detector diode (OA79) & give it’s output to low past
filter. In practical cases the signal strength may vary due to changing atmospheric conditioned.
Due to this amplitude of detected signal varies. The change in amplitude creates nuisance. This
effect is reduced using
Automatic gain control which is provided in practical detector circuit. In this case output of
diode detector is given to two low pass filters as shown in diagram. Also negative envelop of
modulated wave is detected. The cutoff frequency of one low pass filter pass audio range& that
of other is very low. Output of second filter is almost DC level. If input signal strength increase
(in negative direction) & it is feed to amplifier section & thus reduces the gain of amplifier
section & thus reduces the gain of amplifier section & output amplitude is automatically
controlled.
The output of detector can have different errors such as
1. High frequency ripple.
2. Diagonal clapping due to slope overload.

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:

 SIMPLE DIODE DETECTOR

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

1. Connect AM signal as I/P to OA 79 diode detector.


2. Connect cathode of diode to C1 i.e. 0.0 uf.
3. Observe ripple in detected O/P. also vary pot and observe it’s O/P
4. Connect cathode of diode to C2 i.e. 0.1 uf
5. Observe diagonal clipping by varying frequency if modulating signal. Also varying 10k pot
in detector section.
6. When 0.01 uf i.e. C1 is used. Connect O/P of detector section to LPF and observe filtered
output.
OUTPUT WAVEFORMS

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

Analyze and test PCM modulation technique.

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.

Figure 1. Analog and Sampled Signal


Sampling frequency, Fs is the number of average samples per second also known as sampling
rate. According to the Nyquist Theorem sampling rate should be at least 2 times the upper cutoff
frequency.

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.

Figure 2. Uniformly Quantized Signal


 Pulse Code Demodulation
Pulse Code Demodulation will be doing the same modulation process in reverse. Demodulation
starts with decoding process, during transmission the PCM signal will effected by the noise
interference. So, before the PCM signal sends into the PCM demodulator, we have to recover the
signal into the original level for that we are using a comparator. The PCM signal is a series pulse
wave signal, but for demodulation we need wave to be parallel.
By using a serial to parallel converter the series pulse wave signal will be converted into a
parallel digital signal. After that the signal will pass through n-bits decoder, it should be a Digital
to Analog converter. Decoder recovers the original quantization values of the digital signal. This
quantization value also includes a lot of high frequency harmonics with original audio signals.
For avoiding unnecessary signals we utilize a low-pass filter at the final part.

 Pulse Code Modulation Advantages


 Analog signal can be transmitted over a high- speed digital communication system.
 Probability of occurring error will reduce by the use of appropriate coding methods.
 PCM is used in Telkom system, digital audio recording, digitized video special effects,
digital video, and voice mail.
 PCM is also used in Radio control units as transmitter and also receiver for remote
controlled cars, boats, planes.
 The PCM signal is more resistant to interference than normal signal.
Apparatus
PCM Modem Kit Connection Diagram

Procedure / Steps of Implementation


1. Switch ON the Power.

2. Observe the 1MHz output signal on panel.

3. Connect this 1 MHz clock to ADC 0809 clock input

4. Observe point A output from -:- 2 Network and connect it to the point B that is input to
the 8 network.

5. Observe output of both -:- 8 network and calculate their frequencies

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

12. Now you can draw timing diagram of the system

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:

1. To demonstrate use of error control protocols


2. To encode and decode original data bits with the help of parity bits
3. To detect single bit/multi bit errors

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 1. Single Bit Error


Single bit errors are least likely type of errors in serial data transmission. To see why, imagine a
sender sends data at 10 Mbps. This means that each bit lasts only for 0.1 μs (micro-second). For
a single bit error to occur noise must have duration of only 0.1 μs (micro-second), which is very
rare. However, a single-bit error can happen if we are having a parallel data transmission. For
example, if 16 wires are used to send all 16 bits of a word at the same time and one of the wires
is noisy, one bit is corrupted in each word.
Multi-Bit error / Burst Error
The term multi-bit error / burst error means that two or more bits in the data unit have changed
from 0 to 1 or vice-versa (see following figure). Note that burst error doesn’t necessary means
that error occurs in consecutive bits. The length of the burst error is measured from the first
corrupted bit to the last corrupted bit. Some bits in between may not be corrupted.

Figure 2. Burst Error of Length 8


Burst errors are mostly likely to happen in serial transmission. The duration of the noise is
normally longer than the duration of a single bit, which means that the noise affects data; it
affects a set of bits as shown in above figure. The number of bits affected depends on the data
rate and duration of noise.

 Concept of Parity Bits


A redundant bit called parity bit, is appended to every data unit so that the number of 1’s in the
unit (including the parity becomes even or odd depending upon whether even parity is
considered or odd parity). The concept of adding parity bits is used to detect errors in a
transmission, single bit error is detected by it. (Multiple bit errors cannot be detected by parity).
There are two types of parity depending upon number of ‘1’s it detect.
1. Even parity – Even number of ‘1’s
2. Odd parity – Odd number of ‘1’s
Even Parity
If transmitted bit stream contains odd number of ‘1’s then to make it even we add parity bit as
‘1’ (Or we simply make it ‘High’). For. e.g.

Bit stream Parity bit


1 0 0 0 0 0 0 1
S R
Transmission Medium

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.

Bit stream 1 Parity bit


1 1 1 1 1 0 1
S R
Transmission Medium

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.

Bit stream Parity bit


1 0 0 1 0 0 1 0
S R
Transmission Medium

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.

Figure 7. Basic scheme for Cyclic Redundancy Checking


The transmitter can generate the CRC by using a feedback shift register circuit. The same
circuit can also be used at the receiving end to check whether any error has occurred.

Figure 8. CRC Encoder and Decoder


CRC codes are also known as polynomial code since it is possible to view the bit string to be
sent as a polynomial whose coefficients are the ‘0’ and ‘1’ values in bit stream.
A ‘k’ – bits frame is regarded as the coefficient list for polynomial with ‘k’ terms ranging from
Xk-1 to X0 such polynomial is said to be degree of ‘k-1’.
The high order (left most) bit is the coefficient of Xk-1 the next bit is coefficient of Xk-2 and so
on. For example 110001 has 6 bits thus represent 6 term polynomial with coefficient 1, 1, 0, 0, 0,
and 1 (i.e. 1X5 + 1X4 + 0X3 + 0X2 + 0X1 +1X0).
Polynomial arithmetic is done in modulo - 2, according to the rules of algebraic field theory.
It does not have carries in addition and borrows in subtraction.
Addition and subtraction both are identical to XOR Operation (⊕).

 Example:

Figure 9. Division in CRC Encoder


Figure 10. Division in CRC Decoder for two cases

Algorithm:

Figure 11. CRC Process Overview


Figure 12. CRC 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];
}

{ //calculation of remainder 6=^=ex or


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]=data[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 are:: ");
for(i=0;i<gn;i++)
printf(" %d ",r[i]);
}

{//adding crc bits in data bits


j=0;
for(i=dn;i<(gn+dn-1);i++)
data[i]=r[++j];
}

getch();
clrscr();

printf("\n\n Transmitted data:: ");


for(i=0;i<(gn+dn-1);i++)
printf(" %d ",data[i]);

//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

Write a program to implement 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.

Figure. 1 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.

❖ Flow Control Protocols


Traditionally four protocols have been defined to deal with flow control: Simple, Stop-and-
Wait, Go-Back-N, and Selective-Repeat. Figure 2 depicts the taxonomy of flow control
protocols.

Figure 2. Flow Control Protocols

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

Figure 3. Simple Protocol


 Stop & Wait Protocol
This flow control mechanism forces the sender after transmitting a data frame to stop and wait
until the acknowledgement of the data-frame sent is received.

Figure 4. Stop & Wait Protocol

There are three problems with stop & wait protocol:

1. Lost data: Sender waits for acknowledgement and receiver waits for data for an infinite
amount of time. Figure 5 represents this scenario.

Figure 5. Lost data


2. Lost acknowledgement: The acknowledgement sent by receiver is lost during transit and
sender waits for acknowledgement for an infinite amount of time. Figure 6 represents this
scenario.

Figure 6. Lost acknowledgement

3. Delayed acknowledgement / Data: After timeout on sender side, a long delayed


acknowledgement might be wrongly considered as acknowledgement of some other recent
packet.

 Stop & Wait ARQ (Automatic Repeat Request ) Protocol


Above 3 problems are resolved by Stop and Wait ARQ (Automatic Repeat Request). The
working of this protocol is as follows:
1) Sender A sends a data frame or packet with sequence number 0.
2) Receiver B, after receiving data frame, sends and acknowledgement with sequence
number 1 (sequence number of next expected data frame or packet)
There is only one bit sequence number that implies that both sender and receiver have
buffer for one frame or packet only.
3) The sender also maintains a timeout counter.

4) When a frame is sent, the sender starts the timeout counter.

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:

Figure 7. Stop & Wait ARQ Protocol

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.

❖ Sliding Window Protocol


Sliding window protocol solves the problem of stop & wait ARQ. In this flow control
mechanism, both sender and receiver agree on the number of data-frames after which the
acknowledgement should be sent. As we learnt, stop and wait flow control mechanism wastes
resources, this protocol tries to make use of underlying resources as much as possible.

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

Figure 8. Sliding Window Protocol

Sliding window protocol is of two types:


1. Selective Repeat: Sender transmits only that frame which is erroneous or is lost.
2. Go back n: Sender transmits all frames present in the window that occurs after the error bit
including error bit also.

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

Analyze and test different 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.

 Line Coding Schemes


For a TTL input signal the following output formats are available from the LINE-CODE
ENCODER.

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

Study PC to PC communication using RS232 or USB.

Date:

Remark:
ASSIGNMENT NO: 7
Aim:
To study PC to PC communication using RS232 or USB.

OBJECTIVES:

1. To demonstrate use of RS232


2. To establish Full-Duplex PC to PC Communication

APPARATUS:

Sr. No APPARATUS QUANTITY


1. PC 2
2. RS 232 Cable 1

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.

Table 1 Pin Functions of 9-Pin Connector of RS-232 Serial Port


The following Figure 1 shows configurations of 9-pin D type male connector.

Figure 1 Pin D-type Connector of RS-232 Serial Port

Programming RS-232 Serial Port using 'C'


Library File Inclusion
#include<bios.h>

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.

Table 2. Various Function Arguments and their Significance

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

Table 5. Abyte Argument Specifications

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.

Table 6. Significance of Lower Byte of Return Value

The following format shows the details of all the return bits:

Lower Byte of Return Value:


D0 = Received line signal detect
D1 = Ring indicator
D2 = Data set ready
D3 = Clear to send
D4 = Change in receive line signal
D5 = Trailing edge ring indicator
D6 = Change in data set ready
D7 = Change in clear to send

Upper Byte of Return Value:


D9 = Overrun error
D10 = Parity error
D11 = Framing error
D12 = Break detect
D13 = Transmit holding register empty
D14 = Transmit shift register empty
D15 = Time out (set to 1 if abyte value could not be sent)
CONNECTION DIAGRAM:

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.

Figure. 2. Null Modem Cable Configuration


At this moment, the computer thinks the virtual modem to which it is connected is ready and has
detected the carrier of the other modem. The lines Request to Send (RTS, pin7) and Clear to
Send (CTS, pin8) have been linked together. When the computer wishes to send data, it asserts
RTS high which in turn asserts CTS high meaning thereby that the virtual modem has the room
for storing the data and the computer can send data.

DATA TRANSFER PROCEDURE:


1. Connect the two PCs together using the 3-wire link.
2. Run the program given in the source code on both the PCs.
3. Before sending the data, set both the sending and receiving PC terminals to the same baud
rate, and same format of data bits, parity bits & stop bits using the macro(pre-processor
directive) 'SETTINGS' in the source code.
4. When the source code is compiled and run on both the PCs, the character strings (whose
termination is indicated by pressing ENTER key) typed in the text entry window of one PC
should appear in the communication display window of both the PCs.
SAMPLE SETTINGS:
Baud rate = 9600 bits per second

Data bits: 8

Even parity bit

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.

You might also like