Code covered by the BSD License  

Highlights from
Echo Canceller Workbook targeting a dsPIC

image thumbnail

Echo Canceller Workbook targeting a dsPIC

by

 

22 Jan 2008 (Updated )

This set of models and word documents show an echo canceller development workflow.

hfk_pp.m
% hfk_pp.m
% convert the data record from hex to signed 16 bit
% integers
%   Copyright 2008 The MathWorks, Inc.
num_pts = 800;
compare_with_simulation_results = 0;  % set to zero if you only want the data in the ML workspace
plot_measured_data_only = 0;

fid = fopen('C:\Work\ecwf\hand_code\myec.mch','rt');
for k = 1:num_pts
    four_hex_chars = fgetl(fid);
    sout_dspic(k) = hex2dec(four_hex_chars);
    if (sout_dspic(k) >= 32768)
        sout_dspic(k) = sout_dspic(k) - 65536;
    end;
end;

if (plot_measured_data_only == 1)
  figure;plot(sout_dspic);
end

if (compare_with_simulation_results == 1) 
    sout_sl = logsout.Echo_Canceller.sout_linear.data;
    figure;plot(1:num_pts,sout_sl(1:num_pts)*2^14,'r',1:num_pts,sout_dspic,'b');grid;
    title('simulated EC output overlaid with dsPIC EC output');
    legend('SL','dsPIC');
    figure;plot(1:num_pts,sout_sl(1:num_pts)*2^14-sout_dspic','b');grid;
    title('difference between SL and dsPIC');
    %sout_f = 20*log10(abs(fft(sout_dspic,512)));
    %figure;plot([0:8000/512:8000-8000/512],sout_f);grid;
end

fclose(fid);
disp('done');

Contact us