aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorymherklotz <ymherklotz@gmail.com>2018-02-27 10:34:49 +0000
committerymherklotz <ymherklotz@gmail.com>2018-02-27 10:34:49 +0000
commit2a7a81942e8603689517eaf119b3e847c6cf5f0b (patch)
tree671a4a9bf8f7cd42317d7d624ec5f5e241bd9e0b
parent15f14bfcf580dcf123178e254246e7993d077e63 (diff)
downloadNoiseSilencer-2a7a81942e8603689517eaf119b3e847c6cf5f0b.tar.gz
NoiseSilencer-2a7a81942e8603689517eaf119b3e847c6cf5f0b.zip
Fixed proj folder for lab5ex2
-rw-r--r--lab5/Images/Group Delay.pngbin0 -> 58717 bytes
-rw-r--r--lab5/Images/Impulse Response.pngbin0 -> 35492 bytes
-rw-r--r--lab5/Images/Matlab_spectrum.pngbin0 -> 74583 bytes
-rw-r--r--lab5/Images/Matlab_spectrum_mag.pngbin0 -> 76303 bytes
-rw-r--r--lab5/Images/Measured_filter.PNGbin0 -> 39583 bytes
-rw-r--r--lab5/Images/Phase.pngbin0 -> 28401 bytes
-rw-r--r--lab5/Images/Phase_2.pngbin0 -> 33114 bytes
-rw-r--r--lab5/RTDSP/.launches/RTDSP.launch4
-rw-r--r--lab5/RTDSP/Matlab/elliptical.m10
-rw-r--r--lab5/RTDSP/Matlab/filter_coeff_ell.txt2
-rw-r--r--lab5/RTDSP/Matlab/filter_coeff_ell_a.txt1
-rw-r--r--lab5/RTDSP/Matlab/filter_coeff_ell_b.txt1
-rw-r--r--lab5/RTDSP/Matlab/gen_filter.m7
-rw-r--r--lab5/RTDSP/intio.c46
14 files changed, 58 insertions, 13 deletions
diff --git a/lab5/Images/Group Delay.png b/lab5/Images/Group Delay.png
new file mode 100644
index 0000000..91c0b24
--- /dev/null
+++ b/lab5/Images/Group Delay.png
Binary files differ
diff --git a/lab5/Images/Impulse Response.png b/lab5/Images/Impulse Response.png
new file mode 100644
index 0000000..70850cb
--- /dev/null
+++ b/lab5/Images/Impulse Response.png
Binary files differ
diff --git a/lab5/Images/Matlab_spectrum.png b/lab5/Images/Matlab_spectrum.png
new file mode 100644
index 0000000..ce06ed3
--- /dev/null
+++ b/lab5/Images/Matlab_spectrum.png
Binary files differ
diff --git a/lab5/Images/Matlab_spectrum_mag.png b/lab5/Images/Matlab_spectrum_mag.png
new file mode 100644
index 0000000..97c1706
--- /dev/null
+++ b/lab5/Images/Matlab_spectrum_mag.png
Binary files differ
diff --git a/lab5/Images/Measured_filter.PNG b/lab5/Images/Measured_filter.PNG
new file mode 100644
index 0000000..6b5f8a7
--- /dev/null
+++ b/lab5/Images/Measured_filter.PNG
Binary files differ
diff --git a/lab5/Images/Phase.png b/lab5/Images/Phase.png
new file mode 100644
index 0000000..b251b46
--- /dev/null
+++ b/lab5/Images/Phase.png
Binary files differ
diff --git a/lab5/Images/Phase_2.png b/lab5/Images/Phase_2.png
new file mode 100644
index 0000000..0630b18
--- /dev/null
+++ b/lab5/Images/Phase_2.png
Binary files differ
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="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;sourceLookupDirector&gt;&#13;&#10;&lt;sourceContainers duplicates=&quot;false&quot;&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;default/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#13;&#10;&lt;/sourceContainers&gt;&#13;&#10;&lt;/sourceLookupDirector&gt;&#13;&#10;"/>
-<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="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList/&gt;&#13;&#10;"/>
<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="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;modules&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Fri Jan 19 14:07:28 GMT 2018&quot; time_long=&quot;1516370848357&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Jan 23 11:15:11 GMT 2018&quot; time_long=&quot;1516706111426&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 01 11:44:21 GMT 2018&quot; time_long=&quot;1517485461898&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 15 13:55:55 GMT 2018&quot; time_long=&quot;1518702955359&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Feb 27 10:22:44 GMT 2018&quot; time_long=&quot;1519726964340&quot;/&gt;&#13;&#10;&lt;/modules&gt;&#13;&#10;"/>
+<stringAttribute key="com.ti.ccstudio.debug.core.MRU_MODULES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;modules&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Fri Jan 19 14:07:28 GMT 2018&quot; time_long=&quot;1516370848357&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Jan 23 11:15:11 GMT 2018&quot; time_long=&quot;1516706111426&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 01 11:44:21 GMT 2018&quot; time_long=&quot;1517485461898&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 15 13:55:55 GMT 2018&quot; time_long=&quot;1518702955359&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Feb 27 10:33:39 GMT 2018&quot; time_long=&quot;1519727619443&quot;/&gt;&#13;&#10;&lt;/modules&gt;&#13;&#10;"/>
<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="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;globalVariableList/&gt;&#13;&#10;"/>
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