0% found this document useful (0 votes)
183 views

CS2 Lab PDF

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
183 views

CS2 Lab PDF

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

Communication System II Laboratory

R.V. College of Engineering


Bengaluru - 59
(Autonomous Institution affiliated to VTU, Belagavi)
Department of Electronics and Communication
Engineering

Communication Systems-II
12EC63
Laboratory Manual

(Autonomous Scheme 2012)

Dept. of ECE, RVCE Page 1


Communication System II Laboratory

Department of Electronics and Communication


Engineering

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.

Program Educational Objectives (PEOs):


PEO1. To prepare students to apply concepts of mathematics, science and computing to electronics
& communication engineering.
PEO2. To prepare students to design & develop interdisciplinary & innovative systems.
To inculcate effective communication skills, team work, ethics, leadership in preparation for a
successful career in industry and R & D organizations.

Dept. of ECE, RVCE Page 2


Communication System II Laboratory

R.V. College of Engineering, Bengaluru - 59


(Autonomous Institution affiliated to VTU, Belagavi)

Department of Electronics and Communication


Engineering

Laboratory Certificate

This is to certify that Mr. / Ms ________________________________________


has satisfactorily completed the course of Experiments in Practical
_______________________________________ prescribed by the Department
during the year _____________________

Name of the Candidate: ______________________________________

USN No.: ___________________ Semester:____________________

Marks in Words

Signature of the staff in-charge Head of the Department

Date:

Dept. of ECE, RVCE Page 3


Communication System II Laboratory

SCHEME OF CONDUCT AND EVALUATION

CLASS: VI SEMESTER CIE MARKS: (Max.) : 50


YEAR: 2014-15 SEE MARKS: (Max) : 50
SEE: 3hrs
Expt. Duration Max. Marks
Date TITLE
No. in Hrs Marks Obtained
1. Line codes with PSD and Probability of error 2.30 10

2 Pulse Amplitude Modulation and Demodulation 2.30 10

3. ASK Modulation and Demodulation 2.30 10

4. FSK modulation and demodulation 2.30 10

5. BPSK modulation and demodulation 2.30 10

6. QPSK modulation and demodulation 2.30 10

7. MSK modulation and demodulation 2.30 10

8. QAM modulation and demodulation 2.30 10

9. a. Convolution coding and decoding 2.30 10


b. Correlative coding using Duo binary signaling
10. a. Inter symbol Interference using eye pattern 2.30 10
b. Zero forcing Equalizer
TEST 2.30 50

TOTAL MARKS

Dept. of ECE, RVCE Page 4


Communication System II Laboratory

COMMUNICATION SYSTEMS II LAB (12EC63)


List of Experiments for Communication System II Lab:

1. Line codes with PSD and Probability of error

2. a) Pulse Amplitude Modulation and Demodulation using MATLAB


b) PAM Implementation on DSP processor.

3. a) ASK Modulation and Demodulation using MATLAB


b) ASK Implementation on DSP processor.

4. a) FSK modulation and demodulation using MATLAB


b) FSK implementation on DSP processor.

5. a) BPSK modulation and demodulation using MATLAB


b) BPSK implementation on DSP processor.

6. a) QPSK modulation and demodulation using MATLAB


b) QPSK implementation on DSP processor.

7. MSK modulation and demodulation using MATLAB

8. QAM modulation and demodulation using MATLAB

9. a) Convolution coding and Viterbi decoding using MATLAB


b) Simulation of Correlative coding on MATLAB

10. a) Simulation of Inter symbol Interference using eye pattern


b) Simulation of Zero forcing Equalizer on MATLAB

Dept. of ECE, RVCE Page 5


Communication System II Laboratory

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

1. Open Code composer Studio(CCS) using short cut of CCS 5.5.0

2. Choose the Workspace location (Preferably on D Drive like D:\CSLab\A1,


D:\CSLab\A2....)
3. Create new project by menu Project New CCS Project
4. Enter Project name USN_Exp_name(e.g. EC104_Ask.Dont give project name start with
number).
Output type: Executable (default)
Device Family: C6000
Variant: C671x Floating-point DSP, TMS320C6713
Connection: Spectrum Digital DSK-EVM-eZdsp on board Emulator
Project template and examples: Empty Project
 Advanced setting:
Linker Command file: C:\DSK6713\support\C6713dsk.cmd Click finish (Fig.1)

Fig.1 Creating New Project

Dept. of ECE, RVCE Page 6


Communication System II Laboratory

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)

Fig.2. Deletion of previous project.

6. Start to write the source program in main.c & save by File Save

7. C6000 Compiler setting, Go Project Properties Build C6000 Compiler


a) Include Support files, Chip select (CSL) & Board support(BSL) files ,( Fig.3)

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

Fig.3. Inclusion of chip select, board support files in C6700 Compiler.

Dept. of ECE, RVCE Page 7


Communication System II Laboratory

b) In Advanced Options,

Predefined Symbols: CHIP_6713 (Remove any previous symbols by delete )(Fig.4)

Fig.4. Define predefined symbol in C6700 Compiler.

Runtime Model Options:

Data Access model: far (Fig.5)

Fig.5. Define Runtime Memory Model in C6700 Compiler.

8. C6000 Linker Settings:

a) Under Basic option: (Fig.6)

 Set C system stack size: 0x800


 Heap size for C/C++ dynamic memory allocation: 0x800

Fig.6. Define stack & heap size in C6700 Compiler.

Dept. of ECE, RVCE Page 8


