aboutsummaryrefslogtreecommitdiffstats
path: root/lab5/RTDSP/intio.c
diff options
context:
space:
mode:
Diffstat (limited to 'lab5/RTDSP/intio.c')
-rw-r--r--lab5/RTDSP/intio.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lab5/RTDSP/intio.c b/lab5/RTDSP/intio.c
index 2c47420..567324c 100644
--- a/lab5/RTDSP/intio.c
+++ b/lab5/RTDSP/intio.c
@@ -133,20 +133,23 @@ void init_HWI()
void ISR_AIC()
{
int i = N-1;
-
- y[0] = 0.0;
//Shift the values
for (; i > 0; --i) {
x[i] = x[i-1];
y[i] = y[i-1];
-
- y[0] += b[i] * x[i] - a[i] * y[i];
}
x[0] = mono_read_16Bit();
-
- y[0] += b[0] * x[0];
+
+ y[0] = 0.0;
+
+ for (i = 0; i < N; ++i) {
+ y[0] += x[i] * b[i];
+ if(i != 0) {
+ y[0] -= y[i] * a[i];
+ }
+ }
mono_write_16Bit((short)y[0]);
}