diff options
author | ymherklotz <ymherklotz@gmail.com> | 2018-02-27 10:34:49 +0000 |
---|---|---|
committer | ymherklotz <ymherklotz@gmail.com> | 2018-02-27 10:34:49 +0000 |
commit | 2a7a81942e8603689517eaf119b3e847c6cf5f0b (patch) | |
tree | 671a4a9bf8f7cd42317d7d624ec5f5e241bd9e0b /lab5/RTDSP | |
parent | 15f14bfcf580dcf123178e254246e7993d077e63 (diff) | |
download | NoiseSilencer-2a7a81942e8603689517eaf119b3e847c6cf5f0b.tar.gz NoiseSilencer-2a7a81942e8603689517eaf119b3e847c6cf5f0b.zip |
Fixed proj folder for lab5ex2
Diffstat (limited to 'lab5/RTDSP')
-rw-r--r-- | lab5/RTDSP/.launches/RTDSP.launch | 4 | ||||
-rw-r--r-- | lab5/RTDSP/Matlab/elliptical.m | 10 | ||||
-rw-r--r-- | lab5/RTDSP/Matlab/filter_coeff_ell.txt | 2 | ||||
-rw-r--r-- | lab5/RTDSP/Matlab/filter_coeff_ell_a.txt | 1 | ||||
-rw-r--r-- | lab5/RTDSP/Matlab/filter_coeff_ell_b.txt | 1 | ||||
-rw-r--r-- | lab5/RTDSP/Matlab/gen_filter.m | 7 | ||||
-rw-r--r-- | lab5/RTDSP/intio.c | 46 |
7 files changed, 58 insertions, 13 deletions
diff --git a/lab5/RTDSP/.launches/RTDSP.launch b/lab5/RTDSP/.launches/RTDSP.launch index 169264f..7a7af12 100644 --- a/lab5/RTDSP/.launches/RTDSP.launch +++ b/lab5/RTDSP/.launches/RTDSP.launch @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <launchConfiguration type="com.ti.ccstudio.debug.core.CCELaunchType"> <stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/> -<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> <booleanAttribute key="com.ti.ccstudio.debug.core.MRU_PROGRAM_S_ONLY" value="false"/> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="com.ti.ccstudio.debug.core.CCEDebugger"/> <stringAttribute key="CCEDebugOptions.CPU_RESOLVE_OPTION" value="exact"/> <stringAttribute key="org.eclipse.debug.ui.DISPLAY_NAME" value="RTDSP [Debug] - Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/TMS320C671X"/> @@ -13,7 +13,7 @@ <stringAttribute key="CCEDebugOptions.TARGET_CONFIGURATION_OPTION" value="full"/> <stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8"?> <memoryBlockExpressionList/> "/> <stringAttribute key="com.ti.ccstudio.debug.core.MRU_PROGRAM_NAME" value="C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out"/> -<stringAttribute key="com.ti.ccstudio.debug.core.MRU_MODULES" value="<?xml version="1.0" encoding="UTF-8"?> <modules> <module name="C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Fri Jan 19 14:07:28 GMT 2018" time_long="1516370848357"/> <module name="C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Tue Jan 23 11:15:11 GMT 2018" time_long="1516706111426"/> <module name="C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 01 11:44:21 GMT 2018" time_long="1517485461898"/> <module name="C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 15 13:55:55 GMT 2018" time_long="1518702955359"/> <module name="C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Tue Feb 27 10:22:44 GMT 2018" time_long="1519726964340"/> </modules> "/> +<stringAttribute key="com.ti.ccstudio.debug.core.MRU_MODULES" value="<?xml version="1.0" encoding="UTF-8"?> <modules> <module name="C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Fri Jan 19 14:07:28 GMT 2018" time_long="1516370848357"/> <module name="C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Tue Jan 23 11:15:11 GMT 2018" time_long="1516706111426"/> <module name="C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 01 11:44:21 GMT 2018" time_long="1517485461898"/> <module name="C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 15 13:55:55 GMT 2018" time_long="1518702955359"/> <module name="C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Tue Feb 27 10:33:39 GMT 2018" time_long="1519727619443"/> </modules> "/> <stringAttribute key="CCEDebugOptions.CPU_NAME" value="Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/TMS320C671X"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RTDSP"/> <stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="<?xml version="1.0" encoding="UTF-8"?> <globalVariableList/> "/> diff --git a/lab5/RTDSP/Matlab/elliptical.m b/lab5/RTDSP/Matlab/elliptical.m new file mode 100644 index 0000000..619944e --- /dev/null +++ b/lab5/RTDSP/Matlab/elliptical.m @@ -0,0 +1,10 @@ +function [b,a] = elliptical (Fs) + +order = 4; % Order of the bandpass filter +startband = 270*2/Fs; % Normalised startband frequency +stopband = 450*2/Fs; % Normalised stopband frequency +ripple = 0.3; % The passband ripple (in dB) +stopband_atten = 20; % The stopband attenuation (in dB) + +% Call the eliptical filter function +[b,a] = ellip(order/2,ripple,stopband_atten,[startband, stopband]); diff --git a/lab5/RTDSP/Matlab/filter_coeff_ell.txt b/lab5/RTDSP/Matlab/filter_coeff_ell.txt new file mode 100644 index 0000000..5527b18 --- /dev/null +++ b/lab5/RTDSP/Matlab/filter_coeff_ell.txt @@ -0,0 +1,2 @@ + 9.6683656064376025e-02 -3.7417971508180198e-01 5.5502519309909670e-01 -3.7417971508180270e-01 9.6683656064376386e-02 + 1.0000000000000000e+00 -3.8475581971606738e+00 5.5906851263228337e+00 -3.6360361044752754e+00 8.9323992595555990e-01 diff --git a/lab5/RTDSP/Matlab/filter_coeff_ell_a.txt b/lab5/RTDSP/Matlab/filter_coeff_ell_a.txt new file mode 100644 index 0000000..385f642 --- /dev/null +++ b/lab5/RTDSP/Matlab/filter_coeff_ell_a.txt @@ -0,0 +1 @@ +double a[] = { 1.0000000000000000, -3.8475581971606738, 5.5906851263228337, -3.6360361044752754, 0.89323992595555990 }; diff --git a/lab5/RTDSP/Matlab/filter_coeff_ell_b.txt b/lab5/RTDSP/Matlab/filter_coeff_ell_b.txt new file mode 100644 index 0000000..5d225da --- /dev/null +++ b/lab5/RTDSP/Matlab/filter_coeff_ell_b.txt @@ -0,0 +1 @@ +double b[] = { 9.6683656064376025e-02, -3.7417971508180198e-01, 5.5502519309909670e-01, -3.7417971508180270e-01, 9.6683656064376386e-02 }; diff --git a/lab5/RTDSP/Matlab/gen_filter.m b/lab5/RTDSP/Matlab/gen_filter.m index 625aba1..d6b5304 100644 --- a/lab5/RTDSP/Matlab/gen_filter.m +++ b/lab5/RTDSP/Matlab/gen_filter.m @@ -1,5 +1,6 @@ Fs = 8000; -b = m_filter; -freqz(b, 1, 1024, Fs); +[b,a] = elliptical (Fs); +freqz(b, a); -save filter_coeff_correct.txt b -ASCII -DOUBLE -TABS
\ No newline at end of file +%save filter_coeff_ell_b.txt b -ASCII -DOUBLE -TABS +%save filter_coeff_ell_a.txt a -ASCII -DOUBLE -TABS
\ No newline at end of file diff --git a/lab5/RTDSP/intio.c b/lab5/RTDSP/intio.c index 219ca56..8317826 100644 --- a/lab5/RTDSP/intio.c +++ b/lab5/RTDSP/intio.c @@ -1,11 +1,16 @@ /************************************************************************************* DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING IMPERIAL COLLEGE LONDON + EE 3.19: Real Time Digital Signal Processing Dr Paul Mitcheson and Daniel Harvey + LAB 3: Interrupt I/O + ********* I N T I O. C ********** + Demonstrates inputing and outputing data from the DSK's audio port using interrupts. + ************************************************************************************* Updated for use on 6713 DSK by Danny Harvey: May-Aug 2006 Updated for CCS V4 Sept 10 @@ -37,10 +42,13 @@ // PI defined here for use in your code #define PI 3.141592653589793 -short x[] = {0, 0}; -double y[] = {0.0, 0.0}; -double a[] = {1, -1.875/2.125}; -double b[] = {0.125/2.125, 0.125/2.125}; +#include "Matlab/filter_coeff_ell_a.txt" +#include "Matlab/filter_coeff_ell_b.txt" + +int N = sizeof(a)/sizeof(a[0]); +short* x; +double* y; + /******************************* Global declarations ********************************/ @@ -74,14 +82,24 @@ void ISR_AIC(void); short circ_fir(void); /********************************** Main routine ************************************/ void main(){ + int i; + x = (short*)calloc(N, sizeof(short)); + y = (double*)calloc(N, sizeof(double)); // initialize board and the audio port init_hardware(); /* initialize hardware interrupts */ init_HWI(); + + /* Initialises array to 0 */ + for (i = 0; i < N; ++i) { + y[i] = 0.0; + x[i] = 0; + } /* loop indefinitely, waiting for interrupts */ while(1) {}; + } /********************************** init_hardware() **********************************/ @@ -121,10 +139,22 @@ void init_HWI() /******************** INTERRUPT SERVICE ROUTINE ***********************/ void ISR_AIC() { - x[1] = x[0]; + int i; + + //Shift the values + for (i = N-1; i > 0; --i) { + x[i] = x[i-1]; + y[i] = y[i-1]; + } + x[0] = mono_read_16Bit(); - y[1] = y[0]; - y[0] = b[0] * x[0] + b[1] * x[1] - a[1] * y[1]; + y[0] = 0.0; + + for (i = 0; i < N; ++i) { + y[0] += b[i] * x[i]; + if (i != 0) + y[0] -= a[i] * y[i]; + } mono_write_16Bit((short)y[0]); -} +}
\ No newline at end of file |