Communication System II Laboratory

b) Under File Search Path:


Add following Library Paths (Fig.7.)
 C:\DSK6713\lib\dsk6713bsl.lib
 C:\DSK6713\lib\csl6713.lib

Fig.7. Inclusion of Board & chip support libraries in C6700 Linker

c) In Advanced Options:

In Diagnostics: Choose Suppress warning (--no warning) (Fig.8.)

Fig.8. C6700 Linker Diagnostic option

Then Click Ok

9. Support files to Project


Project Add Files.. Then browse to C:\DSK6713\support then add following files (c
support file & polling Assembly file)
 C6713dskinit.c
 Vectors_poll.asm
& choose File operation Copy files then enter Ok

Dept. of ECE, RVCE Page 9


Communication System II Laboratory

10. Build the Project:


Manual Build: Project Build Automatically (Unclick)
Project Build Project
Project is build successfully & output file(.out) is generated((Fig.9.) & can be seen in
console,

Fig.9. Console Window After successful Build

11. Connection DSK Hardware & Diagnostic Test

 Connect Power supply

 Connect the USB cable with PC.

 Run the Diagnostic Test :( From Desktop icon)

Dept. of ECE, RVCE Page 10


Communication System II Laboratory

Pop-up menu User Access control: Yes & choose Start After successful test ,close the
window

12. Connection of Input & Output signals

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

Stereo pin configuration

Dept. of ECE, RVCE Page 11


Communication System II Laboratory

13. Debug the Program

Go CCS V5.5, Select Run Debug


The Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator is connected to DSK 6713
Target board (On successful connection) & shown in the Debug console. If it’s not
connected(error msg shown as “emulator error”), check that the Diagnostics Window is
closed (Step 12) or unplug the power supply & reconnect it

Screenshot On successful connection of Target

14. Run the Program,

Go to Run Resume

15. Verify the waveform in the CRO .

Dept. of ECE, RVCE Page 12


Communication System II Laboratory

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.

Line codes with their PSD and the Probability of error

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.

Dept. of ECE, RVCE Page 13


Communication System II Laboratory

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) Algorithm for different line codes:

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

d) Similarly obtain unipolar RZ using ones and zeros function


%Unipolar RZ
U_rz=[];
for k=1:N;
c = ones(1,fs/2);
b = zeros(1,fs/2);
p = [c b];
U_rz = [U_rz A*a(k)*p];
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.

Algorithm to find PSD:

1. Take initial value bit rate=1, time=(1/rate), pulse amplitude v=1;


2. Using the below given formula, plot PSD for different line codes.

a) Unipolar NRZ

Dept. of ECE, RVCE Page 14


Communication System II Laboratory

b) Polar NRZ

c) Bipolar RZ (50% duty cycle)

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

b) Polar NRZ and Manchester code

Note: Polar NRZ and Manchester code has same Pe for equiprobable 1's and 0's

c) Biploar RZ

2. Plot each waves in semi log sheet.

Dept. of ECE, RVCE Page 15


Communication System II Laboratory

Expected Output (line codes):

For bit stream 0 1 0 1 0 0 1 1 1 1

Dept. of ECE, RVCE Page 16


Communication System II Laboratory

Expected output(Power spectral density):

Expected output(Probability of error):

Dept. of ECE, RVCE Page 17


Communication System II Laboratory

Observation:

Write-up Execution Viva Total Sign


(3M) (3M) (4M) (10M)

Dept. of ECE, RVCE Page 18


Communication System II Laboratory

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.

Pulse Amplitude Modulation simulation in MATLAB

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.

Dept. of ECE, RVCE Page 19


Communication System II Laboratory

Algorithm for MATLAB Code:

1. Generate random 4-PAM (+/-1, +/-3) sequence say N_length=20 (for easy
analysis)

2. Generate a pulse shaping function

3. Convolve the pulse shaping function with data to get the transmitted data

4. Add wide-band AWGN samples

5. Extract up-sampled pulses using correlation implemented as a convolving filter

6. Down-sample to symbol rate

7. Simulate decision device and symbol matching performance assessment

Expected Output:

For N=20 and σ=0.8

4-PAM waveform and spectrum

Dept. of ECE, RVCE Page 20


Communication System II Laboratory

Channel Output and spectrum

Matched filter output and spectrum

Dept. of ECE, RVCE Page 21


Communication System II Laboratory

After sampling (with delay of M samples)

Observation:

For N_length=4 σ=0 σ = 0.5 σ = 0.8


Generated PAM sequence
(m)
Sampled sequence (z)
Decision device output
(mprime)
cluster_variance
Percentage_symbol_errors
Snr_dB
P_error_ml

For N_length=20 σ=0 σ = 0.5 σ = 0.8


cluster_variance
Percentage_symbol_errors
Snr_dB
P_error_ml

For N_length=1024 (2^10) σ = 0.8


Percentage_symbol_errors
P_error_ml

Dept. of ECE, RVCE Page 22


Communication System II Laboratory

a) Pulse Amplitude Modulation on DSK6713 kit

To generate PAM using C a 4 level lookup table is used.


4-level PAM lookup table for mapping

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.

Dept. of ECE, RVCE Page 23


Communication System II Laboratory

Code:

