CS2 Lab PDF
CS2 Lab PDF
Communication Systems-II
12EC63
Laboratory Manual
Vision
Imparting quality technical education through interdisciplinary research, innovation and teamwork
for developing inclusive & sustainable technology in the area of Electronics and Communication
Engineering.
Mission
To impart quality technical education to produce industry ready engineers with a research
outlook.
To train the Electronics & Communication Engineering graduates to meet global challenges by
inculcating a quest for modern technologies in the emerging areas.
To create centers of excellence in the field of electronics and communication engineering with
industrial and university collaborations.
Laboratory Certificate
Marks in Words
Date:
TOTAL MARKS
The list of steps to implement the c code on DSK 6713 kit using CC studio
version 5.5.
DSP Starter Kit (DSK) 6713 in Code Composer Studio V5.5
5. If any previous project(e.g EC104_ASK) can be deleted in the Project Explorer by right
click on the previous project & click on delete , then give "Ok" on pop-up menu (Note:
Do not select the option Delete the Project contents on disk. See Fig.2. It will delete
someone project files)
6. Start to write the source program in main.c & save by File Save
C:\DSK6713\support
C:\DSK6713\include\csl
C:\DSK6713\include\bsl
( In, Add dir to #include search path (--include_path,-I)Add path (by option )
b) In Advanced Options,
c) In Advanced Options:
Then Click Ok
Pop-up menu User Access control: Yes & choose Start After successful test ,close the
window
Connect the Function generator with CRO through stereo cable and choose the Sine signal &
verify that input signal amplitude <1.5 V & Frequency less than Sampling frequency/2
(Sampling frequency can be found in the program)
( Imp Note: Never Exceed the input voltage greater than 1.5V ).Verify the input voltage
in the CRO before connecting to DSP Kit
Connect the Function generator to LINE IN in the DSP Kit through Stereo cable
Connect the CRO to LINE OUT in the DSP Kit through stereo cable
Go to Run Resume
Experiment 1
Line Codes
Aim: a) Simulate the different line codes Uni-polar, Polar, Bipolar (NRZ and RZ) and
Manchester code for a sequence. Plot the power spectral density and the probability
of error for the same.
Theory: The terminology line coding originated in telephony with the need to transmit
digital information across a copper telephone line; more specifically, binary data over a
digital repeater line. The concept of line coding, however, readily applies to any transmission
line or channel. In a digital communication system, there exists a known set of symbols to be
transmitted.
It is commonly accepted that the dominant considerations affecting the choice of a line code
are:
1. Timing: The waveform produced by a line code should contain enough timing
information such that the receiver can synchronize with the transmitter and decode the
received signal properly. The timing content should be relatively independent of
source statistics, i.e., a long string of 1s or 0 s should not result in loss of timing or
jitter at the receiver.
2. DC content: Since the repeaters used in telephony are AC coupled, it is desirable to
have zero DC in the waveform produced by a given line code. If a signal with
significant DC content is used in AC coupled lines, it will cause DC wander in the
received waveform. That is, the received signal baseline will vary with time.
Telephone lines do not pass DC due to AC coupling with transformers and capacitors
to eliminate DC ground loops. Because of this, the telephone channel causes a droop
in constant signals. This causes DC wander. It can be eliminated by DC restoration
circuits, feedback systems, or with specially designed line codes.
3. Power spectrum: The power spectrum and bandwidth of the transmitted signal should
be matched to the frequency response of the channel to avoid significant distortion.
Also, the power spectrum should be such that most of the energy is contained in as
small bandwidth as possible. The smaller the bandwidth, the higher the transmission
efficiency.
4. Performance monitoring: It is very desirable to detect errors caused by a noisy
transmission channel. The error detection capability in turn allows performance
monitoring while the channel is in use (i.e., without elaborate testing procedures that
require suspending use of the channel).
5. Probability of error: The average error probability should be as small as possible for
a given transmitter power. This reflects the reliability of the line code.
6. Transparency: A line code should allow all the possible patterns of 1s and 0 s. If a
certain pattern is undesirable due to other considerations, it should be mapped to a
unique alternative pattern.
a) Generate ‘N’ random bit stream using rand and floor function. For eg., N=10.
b) Set the pulse amplitude = 5V and bit period = 1 time units. Accordingly set the value
for the number of samples taken during a bit period, say fs=100
c) Obtain Unipolar NRZ line code using ones function.
For eg.,
%Unipolar NRZ
U=[];
for k=1:N;
U = [U A*a(k)*ones(1,fs)];%% a has random bit stream
end
%Polar NRZ
P=[];
for k=1:N
P = [P ((-1)^(a(k) + 1))*A*ones(1,fs)];
end
e) Using the same logic, generate Polar RZ , Bipolar NRZ, Bipolar RZ and Manchester
codes.
a) Unipolar NRZ
b) Polar NRZ
d) Manchester code
Algorithm for MATLAB code to find Probability of error for line codes:
1. Using the below given formula, obtain the Probability of error for line codes.
(For equally likely data, with additive white Gaussian noise (AWGN) and matched
filter)
2.
a) Unipolar NRZ
Note: Polar NRZ and Manchester code has same Pe for equiprobable 1's and 0's
c) Biploar RZ
Observation:
Experiment 2
Pulse Amplitude Modulation
Aim:
i) a) Simulation of ‘N’ 4-PAM symbols. Modeling a wideband additive white
Gaussian noise (AWGN) channel and a matched filter.
b) The matched filter output is sampled and the sequence of receiver samples is
quantized to symbol amplitudes and the decoded symbol error percentage is
computed.
ii) Implement PAM on the DSP 6713 and observe the waveform on the CRO.
Theory: Pulse modulation may be used to transmit analog information, such as continuous
speech or data. It is a system in which continuous waveforms are sampled at regular intervals.
Information regarding the signal is transmitted only at the sampling times, together with any
synchronizing pulses that may be required. At the receiving end, the original waveforms may
be reconstituted from the information regarding the samples, if these are taken frequently
enough. Despite the fact that information about the signal is not supplied continuously as in
AM and FM, the resulting receiver output can have negligible distortion. Pulse modulation
may be subdivided broadly into two categories, analog and digital. In the former, the
indication of sample amplitude may be infinitely variable, while in the latter a code which
indicates the sample amplitude to the nearest predetermined level is sent. Pulse‐amplitude
and pulse‐time modulation are both analog, while the pulse code and delta modulation
systems are both digital. All the modulation systems to be discussed have sampling in
common, but they differ from each other in the manner of indicating the sample amplitude.
The two types of analog pulse modulation, pulse–amplitude and pulse‐time modulation
correspond roughly to amplitude and frequency modulation. Pulse Amplitude Modulation,
the simplest form of pulse modulation.
1. Generate random 4-PAM (+/-1, +/-3) sequence say N_length=20 (for easy
analysis)
3. Convolve the pulse shaping function with data to get the transmitted data
Expected Output:
Observation:
At the input we have 16 bit long input sample. For 4-level PAM, the input sample is
decomposed into segments 2 bits long. So now each input sample is composed of 8 segments.
Parsing the input sample is achieved through the use of masking and shifting. The first
symbol block is obtained with masking of two least significant bits by anding the input
sample with 0x0003. Now this symbol block is mapped on one of the 4 uniformly spaced
levels between –x8000 and 0x7FFF using the lookup table created in the main function. The
selected level is then transmitted as a square wave. The period of the square wave is achieved
by outputting the same level many times to ensure a smooth-looking square wave at the
output of the DSK.The second symbol block is obtained through shifting the original input
sample by two bits to the right and masking the 2 least significant bits (LSBs). These steps
are repeated until the end of input sample length and produce eight symbol blocks. As each
input sample is decomposed into 8 symbol block and corresponding level of each symbol
block is output 12 times so a new input sample is taken after every 96 samples.
Code:
Experiment 3
Amplitude Shift Keying Modulation and detection
Aim: a) ASK modulation and demodulation using MATLAB
b) Implementation of ASK mod and De-mod on DSP kit
There are sharp discontinuities shown at the transition points. These result in the signal
having an unnecessarily wide bandwidth. Bandlimiting is generally introduced before
transmission, in which case these discontinuities would be ‘rounded off’. The bandlimiting
may be applied to the digital message, or the modulated signal itself. The data rate is often
made a sub-multiple of the carrier frequency. This has been done in the waveform of Figure
5.1. One of the disadvantages of ASK, compared with FSK and PSK, for example, is that it
has not got a constant envelope. This makes its processing (Eg, power amplification) more
difficult, since linearity becomes an important factor. However, it does make for ease of
demodulation with an envelope detector.
ASK Modulation
sig_n = sqrt(No/2)
s(1,:) = E_s1*cos(w*t)
s(2,:) = E_s2*cos(w*t)
9. A random array of bits containing ones and zeros is generated for the input bits
[message signal or data].
10. The data rate is often made a sub-multiple of the carrier frequency.
11. First, an ASK signal is to be generated at the transmitter.
To generate ASK modulated signal (transmitted signal represented as m_sig) multiply
the data with the Carrier wave.
12. Random values are used to generate AWGN
13. To create a Noise vector(n)
Noise standard deviation (sig_n) is multiplied with the White Gaussian Noise which is
randomly generated for the same length as that of the transmitted signal.
14. ASK modulated signal has to be passed through the AWGN channel and then it has to
be demodulated.
15. To obtain the received signal(r), Noise vector will then be added to the input function.
r = m_sig + n;
ASK Demodulation
16. create Basis function
sigma1 = E_s1*cos(w*t); %Create basis functions
sigma2 = E_s2*cos(w*t);
x=received_sig - signal;
n_errors = sum(and(x,1))
Expected Waveforms:
//------------------------------------------------------------------------------------------------------
case 2:
{
//ASK Demodulator
sample_data = input_sample(); //inputs data
buffer=0;
for (i_ASK_D=0; i_ASK_D<16; i_ASK_D++)//counting 16
{
for (j_ASK_D=0; j_ASK_D<4; j_ASK_D++) // 4 data_table bits
{
masked_value = sample_data& 0x0001;// input sample
output = data_ASK[masked_value][j_ASK_D];
temp[j_ASK_D]=output; //temp holds modulated value
}
bit=0; //initializes bit to its default value
//demodulation starts
if (temp[1]==-1000) //checks the 2nd value in temp array and
//determines if corresponding bit is 1 or 0
{
bit = 1;
}
bit = bit << 15; //aligns determined bit to right location
buffer = buffer + bit;
if (i_ASK_D!=15) //prevents redundant shifting
buffer = buffer >> 1;
sample_data = sample_data>> 1; //shifts input so as to mask another part
}
output_sample(buffer);
break;
}
//-------------------------------------------------------------------------------------------------
}
}
}
Observation:
Experiment 4
Frequency Shift Keying Generation and Detection
Aim: a) FSK modulation and demodulation using MATLAB
b) Implementation of FSK mod and De-mod on DSP kit
Theory: Frequency shift keying (FSK) is the most common form of digital modulation in
the high-frequency radio spectrum, and has important applications in telephone circuits.
Binary FSK is a modulation scheme typically used to send digital information between digital
equipment such as teleprinters and computers. The data are transmitted by shifting the
frequency of a continuous carrier in a binary manner to one or the other of two discrete
frequencies. One frequency is designated as the “mark” frequency and the other as the
“space” frequency. The mark and space correspond to binary one and zero, respectively. By
convention, mark corresponds to the higher radio frequency. Figure 6.1 shows the
relationship between the data and the transmitted signal.
Figure 6.1: FSK modulation. (a) Binary data (b) frequency modulates the carrier to
produce the FSK signal (c).which has the frequency characteristic
FSK MODULATION
sig_n = sqrt(No/2)
s(1,:) = E_s*cos(w1*t)
s(2,:) = E_s*cos(w2*t)
9. A random array of bits containing ones and zeros is generated for the input bits
[message signal or data].
10. The data rate is often made a sub-multiple of the carrier frequency.
11. First, an FSK signal is to be generated at the transmitter.
To generate FSK modulated signal (transmitted signal represented as m_sig) multiply
the data with the Carrier wave.
12. Random values are used to generate AWGN
13. To create a Noise vector(n)
Noise standard deviation (sig_n) is multiplied with the White Gaussian Noise which is
randomly generated for the same length as that of the transmitted signal.
14. ASK modulated signal has to be passed through the AWGN channel and then it has to
be demodulated.
15. To obtain the received signal(r), Noise vector will then be added to the input function.
r = m_sig + n;
FSK Demodulation
16. create Basis function
sigma1 = E_s*cos(w1*t); %Create basis functions
sigma2 = E_s*cos(w2*t);
x=received_sig - signal;
n_errors = sum(and(x,1))
comm_poll();
while(1) //infinite loop
{
switch(mode)
{
//---------------------------------------------------------------------------------------------------------------
case 1:
{
//FSK Modulator
if (i_FSK_M==64) //determines when to get new input
{
sample_data = input_sample(); //inputs data
i_FSK_M=0;
j_FSK_M=0;
}
masked_value = sample_data& 0x0001;//masks input sample as 1-bit segments
output = data_FSK[masked_value][j_FSK_M];//gets corresponding level
output_sample(output*10); //outputs corresponding sinusoid
j_FSK_M++; //repeated output counter
if (j_FSK_M==8) //checks if 1-bit segment was output
{
j_FSK_M=0;
sample_data = sample_data>> 1;//shifts input so as to mask another part
}
i_FSK_M++;
break;
}
//---------------------------------------------------------------------------------------------------------------
case 2:
{
//FSK Demodulator
sample_data = input_sample(); //inputs data
buffer=0;
for (i_FSK_D=0; i_FSK_D<16; i_FSK_D++)//counting 16 segments
{
for (j_FSK_D=0; j_FSK_D<4; j_FSK_D++) //counting 4 data_table bits
{
masked_value = sample_data& 0x0001; // input sample 1-bit
output = data_FSK[masked_value][j_FSK_D];
temp[j_FSK_D]=output; //temp holds modulated value
}
bit=0; //initializes bit to its default value
//demodulation starts
if (temp[1]==500) //checks the 2nd value in temp array and
{ //determines
if corresponding bit is 1 or 0
bit = 1;
}
Observation:
Experiment 5
Binary Phase Shift Keying Modulation and Detection
Aim: a) BPSK modulation and demodulation using MATLAB
b) Implement BPSK mod and De-mod in DSP kit
Theory: Phase shift keying (PSK) is a one of most frequently efficient modulation
technique for wireless data transmission for its high noise immunity and narrow frequency
bandwidth. Binary phase shift keying (BPSK) is the simplest type of phase keying. It is
normally used for high speed data transfer application, provides a 3dB power advantage over
the BASK modulation technique and is robust and simple in implementation but proves to be
an inefficient user of the provided bandwidth and is normally termed as a non-linear
modulation scheme. It provides small error rates than any other systems. Fig7.1 shows the
message signal and corresponding PSK signal.
PSK MODULATION
sig_n = sqrt(No/2)
s(1,:) = E_s*cos(w*t)
s(2,:) = E_s*sin(w*t)
9. A random array of bits containing ones and zeros is generated for the input bits
[message signal or data].
10. The data rate is often made a sub-multiple of the carrier frequency.
11. First, an PSK signal is to be generated at the transmitter.
To generate PSK modulated signal (transmitted signal represented as m_sig) multiply
the data with the Carrier wave.
12. Random values are used to generate AWGN
13. To create a Noise vector(n)
Noise standard deviation (sig_n) is multiplied with the White Gaussian Noise which is
randomly generated for the same length as that of the transmitted signal.
14. ASK modulated signal has to be passed through the AWGN channel and then it has to
be demodulated.
15. To obtain the received signal(r), Noise vector will then be added to the input function.
r = m_sig + n;
PSK Demodulation
16. create Basis function
sigma1 = E_s1*cos(w*t); %Create basis functions
sigma2 = E_s2*cos(w*t);
x=received_sig - signal;
n_errors = sum(and(x,1))
Expected Waveforms:
i_BPSK_M++;
break;
}
case 2:
{
//BPSK Demodulator
sample_data = input_sample(); //inputs data
buffer=0;
for (i_BPSK_D=0; i_BPSK_D<16; i_BPSK_D++) //counting 16 segments
{
for (j_BPSK_D=0; j_BPSK_D<4; j_BPSK_D++) //counting 4 data_table bits
{
masked_value = sample_data & 0x0001; //masks input sample as 1-bit segments
output = data_BPSK[masked_value][j_BPSK_D]; //retrieves the corresponding hex value from //data
table
temp[j_BPSK_D]=output; //temp holds modulated value
}
bit=0;
//initializes bit to its default value
//demodulation starts
if (temp[1]==-1000) //checks the 2nd value in temp array and
{
//determines if corresponding bit is 1 or 0
bit = 1;
}
bit = bit << 15; //aligns determined bit to right location
buffer = buffer + bit;
if (i_BPSK_D!=15)
//prevents redundant shifting
buffer = buffer >> 1;
sample_data = sample_data >> 1 ; //shifts input
so as to mask another part
}
output_sample(buffer);
break;
}//end of case 2
}//end of switch
}
}
Observation:
Experiment 6
QPSK Modulation and Demodulation
Aim: a) QPSK modulation and demodulation using MATLAB
b) QPSK modulation and demodulation using DSP Processor
QPSK
Theory: In QPSK, the data bits to be modulated are grouped into symbols, each containing
two bits, and each symbol can take on one of four possible values: 00, 01, 10, or 11. During
each symbol interval, the modulator shifts the carrier to one of four possible phases
corresponding to the four possible values of the input symbol. In the ideal case, the phases are
each 90 degrees apart, and these phases are usually selected such that the signal constellation
matches the configuration shown in Figure 8.1. Fig 8.2 shows the message and corresponding
QPSK signal.
PSK MODULATION
sig_n = sqrt(No/2)
s(1,:) = E_s*cos(w*t)
s(2,:) = E_s*cos(w*t+90)
s(3,:) = E_s*cos(w*t+180)
s(4,:) = E_s*sin(w*t+270)
9. A random array of bits containing ones and zeros is generated for the input bits
[message signal or data].
10. The data rate is often made a sub-multiple of the carrier frequency.
11. First, QPSK signal is to be generated at the transmitter.
To generate QPSK modulated signal (transmitted signal represented as m_sig)
multiply the data with the Carrier wave.
14. ASK modulated signal has to be passed through the AWGN channel and then it has to
be demodulated.
15. To obtain the received signal(r), Noise vector will then be added to the input function.
r = m_sig + n;
QPSK Demodulation
16. create Basis function
17. s(1,:) = E_s*cos(w*t)
18. s(2,:) = E_s*cos(w*t+90)
19. s(3,:) = E_s*cos(w*t+180)
20. s(4,:) = E_s*sin(w*t+270) %Create basis functions
21. In order to detect the signal(Demodulated data output),
Correlate received signal(r) with the basis function.
22. Compare Input Data Stream and Demodulated Output Data.
23. To make the decision on the received data bits
Set the appropriate threshold level and compare it with the demodulated data.
24. Compute the difference (x) between the input signal and the demodulated signal.
x=received_sig - signal;
n_errors = sum(and(x,1))
Expected Waveforms:
Output:
case 1:
{
//QPSK Modulator
if (i_QPSK_M==32) //determines when to get new input
{
sample_data = input_sample(); //inputs data
i_QPSK_M=0;
j_QPSK_M=0;
}
masked_value = sample_data& 0x0003; //masks as 2-bit segments
output = data_QPSK[masked_value][j_QPSK_M];
output_sample(output*10); //outputs corresponding sinusoid
j_QPSK_M++;
if (j_QPSK_M==4) //checks if 2-bit segment was output
{
j_QPSK_M=0;
sample_data = sample_data>> 2; //shifts input so as to mask another part
}
i_QPSK_M++;
break;
}
//---------------------------------------------------------------------------------------------------------------
case 2:
{
sample_data = input_sample(); //inputs data
buffer=0;
for (i_QPSK_D=0; i_QPSK_D<8; i_QPSK_D++)//counting 8 segments
{
for (j_QPSK_D=0; j_QPSK_D<4; j_QPSK_D++) //4 data_table bits
{
masked_value = sample_data& 0x0003;// input 2-bit segments
output = data_QPSK[masked_value][j_QPSK_D];
temp[j_QPSK_D]=output; //temp holds modulated value
}
bit=0; //initializes bit to its default value
if (temp[0]==0) //demodulation starts
{
if (temp[1]==-1000)
bit=3;
} //checks first 2 values and
else //determines corresponding dibit
{
if (temp[0]==1000)
bit=1;
else
bit=2;
}
bit = bit << 14; //aligns determined bit to right location
Experiment 7
MSK Modulation and Demodulation
Aim: a) MSK modulation and demodulation using MATLAB
b)Implement MSK mod and De-mod in DSP kit
Algorithm:
1. Set the samples per symbol variable
2. Generate random binary data.
3. Create and MSK modulators that accept binary inputs.
4. Modulate the data using the MSK modulators.
5. Pass the modulated signals through an AWGN channel having an SNR of 30 dB.
6. Plot the eye diagrams of the noisy signals.
Observation:
Experiment 8
QAM Modulation and Demodulation
Aim: a) QAM modulation and demodulation using MATLAB
6. Muxing these two streams result in the generation of output sequence which is same
as the given input.
The program also shows the constellation diagram for both the transmitted and the distorted
received signal.
ALGORITHM
MODULATION
1. Input a stream of binary digits
Eg: Integers 0-15
[ 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0
0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1
1 1 0 1 1 1 1]
2. Serial to Parallel 4-bit Register
3. Separation of I and Q bits
4. Assigning Amplitude levels for I-channel (Ai)
[if input is 00, output is -3,
if input is 01, output is -1
if input is 10, output is 1
if input is 11, output is 3]
5. Repeat the same to Q-Channel (Aq)
6. Assign Carrier Frequency(fc), Sampling Frequency(fs) and Duration of Signal(t)
7. Multiplication with carrier signals cos and sin and
Modulated signal Si=Ai*cos(2*pi*(fc/fs)*t)
Sq=Aq*sin(2*pi*(fc/fs)*t)
8. Modulated signal is S=Si+Sq
9. Transmitted Signal passes through AWGN Channel(choose appropriate SNR)
DEMODULATION
10. Received Signal 'r' (choose appropriate SNR)
11. Generate Sin and Cos by Local Oscillator
rs1=2*cos(2*pi*(fc/fs)*t);
rs2=2*sin(2*pi*(fc/fs)*t);
12. Demodulation of Received Signal(SSi, SSq)
SSi=rs1.*r for I-channel
SSq=rs2.*r for Q-channel
LOW-PASS FILTERING THRESHOLDING AND PHASE DETECTION
13. Assign Cut-off Frequency, Butterworth filter of Order
14. Filtering
filter(b1,a1,ssi)
filter(b2,a2,ssq)
15. Calculating Average values over an interval for I-channel and Q-channel
AMPLITUDE DETECTION AND GENERATION OF DEMODULATED DATA
16. Re-assigning bits with respect to amplitude levels
Expected output
Observation:
Experiment 09
Convolution Coding and Viterbi Decoding
Aim: a) To generate the convolution code and Viterbi decoding using MATLAB
b) Simulate the Duo binary Correlative Coding
Theory: Communication through noisy channels is subject to errors. In order to decrease the
effect of errors and achieve reliable communication, it is necessary to transmit sequences that
are as different as possible so that the channel noise will not change one sequence into
another. This means some redundancy has to be introduced to increase the reliability of
communication. The introduction of redundancy results in transmission of extra bits and a
reduction of transmission rate. Channel coding schemes can be generally divided into two
classes, block codes and convolution codes. In block coding, binary source output sequence
of length k are mapped into binary channel input sequence of length n ; therefore the rate of
the resulting code is k / n bits per transmission. Such a code is called an n, k block code
example an input pulse vector v = (1 0 0…) generates upper and lower branch responses:
w(1) = (1 0 1 0 0 …) and
w(2) = (1 1 1 0 0 . . .)
2. Compare: The path metrics leading to each of the encoder’s states are compared.
3. Select: The highest-likelihood path (survivor) leading to each of the encoder’s states is
selected, and the lower-likelihood paths are discarded.
Note: A metric is a measure of the “distance” between what is received and all of the possible channel symbols
that could have been received. The metrics for the soft decision and the basic Viterbi decoding techniques are
computed using different methods.
For Hard Viterbi decoding, the metric used is the Hamming distance, which specifies the number of bits by
which two symbols differ. For the soft decision technique, the metric used is the Euclidean distance between
the signal points in a signal.
Expected output:
void initialize();
//*****encoder delcarations****************
//encoder variables
short input[128];
short no_of_samples = 128;
short a = 0;
short b = 0;
float enc_output[6150];
int buffercount = 0;
//encoder functions
void encode(short);
void process_input();
if (inputstate == 1)
{
//intialize with cosine signal of 666Hz
for(j = 0; j < 128; j++)
input[j] = input1[j];
}
if (inputstate == 2)
{
//intialize with input=cos_666+cos_1500
for(j = 0; j < 128; j++)
input[j] = input1[j] + input2[j];
}
if (inputstate == 3)
{
//initialize with input=cos_666+cos_2200
for(j = 0; j < 128; j++)
input[j] = input1[j] + input3[j];
}
{
//soft decision
enc_output[buffercount] = modulate(v1);
buffercount++;
enc_output[buffercount] = modulate(v2);
buffercount++;
enc_output[buffercount] = modulate(v3);
buffercount++;
}
}
b. Correlative coding:
Transmit 2W symbols/s with zero ISI, using the theoretical minimum bandwidth of W Hz, without
infinitely sharp filters. Correlative coding (or duobinary signaling or partial response signaling)
introduces some controlled amount of ISI into the data stream rather than trying to eliminate ISI
completely.
Doubinary signalling:
Expected OUTPUT:
Observations:
Experiment 10
Inter symbol Interference using eye pattern and Zero
forcing Equalizer
Aim: a) Simulate to study the Inter symbol Interference using eye pattern
b) Simulate the Zero forcing Equalizer
Theory: Inter symbol interference and the noise are the main source decides the
performance of the communication system. Eye pattern is It is an experimental tool for the
evaluation of the combined effects of channel noise and inter symbol interference on the
performance of a baseband pulse-transmission system. It is the synchronized superposition of
all possible realizations of the signal of interest viewed within a particular signaling interval.
1. The width of the eye opening defines the time interval over which the received signal
can be sampled without error from inter symbol interference; it is apparent that the
preferred time for sampling is the instant of time at which the eye is open the widest.
2. The sensitivity of the system to timing errors is determined by the rate of closure of
the eye as the sampling time is varied.
3. The height of the eye opening , a t a specified sampling time, defines the noise margin
of the system.
Eye diagram, is an oscilloscope display in which a digital data signal from a receiver is
repetitively sampled and applied to the vertical input, while the data rate is used to trigger the
horizontal sweep. It is so called because, for several types of coding, the pattern looks like a
series of eyes between a pair of rails.
Expected output:
Theory:
A general problem found in high speed communication is inter-symbol interference. ISI
occurs when a transmission interferes with itself and the receiver cannot decode the
transmission correctly The all-pass assumption made in the AWGN (or non-dispersive)
channel model is rarely practical. Due to the scarcity of the frequency spectrum, we usually
filter the transmitted signal to limit its bandwidth so that efficient sharing of the frequency
resource can be achieved. Moreover, many practical channels are band-pass and, in fact, they
often respond differently to inputs with different frequency components, i.e., they are
dispersive. We have to refine the simple AWGN (or non-dispersive) model to accurately
represent this type of practical channels. One such commonly employed refinement is the
dispersive channel mode,
Where u(t) is the transmitted signal, hc(t) is the impulse response of the channel, and n(t) is
AWGN with power spectral density N0/2. In essence, we model the dispersive characteristic
of the channel by the linear filter hc(t). The simplest dispersive channel is the band limited
channel for which the channel impulse response hc(t) is that of an ideal low pass filter. This
low-pass filtering smears the transmitted signal in time causing the effect of a symbol to
spread to adjacent symbols when a sequence of symbols is transmitted. The resulting
interference, inter-symbol interference (ISI), degrades the error performance of the
communication system. There are two major ways to mitigate the detrimental effect of ISI.
The first method is to design band-limited transmission pulses which minimize the effect of
ISI. We will describe such a design for the simple case of band limited channels. The ISI free
pulses obtained are called the nyquist pulses. The second method is to filter the received
signal to cancel the ISI introduced by the channel impulse response. This approach is
generally known as equalization.
1.Adaptive equalization:
Adaptive equalizer is an equalizer that automatically adapts to time-varying properties of the
communication
channel. It is frequently used with coherent modulations such as phase shift keying,
mitigating the effects of
multipath propagation and Doppler spreading.
2. Blind equalization:
Equalizer minimizes the error between actual output and desired output by continuous Blind
is a digital signal
processing technique in which the transmitted signal is inferred from the received signal.
While making use only of
the transmitted signal statistics.
3. Zero Forcing Equalizer:
Zero Forcing Equalizer is a linear equalization algorithm used in communication systems,
which inverts the frequency response of the channel. This equalizer was first proposed by
Robert Lucky. The Zero-Forcing Equalizer
applies the inverse of the channel to the received signal, to restore the signal before the
channel. The name Zero Forcing corresponds to bringing down the ISI to zero in a noise free
case. This will be useful when ISI is significant compared to noise. For a channel with
frequency response F(f) the zero forcing equalizer C(f) is constructed such
that C(f) = 1 / F(f). Thus the combination of channel and equalizer gives a flat frequency
response and linear phase F(f)C(f) = 1.If the channel response for a particular channel is H(s)
then the input signal is multiplied by the reciprocal of this.
MATLAB CODE for Zero forcing equalizer for MIMO(2x2) using BPSK Modulation scheme
clear
N = 10^6; % number of bits or symbols
Eb_N0_dB = [0:50]; % multiple Eb/N0 values
nTx = 2;
nRx = 2;
for ii = 1:length(Eb_N0_dB)
% Transmitter
ip = rand(1,N)>0.5; % generating 0,1 with equal probability
r = y - squeeze(h2SS.*ipHatMod2SS);
% maximal ratio combining - for symbol in the first spatial dimension
h1SS = squeeze(h(:,1,:));
yHat1SS = sum(conj(h1SS).*r,1)./sum(h1SS.*conj(h1SS),1);
yHat(1:2:end) = yHat1SS;
% receiver - hard decision decoding
ipHat = real(yHat)>0;
% counting the errors
nErr(ii) = size(find([ip- ipHat]),2);
end
output:
Appendix-A
Simulink
Simulink, developed by MathWorks, is a data flow graphical programming language tool for
modeling, simulating and analyzing multi-domain dynamic systems. Its primary interface is a
graphical block diagramming tool and a customizable set of block libraries. It offers tight integration
with the rest of the MATLAB environment and can either drive MATLAB or be scripted from it.
Simulink is widely used in control theory and digital signal processing for multi-domain simulation
and Model-Based Design.
Simulink® is a block diagram environment for multi domain simulation and Model-Based Design. It
supports system-level design, simulation, automatic code generation, and continuous test and
verification of embedded systems. Simulink provides a graphical editor, customizable block libraries,
and solvers for modeling and simulating dynamic systems. It is integrated with MATLAB®, enabling
you to incorporate MATLAB algorithms into models and export simulation results to MATLAB for
further analysis.
A number of MathWorks and third-party hardware and software products are available for use with
Simulink .It can automatically generate C source code for real-time implementation of systems. As
the efficiency and flexibility of the code improves, this is becoming more widely adopted for
production systems,in addition to being a popular tool for embedded system design work because of
its flexibility and capacity for quick iteration. Embedded Coder creates code efficient enough for use
in embedded systems
Matlab:
Although MATLAB is intended primarily for numerical computing, an additional package, Simulink,
adds graphical multi-domain simulation and Model-Based Design for dynamic and embedded
systems. MATLAB is the programming environment, we need to program in the command window or
m files. SIMULINK is used to do simulations, it has many blocks , you just need to drag and connect
them as you need. Simulink is largely a controls oriented solution. It graphically depicts math like
products, sums, integrals, etc. However, it's conditional logic facility is lacking. Matlab and simulink ,
both environments developed by MathWorks. It is used in academic and research institutions as well
as industrial enterprises.
Appendix-B
DSK6713
Interconnection between AIC 23 and DSP
The figure below describes interconnection between Analog Interface Circuit 23(AIC 23) and
DSP.
Audio data is transferred back and forth from the codec through McBSP1 (Multi Channel
Buffered Serial port), a bidirectional serial port. The EDMA (Enhanced Direct Memory
Access) is configured to take every 16-bit signed audio sample arriving on McBSP1 and store
it in a buffer in memory until it can be processed. The DSP process the data in the buffer.
Once it has been processed, it is sent back out through McBSP1 to the codec for output. One
EDMA channel is used to transmit data to the codec while another is used to receive data
from the codec. The McBSP0 is used to control the internal configuration registers of AIC
23.
The scheme uses EDMA to relieve the DSP from the duty of data transfer. The EDMA
controller takes incoming audio data directly from McBSP1 and places it in a memory buffer.
It also takes data from a memory buffer and sends it to McBSP1 to generate the audio output.
Separate EDMA channels are used to transmit and receive audio data.
The audio data is a series of 16-bit signed integers representing the amplitude of the input
waveform at a particular point in time. Since the AIC23 is a stereo codec, the audio(or line)
input consists of both left and right audio channels. Data is received in a frame consisting of
two elements, one 16-bit sample from the left channel followed by one 16-bit sample from
the right channel. Line In and Line out are used to input and take out the signal respectively.
components and these APIs are used to access he respective hardware components. Note that
an API is nothing but a function.
function. In this program, we are setting sampling rate to 8 kHz by passing argument
freq=1 to the API module.
To support all BSL functions, dsk6713.h and dsk6713_aic23.h header files and libraryfile
dsk6713bsl.lib are required.