#include "dsk6713_aic23.h" //support file for codec, DSK


Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
#define DSK6713_AIC23_INPUT_MIC 0x0015
#define DSK6713_AIC23_INPUT_LINE 0x0011
Uint16 inputsource=DSK6713_AIC23_INPUT_LINE; // select input
#include <math.h> //for performing modulation operation
int i_4PAM_M, j_4PAM_M;
int j_4PAM_D;
int k;
int masked_value,demod_level,initial,buffer, output, assign,bit;
int temp[4];
int data_4PAM[4];
short mode=1;
Uint32 sample_data;
Uint32 input_sample();//Declarations of in built functions
void output_sample(int);
void comm_poll();
void main()
{
//init DSK, codec, McBSP
initial=0x7FFF;
for(k=0; k<4; k++) //forms look-up table for 4-level PAM
{
assign = initial-(k*0x5555);
data_4PAM[k] = assign;
}
int i_4PAM_M=96;
comm_poll();
while(1) //infinite loop
{
switch(mode)
{
case 1:
{
//4-PAM Modulator: Assigns sampled data coming from an input
//source to 4 predetermined voltage levels.
if (i_4PAM_M==96) //new input is taken every 96 samples
{
sample_data = input_sample(); //inputs data
i_4PAM_M=0;
j_4PAM_M=0;
}

Dept. of ECE, RVCE Page 24


Communication System II Laboratory

masked_value = sample_data& 0x0003; //masks sample as 2-bit segments


output = data_4PAM[masked_value]; //gets corresponding level
output_sample(output); //outputs corresponding voltage level 12 times
j_4PAM_M++; //repeated output counter
if (j_4PAM_M==12) //checks if repetition is over
{
j_4PAM_M=0;
sample_data = sample_data>> 2; //shifts input to mask next segment
}
i_4PAM_M++;
break;
}
//-------------------------------------------------------------------------------------------------------- case
2:
{
//4-PAM Demodulator
sample_data = input_sample(); //inputs data
buffer=0;
//initializing buffer
for (j_4PAM_D=0; j_4PAM_D<8; j_4PAM_D++)
{
masked_value = sample_data & 0x0003;//masks input sample as 2-bit segments
output = data_4PAM[masked_value];//retrieves the corresponding hex value from data //table
sample_data = sample_data >> 2;//shifts input so as to mask another part on the next //cycle
demod_level = (initial - output)/(0x5555);//determines which level was transmitted by //doing
inverse operation to modulator
demod_level = demod_level << 14; //aligns constructed value since least significant //bits
are first extracted
buffer = buffer + demod_level; //adds bit pattern just recovered to previously formed //output
sample
buffer = buffer >> 2; //creates vacancy for bits coming next
}
output_sample(buffer*16); //adjusts output voltage level
break;
}
}
}
}
Observations:

Dept. of ECE, RVCE Page 25


Communication System II Laboratory

Write-up Execution Viva Total Sign


(3M) (3M) (4M) (10M)

Dept. of ECE, RVCE Page 26


Communication System II Laboratory

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

Theory: Amplitude shift keying - ASK - in the context of digital communications is a


modulation process, which imparts to a sinusoid two or more discrete amplitude levels. These
are related to the number of levels adopted by the digital message. For a binary message
sequence there are two levels, one of which is typically zero. Thus the modulated waveform
consists of bursts of a sinusoid. Figure 5.1 illustrates a binary ASK signal, together with the
binary sequence which initiated it.

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.

Figure 5.1:ASK signal and the message

a) Algorithm for ASK modulation and demodulation

ASK Modulation

1. Assign duration of the Signal(t)[time vector]

2. Assign Signal Power (E_s1, E_s2)

3. Assign Noise Power(No)

Dept. of ECE, RVCE Page 27


Communication System II Laboratory

4. Choose appropriate SNR

5. Set the Frequency (w)

6. Noise Standard Deviation(sig_n) is given by

sig_n = sqrt(No/2)

7. Assign the Number of bits(N)


8. To create Signal Vector [ to generate carrier signal ]
Multiply signal Powers with cosine wave (cos w*t)

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.

n = sig_n*randn(1,length(m_sig)); %Create a noise vector

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

17. In order to detect the signal(Demodulated data output),


Correlate received signal(r) with the basis function.

Dept. of ECE, RVCE Page 28


Communication System II Laboratory

18. Compare Input Data Stream and Demodulated Output Data.


19. To make the decision on the received data bits
Set the appropriate threshold level and compare it with the demodulated data.
20. Compute the difference (x) between the input signal and the demodulated signal.

x=received_sig - signal;

21. Compute the number of errors as shown

n_errors = sum(and(x,1))

22. To calculate the percentage error(p_error)


p_error = n_errors / N

23. Plot the transmitted signal


24. Plot the received signal
25. Plot the detections

Expected Waveforms:

Dept. of ECE, RVCE Page 29


Communication System II Laboratory

b) Implementation of ASK modulation and demodulation in DSP kit


//Modulation Schemes (ASK)
//Modulation Schemes (ASK)
#include "DSK6713_aic23.h"
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ;
#define DSK6713_AIC23_INPUT_LINE 0x0011
#define DSK6713_AIC23_INPUT_MIC 0x0015
Uint32 sample_data;
Uint16 inputsource=DSK6713_AIC23_INPUT_LINE; // select input
#include<math.h>//Initialization:
int i_ASK_M, i_ASK_D;
int j_ASK_M, j_ASK_D;
int k;
int masked_value, demod_level, buffer, initial, output, assign, bit;
int temp[4];
short mode=1;
Uint32 sample_data;
Uint32 input_sample();
void output_sample(int);
void comm_poll();
//Data table for ASK MOD & DEMOD:
int data_ASK[2][4]={0,0,0,0,0, -1000, 0, 1000};
void main()
{
//ASK Modulator:
i_ASK_M=64; j_ASK_M=0;
comm_poll(); //Polling interrupt mode
while(1) //infinite loop
{
switch(mode)
{
//---------------------------------------------------------------------------------------------------------
case 1:
{
//ASK Modulator
if (i_ASK_M==64) //determines when to get new input
{
sample_data = input_sample(); //inputs data
i_ASK_M=0;
j_ASK_M=0;
}
masked_value = sample_data& 0x0001; //masks input sample
output = data_ASK[masked_value][j_ASK_M]; //gets level from table
output_sample(output*10); //outputs sinusoid
j_ASK_M++; //repeated output counter
if (j_ASK_M==4) //checks if 1-bit segment was output
{
j_ASK_M=0;
sample_data = sample_data>> 1;//shifts input mask another part
}
i_ASK_M++; break;
}

Dept. of ECE, RVCE Page 30


Communication System II Laboratory

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

Dept. of ECE, RVCE Page 31


Communication System II Laboratory

Write-up Execution Viva Total Sign


(3M) (3M) (4M) (10M)

Dept. of ECE, RVCE Page 32


Communication System II Laboratory

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

a) Algorithm forFSK modulation and demodulation

Dept. of ECE, RVCE Page 33


Communication System II Laboratory

FSK MODULATION

1. Assign Duration of the Signal(t)[time vector]

2. Assign Signal Power (E_s)

3. Assign Noise Power(No)

4. Choose appropriate SNR

5. Set the Frequencies (w1,w2)

6. Noise Standard Deviation(sig_n) is given by

sig_n = sqrt(No/2)

7. Assign the Number of bits(N)


8. To create Signal Vector [ to generate carrier signal ]
Multiply signal Powers with cosine waves (cos w1*t) and (cos w2*t)

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.

n = sig_n*randn(1,length(m_sig)); %Create a noise vector

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;

Dept. of ECE, RVCE Page 34


Communication System II Laboratory

FSK Demodulation
16. create Basis function
sigma1 = E_s*cos(w1*t); %Create basis functions
sigma2 = E_s*cos(w2*t);

17. In order to detect the signal(Demodulated data output),


Correlate received signal(r) with the basis function.
18. Compare Input Data Stream and Demodulated Output Data.
19. To make the decision on the received data bits
Set the appropriate threshold level and compare it with the demodulated data.
20. Compute the difference (x) between the input signal and the demodulated signal.

x=received_sig - signal;

21. Compute the number of errors as shown

n_errors = sum(and(x,1))

22. To calculate the percentage error(p_error)


p_error = n_errors / N

23. Plot the transmitted signal


24. Plot the received signal
25. Plot the detections

Dept. of ECE, RVCE Page 35


Communication System II Laboratory

b) Implementation of FSK modulation and demodulation in DSP kit

//Modulation Schemes (FSK)


#include "DSK6713_aic23.h"
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ;
#define DSK6713_AIC23_INPUT_LINE 0x0011
#define DSK6713_AIC23_INPUT_MIC 0x0015
Uint16 inputsource=DSK6713_AIC23_INPUT_LINE; // select input
#include<math.h>//Initialization:
int i_FSK_M, i_FSK_D;
int j_FSK_M, j_FSK_D;
int k;
int masked_value, demod_level, buffer, initial, output, assign, bit;
int temp[4];
short mode=1;
Uint32 sample_data;
Uint32 input_sample(); //Declaration of in built functions
void output_sample(int);
void comm_poll(); //Polling interrupt mode

//Data table for FSK MOD & DEMOD:


int data_FSK[2][8]= {{0, 1000, 0, -1000, 0, 1000, 0, -1000},
{0, 500, 1000, 500, 0, -500, -1000, -500}
};
void main()
{
i_FSK_M=64; j_FSK_M=0;

Dept. of ECE, RVCE Page 36


Communication System II Laboratory

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;
}

Dept. of ECE, RVCE Page 37


Communication System II Laboratory

bit = bit << 15; //aligns determined bit to right location


buffer = buffer + bit;
if (i_FSK_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:

Write-up Execution Viva Total Sign


(3M) (3M) (4M) (10M)

Dept. of ECE, RVCE Page 38


Communication System II Laboratory

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.

Figure 7.1: PSK signal and the message

a) Algorithm for BPSK modulation and demodulation

PSK MODULATION

1. Assign Duration of the Signal(t)[time vector]

2. Assign Signal Power (E_s)

3. Assign Noise Power(No)

4. Choose appropriate SNR

5. Set the Frequency (w)

6. Noise Standard Deviation(sig_n) is given by

sig_n = sqrt(No/2)

Dept. of ECE, RVCE Page 39


Communication System II Laboratory

7. Assign the Number of bits(N)


8. To create Signal Vector [ to generate carrier signal ]
Multiply signal Powers with cosine wave (cos w*t) and sine wave (sin w*t).

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.

n = sig_n*randn(1,length(m_sig)); %Create a noise vector

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

17. In order to detect the signal(Demodulated data output),


Correlate received signal(r) with the basis function.
18. Compare Input Data Stream and Demodulated Output Data.
19. To make the decision on the received data bits
Set the appropriate threshold level and compare it with the demodulated data.
20. Compute the difference (x) between the input signal and the demodulated signal.

x=received_sig - signal;

Dept. of ECE, RVCE Page 40


Communication System II Laboratory

21. Compute the number of errors as shown

n_errors = sum(and(x,1))

22. To calculate the percentage error(p_error)


p_error = n_errors / N

23. Plot the transmitted signal


24. Plot the received signal
25. Plot the detections

Expected Waveforms:

Dept. of ECE, RVCE Page 41


Communication System II Laboratory

b) Implementation of BPSK modulation and demodulation in DSP kit


//Modulation Schemes (BPSK)
#include "DSK6713_aic23.h"
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ;
#define DSK6713_AIC23_INPUT_LINE 0x0011
#define DSK6713_AIC23_INPUT_MIC 0x0015
Uint16 inputsource=DSK6713_AIC23_INPUT_LINE; // select input
#include<math.h>//Initialization:
int i_BPSK_M, i_BPSK_D;
int j_BPSK_M, j_BPSK_D;
int k;
int masked_value, demod_level, buffer, initial, output, assign, bit;
int temp[4];
short mode=1;
Uint32 sample_data;
Uint32 input_sample();
void output_sample(int);
void comm_poll();
//Data table for BPSK MOD & DEMOD:
int data_BPSK[2][4]={0, 1000, 0, -1000,0, -1000, 0, 1000}; //180 degree
void main()
{
i_BPSK_M=64;j_BPSK_M=0;
comm_poll(); //Polling interrupt mode
while(1) //infinite loop
{
switch(mode)
{
//--------------------------------------------------------------------------------------------------------
case 1:
{
//BPSK Modulator
if (i_BPSK_M==64) //determines when to get new input
{
sample_data = input_sample(); //inputs data
i_BPSK_M=0;
j_BPSK_M=0;
}
masked_value = sample_data& 0x0001;//masks input sample as 1-bit segments
output = data_BPSK[masked_value][j_BPSK_M];
output_sample(output*10); //outputs corresponding sinusoid
j_BPSK_M++; //repeated output counter
if (j_BPSK_M==4) //checks if 1-bit segment was output
{
j_BPSK_M=0;
sample_data = sample_data>> 1; //shifts input so as to mask another part
}

Dept. of ECE, RVCE Page 42


Communication System II Laboratory

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:

Dept. of ECE, RVCE Page 43


Communication System II Laboratory

Write-up Execution Viva Total Sign


(3M) (3M) (4M) (10M)

Dept. of ECE, RVCE Page 44


Communication System II Laboratory

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.

Fig8.1: QPSK constellation.

Dept. of ECE, RVCE Page 45


Communication System II Laboratory

Figure 8.2: QPSK signal and the message

a) Algoritm fprQPSK Modulator and De-modulator using MATLAB:

PSK MODULATION

1. Assign Duration of the Signal(t)[time vector]

2. Assign Signal Power (E_s)

3. Assign Noise Power(No)

4. Choose appropriate SNR

5. Set the Frequency (w)

6. Noise Standard Deviation(sig_n) is given by

sig_n = sqrt(No/2)

7. Assign the Number of bits(N)


8. To create Signal Vector [ to generate carrier signal ]
Multiply signal Powers with cosine wave (cos w*t) and sine wave (sin w*t).

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.

Dept. of ECE, RVCE Page 46


Communication System II Laboratory

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.

n = sig_n*randn(1,length(m_sig)); %Create a noise vector

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;

25. Compute the number of errors as shown

n_errors = sum(and(x,1))

26. To calculate the percentage error(p_error)


p_error = n_errors / N

27. Plot the transmitted signal


28. Plot the received signal
29. Plot the detections

Dept. of ECE, RVCE Page 47


Communication System II Laboratory

Expected Waveforms:

Dept. of ECE, RVCE Page 48


Communication System II Laboratory

Output:

b) QPSK Modulator and De-modulator using DSP Kit:


Uint32 input_sample();
void output_sample(int);
void comm_poll();//Modulation Schemes (QPSK)
#include "DSK6713_aic23.h"
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ;
#define DSK6713_AIC23_INPUT_LINE 0x0011
#define DSK6713_AIC23_INPUT_MIC 0x0015
Uint16 inputsource=DSK6713_AIC23_INPUT_LINE; // select input
#include<math.h> //Initialization:
int i_QPSK_M, i_QPSK_D;
int j_QPSK_M, j_QPSK_D ;
int k;
int masked_value, demod_level, buffer, initial, output, assign, bit;
int temp[4];
short mode=1; //gel file variable
Uint32 sample_data;
Uint32 input_sample();
void output_sample(int);
void comm_poll();
//Data table for QPSK MOD & DEMOD:
int data_QPSK[4][4]={0, 1000, 0, -1000, //phase=0 & symbol=00
1000, 0, -1000, 0, //phase=90 & symbol=01
-1000, 0, 1000, 0, //phase=270 & symbol=10
0, -1000, 0, 1000}; //phase=180 & symbol=11
void main()
{
i_QPSK_M=32; j_QPSK_M=0;
comm_poll();
while(1) //infinite loop
{
switch(mode)
{
//---------------------------------------------------------------------------------------------------------------

Dept. of ECE, RVCE Page 49


Communication System II Laboratory

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

Dept. of ECE, RVCE Page 50


Communication System II Laboratory

buffer = buffer + bit;


if (i_QPSK_D!=7) //prevents redundant shifting
buffer = buffer >> 2;
sample_data = sample_data>> 2; //shifts input so as to mask another part
}
output_sample(buffer);
break;
}
}
}
}
Observation:

Dept. of ECE, RVCE Page 51


Communication System II Laboratory

Write-up Execution Viva Total Sign


(3M) (3M) (4M) (10M)

Dept. of ECE, RVCE Page 52


Communication System II Laboratory

Experiment 7
MSK Modulation and Demodulation
Aim: a) MSK modulation and demodulation using MATLAB
b)Implement MSK mod and De-mod in DSP kit

Dept. of ECE, RVCE Page 53


Communication System II Laboratory

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.

Dept. of ECE, RVCE Page 54


Communication System II Laboratory

Observation:

Dept. of ECE, RVCE Page 55


Communication System II Laboratory

Write-up Execution Viva Total Sign


(3M) (3M) (4M) (10M)

Dept. of ECE, RVCE Page 56


Communication System II Laboratory

Experiment 8
QAM Modulation and Demodulation
Aim: a) QAM modulation and demodulation using MATLAB

QAM modulation and demodulation


Theory: If the in-phase and Quadrature components of the modulated signal are permitted
to be independent, the modulation scheme is called M-ary Quadrature Amplitude Modulation
(QAM). This is hybrid in nature in that the carrier experiences amplitude as well as phase
modulation. M-QAM is a two dimensional generalization of M-PAM.

Figure 9.2: QAM constellation

16-QAM MODULATOR AND DEMODULATOR


IMPLEMENTATION WITH AN AWGN CHANNEL

The METHODOLOGY of "16-QAM Modulator and Demodulator Implementation with an


AWGN Channel" is as follows

1. Input stream of 16 integers and convert to binary form


2. The binary form of 4 bits are passed through 4-bit register which takes first 2 bits to
the I-channel and the next 2 bits to the Q-channel for modulation with cos and sin
carriers respectively.
3. After the modulation, both the signals are added and the resultant is transmitted over
an AWGN channel which distorts the signal before it reaches the receiver.
4. At the receiver end the signal is detected and demodulated separately with sin and
cos waves for the separation of I and Q channels.
5. Both the signals are passed through LPFs and average value for each interval is
calculated and output bits are generated accordingly.

Dept. of ECE, RVCE Page 57


Communication System II Laboratory

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

Dept. of ECE, RVCE Page 58


Communication System II Laboratory

17. Demodulation by Amplitude Detection for both I and Q Channel


if amplitude of I-channel is -3, output is 00
if amplitude of I-channel is -1 output is 01
if amplitude of I-channel is 1 output is 10
if amplitude of I-channel is 3 output is 11
if amplitude of Q-channel is -3, output is 00
if amplitude of Q-channel is -1 output is 01
if amplitude of Q-channel is 1 output is 10
if amplitude of Q-channel is 3 output is 11
18. Compare Input Data Stream Demodulated Output Data
19. Generation of Constellation Diagram For Transmitted Data and Received Data

Expected output

Dept. of ECE, RVCE Page 59


Communication System II Laboratory

Dept. of ECE, RVCE Page 60


Communication System II Laboratory

Dept. of ECE, RVCE Page 61


Communication System II Laboratory

Observation:

Write-up Execution Viva Total Sign


(3M) (3M) (4M) (10M)

Dept. of ECE, RVCE Page 62


Communication System II Laboratory

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

and consists of 2 k code words of length n .


A convolutional code is a sequence of encoded symbols, which is generated by passing the
information sequentially through a binary shift register . On the transmit side, the
convolutional encoder takes data stream at rate of Rs as input. Then, it encodes the data to
output a code with coding rate of Rt. Finally, the resulting code is modulated and transmitted
across a noisy channel. The code rate can be defined as Rs/Rt. On the receive side, the
convolutional decoder receive data from the demodulator at transmit coding rate of Rt, and
perform the reverse process to get the original data at the rate of Rs . The figure below shows
an example of a three-stage shift register that implements a binary convolutional encoder
with code rate of 1 / 2 and constraint length of 3.

Dept. of ECE, RVCE Page 63


Communication System II Laboratory

Fig 9.1 (n, k) = (2, 1) binary Convolutional Encoder


By interleaving the upper and lower summers, the encoder generates the output. For

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

The final output sequence w is


w = (w1(1), w1(2), w2(1), w2(2), w3(1), w3(2), …)

In the current example, the final output to be transmitted is w = (1, 1, 0, 1, 1, 1, 0, 0, …).


On the receive end, the convolutional decoder uses the Viterbi algorithm which is also known
as the maximum likelihood decoding. The algorithm is based on the best path (shortest
Hamming distance) through the trellis tree. In this algorithm, all paths in the trellis are
searched and compared. The path with the smallest distance to the input sequence is selected.
Therefore, this decoding method results in the minimum bit error rate.

Viterbi decoding Algorithm:


The Viterbi decoding algorithm uses the trellis diagram to perform the decoding.
The basic cycle repeated by the algorithm at each stage into the trellis is
1. Add: At each cycle of decoding, the branch metrics enumerating from the nodes (states) of
the previous stage are computed. These branch metrics are added to the previously
accumulated and saved path metrics.

Dept. of ECE, RVCE Page 64


Communication System II Laboratory

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:

Convolutional Encoder on DSP kit

#include "dsk6713_aic23.h" //codec-dsk file support


Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define PI 3.141592654
#define MAX_INT 32767
#include "cos666.h"
#include "cos1500.h"
#include "cos2200.h"

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;

Dept. of ECE, RVCE Page 65


Communication System II Laboratory

//encoder functions
void encode(short);
void process_input();

//interrupt 11 implemented for handling gel files


interrupt void c_int11()
{
//input_sample and output_sample are dummy functions which
//do not do anything, but helps to handle the proper
//handling of the interrupt
y = input_sample();
output_sample(y);

//check for change in slider positions for all gel files


if((oldmode != mode) ||
(oldnoise != noiselevel)||
(oldinputstate != inputstate))
execute = 1;

//if any of the slider position was changed


if(execute == 1)
{
int j;
int noOfErrors = 0;
initialize();

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];
}

//reset the output arrays


for(j = 0; j < 128; j++)
dec_output[j] = 0;

Dept. of ECE, RVCE Page 66


Communication System II Laboratory

for(j = 0; j < no_of_dec_inputs; j++)


enc_output[j] = 0;

//do convolutional encoding


process_input();

//Main function of the application


void main()
{
//listen for interrupt 11
comm_intr();
while(1);
}

//This function resets the global variables


void initialize()
{
buffercount = 0;
output_bit_count = 0;
output_count = 0;
history_count = 0;
dec_input_count = 0;
}

//This function performs convolutional encoding


void encode(short in_bit)
{
short v1, v2, v3;
//find outputs of convolutional encoder
v1 = in_bit;
v2 = in_bit^b;
v3 = v2^a;
//set the contents of shift register
b = a;
a = in_bit;

//if basic Viterbi decoding


if(mode == 2)
{
enc_output[buffercount] = v1;
buffercount++;
enc_output[buffercount] = v2;
buffercount++;
enc_output[buffercount] = v3;
buffercount++;
}
else

Dept. of ECE, RVCE Page 67


Communication System II Laboratory

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

Precoded Doubinary Signaling:

Dept. of ECE, RVCE Page 68


Communication System II Laboratory

Expected OUTPUT:

Precoder output in binary form


1 1 0 0 1 0 0
Precoder output in volts
1 1 -1 -1 1 -1 -1
Duobinary coder output in volts:
2 2 0 -2 0 0 -2
Recovered original sequence at detector output
0 0 1 0 1 1 0

Dept. of ECE, RVCE Page 69


Communication System II Laboratory

Observations:

Write-up Execution Viva Total Sign


(3M) (3M) (4M) (10M)

Dept. of ECE, RVCE Page 70


Communication System II Laboratory

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

a) Inter symbol Interference

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.

Figure 10.1: eye pattern

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.

Dept. of ECE, RVCE Page 71


Communication System II Laboratory

Algorithm for Matlab code:

1. Initialise array with Ranging from -3 to 3 variable Length -11.


2. Generate PAM for array.
3. Plot with stem function.
4. Give appropriate label for x, y axis and title.
5. Take Sampling Frequency ex:24000
6. Time interval 1/8000.
7. Using formula generate Raised-cosine FIR filter.
8. Plot it with appropriate labels
9. Using formula generate Pulse shaping filter.
10. Plot it with appropriate labels.

Expected output:

Dept. of ECE, RVCE Page 72


Communication System II Laboratory

b) Zero forcing Equalizer

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,

r (t) = u(t) hc(t) + n(t);

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.

Equalizer is a digital filter that provides an approximate inverse of channel frequency


response. Equalization is to mitigate the effects of ISI to decrease the probability of error that
occurs without suppression of ISI, but this reduction of ISI effects has to be balanced with
prevention of noise power enhancement.

Dept. of ECE, RVCE Page 73


Communication System II Laboratory

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

Dept. of ECE, RVCE Page 74


Communication System II Laboratory

s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0


sMod = kron(s,ones(nRx,1));
sMod = reshape(sMod,[nRx,nTx,N/nTx]);% grouping in [nRx,nTx,N/NTx] matrix

h = 1/sqrt(2)*[randn(nRx,nTx,N/nTx) + j*randn(nRx,nTx,N/nTx)];%Rayleigh channel


n = 1/sqrt(2)*[randn(nRx,N/nTx) + j*randn(nRx,N/nTx)]; % white gaussian noise, 0dB
variance
% Channel and noise Noise addition
y = squeeze(sum(h.*sMod,2)) + 10^(-Eb_N0_dB(ii)/20)*n;
% Receiver
% Forming the ZF equalization matrix W = inv(H^H*H)*H^H
% H^H*H is of dimension [nTx x nTx]. In this case [2 x 2]
% Inverse of a [2x2] matrix [a b; c d] = 1/(ad-bc)[d -b;-c a]
hCof = zeros(2,2,N/nTx) ;
hCof(1,1,:) = sum(h(:,2,:).*conj(h(:,2,:)),1) ; % d term
hCof(2,2,:) = sum(h(:,1,:).*conj(h(:,1,:)),1) ; % a term
hCof(2,1,:) = -sum(h(:,2,:).*conj(h(:,1,:)),1); % c term
hCof(1,2,:) = -sum(h(:,1,:).*conj(h(:,2,:)),1); % b term
hDen = ((hCof(1,1,:).*hCof(2,2,:)) - (hCof(1,2,:).*hCof(2,1,:))); % ad-bc term
hDen = reshape(kron(reshape(hDen,1,N/nTx),ones(2,2)),2,2,N/nTx); % formatting for
division
hInv = hCof./hDen; % inv(H^H*H)
hMod = reshape(conj(h),nRx,N); % H^H operation
yMod = kron(y,ones(1,2)); % formatting the received symbol for equalization
yMod = sum(hMod.*yMod,1); % H^H * y
yMod = kron(reshape(yMod,2,N/nTx),ones(1,2)); % formatting
yHat = sum(reshape(hInv,2,N).*yMod,1); % inv(H^H*H)*H^H*y
% receiver - hard decision decoding on second spatial dimension
ipHat2SS = real(yHat(2:2:end))>0;
ipHatMod2SS = 2*ipHat2SS-1;
ipHatMod2SS = kron(ipHatMod2SS,ones(nRx,1));
ipHatMod2SS = reshape(ipHatMod2SS,[nRx,1,N/nTx]);
% new received symbol - removing the effect from second spatial dimension
h2SS = h(:,2,:); % channel in the second spatial dimension

Dept. of ECE, RVCE Page 75


Communication System II Laboratory

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

simBer = nErr/N % simulated ber


EbN0Lin = 10.^(Eb_N0_dB/10);
%theoryBer_nRx1 = 0.5.*(1-1*(1+1./EbN0Lin).^(-0.5));
close all
figure
%semilogy(Eb_N0_dB,theoryBer_nRx1,'bp-','LineWidth',2);
%hold on
semilogy(Eb_N0_dB,simBer,'mo-','LineWidth',2);
axis([0 25 10^-5 0.5])
grid on
legend('sim (nTx=2, nRx=2, ZF');
xlabel('Average Eb/No,dB');
ylabel('Bit Error Rate');
title('BER for BPSK modulation with 2x2 MIMO and ZF equalizer');

output:

Dept. of ECE, RVCE Page 76


Communication System II Laboratory

Dept. of ECE, RVCE Page 77


Communication System II Laboratory

Write-up Execution Viva Total Sign


(3M) (3M) (4M) (10M)

Dept. of ECE, RVCE Page 78


Communication System II Laboratory

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:

MATLAB (matrix laboratory) is a numerical computing environment and fourth-generation


programming language. Developed by MathWorks, MATLAB allows matrix manipulations, plotting
of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with
programs written in other languages, including C, C++, Java, and Fortran.

Relation between Matlab and Simulink:

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.

Dept. of ECE, RVCE Page 79


Communication System II Laboratory

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.

Board support Library (BSL) Functions


The BSL provides a C-language interface for configuring and controlling all on-board
devices. The library consists of discrete modules that are built and archived into a library
file.Each module represents an individual API (Application Programming Interface) and is
referred to simply as an API module. There will be separate APIs for different on board

Dept. of ECE, RVCE Page 80


Communication System II Laboratory

components and these APIs are used to access he respective hardware components. Note that
an API is nothing but a function.

BSL Functions used in the program


1. void DSK6713_init()
Sets all CPLD registers to their power-on states and initializes internal BSL data
structures. Must be called before any other BSL functions.
2.DSK6713_AIC23_CodecHandle DSK6713_AIC23_openCodec(int id,
DSK6713_AIC23_Config *Config)
Parameters: id – Specifies which codec to use, on the DSK6713, id = 0.
Config – Pointer to structure containing codec register values. The function will initialize
the codec registers with the values in the structure.
Return Value: Handle for the codec, used by the other codec module functions. The
return type is integer value. The DSK6713_AIC23_CodecHandle is
name given to integer data type.(refer dsk6713_aic23.h)
This function initializes all McBSP registers. If initialization is successful, this function
returns TRUE value (Note that in C program there is no Boolean TRUE or FALSE.
TRUE is defined as 1 and FALSE is defined as 0 in header files). This value act as handle
for the Codec. Other functions check this value before doing there operation.

DSK6713_AIC23_Config is a structure which is defined as follows.


typedef struct DSK6713_AIC23_Config {
int regs[DSK6713_AIC23_NUMREGS];
} DSK6713_AIC23_Config;

Note that, DSK6713_AIC23_NUMREGS=10;(no. of registers in AIC 23 Codec)

3.Int16 DSK6713_AIC23_read(DSK6713_AIC23_CodecHandle hCodec, Int32 *val);


Parameters: hCodec – Codec handle.
val – Address of 16 bit signed variable to receive codec data.
Return Value: TRUE – Data read successfully.
FALSE – Data port is busy.

Read 32 bits of codec data, loop to retry if data port is busy


while(!DSK6713_AIC23_read(hCodec, &data));
4.Int16 DSK6713_AIC23_write(DSK6713_AIC23_CodecHandle hCodec, Int32 val);
Parameters: hCodec – Codec handle.
val – 32 bit value signed to write to codec.
Return Value :TRUE – Data written successfully.
FALSE – Data port is busy.

Write 32-bit to the codec, loop to retry if data port is busy


while(!DSK6713_AIC23_write(hCodec, data));

5. void DSK6713_AIC23_setFreq(DSK6713_AIC23_CodecHandle hCodec, Uint32 freq);


Parameters: hCodec – Codec handle.
freq – Sample rate of the codec clock.
The default sampling rate is 48 kHz. This can be done by loading value 0x0081 in to
sample rate control register of AIC 23. This default value can be changed by using above

Dept. of ECE, RVCE Page 81


Communication System II Laboratory

function. In this program, we are setting sampling rate to 8 kHz by passing argument
freq=1 to the API module.

6.void DSK6713_AIC23_closeCodec(DSK6713_AIC23_CodecHandle hCodec)


Parameters: hCodec – Codec handle.
Close codec module.

To support all BSL functions, dsk6713.h and dsk6713_aic23.h header files and libraryfile
dsk6713bsl.lib are required.

Dept. of ECE, RVCE Page 82

You might also like