Real Time FIR Filter - Distinctive Excellence award winner :)

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Gonzakpo
Date:
Sat Aug 13 17:35:52 2011 +0000
Commit message:

Changed in this revision

adc_dac.c Show annotated file Show diff for this revision Revisions of this file
adc_dac.h Show annotated file Show diff for this revision Revisions of this file
config.h Show annotated file Show diff for this revision Revisions of this file
cr_dsplib.h Show annotated file Show diff for this revision Revisions of this file
cr_dsplib_blockfir32.s Show annotated file Show diff for this revision Revisions of this file
dma.c Show annotated file Show diff for this revision Revisions of this file
dma.h Show annotated file Show diff for this revision Revisions of this file
filters.h Show annotated file Show diff for this revision Revisions of this file
leds_mbed.c Show annotated file Show diff for this revision Revisions of this file
leds_mbed.h Show annotated file Show diff for this revision Revisions of this file
main.c Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
timer.c Show annotated file Show diff for this revision Revisions of this file
timer.h Show annotated file Show diff for this revision Revisions of this file
touchpad.c Show annotated file Show diff for this revision Revisions of this file
touchpad.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adc_dac.c	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,44 @@
+
+#include "adc_dac.h"
+
+void initDAC(void)
+{
+    LPC_PINCON->PINSEL1 |= (0x2 << 20);            /* Salida del DAC por pin numero P0.26 (AOUT)*/
+                                                /* (Unico pin posible para esta funcion) */
+    LPC_PINCON->PINMODE1 |= (0x2 << 20);        /* Deshabilito R de pull-up y R de pull-down */
+
+    LPC_SC->PCLKSEL0 |= (0x3 << 22);            /* Clock del DAC: */
+                                                /* 00 = CLCK/4    */
+                                                /* 01 = CLCK      */
+                                                /* 10 = CLCK/2    */
+                                                /* 11 = CLCK/8    */
+
+    LPC_DAC->DACCTRL = 0x00;     /* Desabilitar contador y DMA requests */
+
+}
+
+void initADC(void)
+{
+    LPC_SC->PCONP |= (1 << 12);    /* Enciendo modulo ADC */
+
+    LPC_PINCON->PINSEL1 |= (0x1 << 14);            /* Salida del ADC por pin numero P0.23 (AD0.0) */
+
+    LPC_PINCON->PINMODE1 |= (0x2 << 14);        /* Deshabilito R de pull-up y R de pull-down */
+
+    LPC_SC->PCLKSEL0 |= (0x3 << 24);            /* Clock del ADC: */
+                                                /* 00 = CLCK/4    */
+                                                /* 01 = CLCK      */
+                                                /* 10 = CLCK/2    */
+                                                /* 11 = CLCK/8    */
+
+    LPC_ADC->ADCR = (0x01 << 0)  | /* Selecciono el canal cero del ADC */
+                    (0x00 << 8)  | /* Minimo clk_div. Recordar que este es el clock de coversion del ADC. No el tiempo entre muestras. El maximo admisible es 13MHz. */
+                    (0x00 << 24);  /* Configuracion de START: como trabaja en modo BURST el start debe quedar en 0 */
+
+    LPC_ADC->ADINTEN = 0x00; /* Todas las interrupciones DESACTIVADAS */
+
+    /* Finalmente, inicio el ADC*/
+    LPC_ADC->ADCR |= (0x1 << 21); /* Inicio ADC */
+    LPC_ADC->ADCR |= (0x1 << 16); /* Inicio Modo Burst (conversion continua) */
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adc_dac.h	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,10 @@
+
+#ifndef ADC_DAC_H_
+#define ADC_DAC_H_
+
+#include "mbed.h"
+
+void initDAC(void);
+void initADC(void);
+
+#endif /* ADC_DAC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config.h	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,43 @@
+
+#ifndef CONFIG_H_
+#define CONFIG_H_
+
+/********************************CONFIGURACION**********************************/
+
+#define BLOCKSIZE 1917 /* Tama&#65533;o del bloque (en words) a procesar */
+
+#define COEFF_AMOUNT    256       /* Cantidad de coeficientes maxima del (o de los) filtros. */
+                               /* Este valor determina el largo de los buffers para procesamiento */
+
+/* Requisitos impuestos por el algoritmo de filtrado:
+ * {(COEFF_AMOUNT-1)+BLOCKSIZE} debe ser multiplo de 4.
+ * COEFF_AMOUNT debe ser tambien multiplo de 4.
+ * COEFF_AMOUNT < {(COEFF_AMOUNT-1)+BLOCKSIZE}
+ * Ejemplo: COEFF_AMOUNT=100 y BLOCKSIZE=101
+ */
+
+/* De acuerdo a nuestro filtrado antialiasing, con un muestreo de 57KHz vamos a tener una atenuacion
+ * de -63dB del aliasing que se mete en la banda de audio (0-22KHz).
+ */
+
+#define    SAMPLING_DIV    195   /* Este valor fija la frecuencia de muestreo tanto del ADC como del DAC.
+                               La cuenta para saber la frecuencia resultante de muestreo es la siguiente:
+                               FSAMPLING = 100 MHz / (8 * SAMPLING_DIV).
+                               Con 105 tenemos una frecuencia de muestreo de 120KHz
+                               Con 156 tenemos una frecuencia de muestreo de 80KHz
+                               Con 283 tenemos una frecuencia de muestreo de ~44.1KHz
+                               Con 219 tenemos una frecuencia de muestreo de ~57KHz
+                               Con 125 tenemos una frecuencia de muestreo de 100KHz
+                               Con 12500 tenemos una frecuencia de 1KHz (para debug)
+                               Con 125000 tenemos una frecuencia de 100Hz (para debug)
+                               Con 1250000 tenemos una frecuencia de 10Hz (para debug)*/
+
+/* En realidad, la frecuencia maxima de muestreo del ADC es de "192307,69230769230769230769230769 Hz"
+ * porque la frecuencia de trabajo del mismo es de 12.5MHz y la conversion se produce cada 65 clocks.
+ * Entonces, para que el submuestreo que realiza el DMA sea "correcto" la frecuencia con la que el DMA
+ * toma los datos deberia ser un submultiplo de la del muestreo maximo del ADC
+ * Considero una frecuencia exactamente 3 veces menor => "64102,564102564102564102564102564 Hz"
+ * Entonces el SAMPLING_DIV deber&#65533;a ser de exactamente 195.
+ */
+
+#endif /* CONFIG_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cr_dsplib.h	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * $Id:: cr_dsplib.h 3698 2010-06-10 23:29:17Z nxp27266                $
+ *
+ * Project: NXP LPC1000 Cortex-M3 family DSP library
+ *
+ * Description: Definition of DSP Library API
+ *
+ * Copyright(C) 2010, NXP Semiconductor
+ * All rights reserved.
+ *
+ * Developed for NXP by Code Red Technologies Inc. www.code-red-tech.com
+ *
+ * Trimmed down and modified by Gonzalo Brusco.
+ *
+ *****************************************************************************
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * products. This software is supplied "AS IS" without any warranties.
+ * NXP Semiconductors assumes no responsibility or liability for the
+ * use of the software, conveys no license or title under any patent,
+ * copyright, or mask work right to the product. NXP Semiconductors
+ * reserves the right to make changes in the software without
+ * notification. NXP Semiconductors also make no representation or
+ * warranty that such application will be suitable for the specified
+ * use without further testing or modification.
+ *****************************************************************************/
+#ifndef CR_DSPLIB_H_
+#define CR_DSPLIB_H_
+
+typedef struct
+{
+    int *pi_Coeff;
+    int NTaps;
+}tS_blockfir32_Coeff;
+
+extern "C" void vF_dspl_blockfir32(int *pi_y, int *pi_x, tS_blockfir32_Coeff *pS_Coeff, int i_nsamples);
+
+#endif /*CR_DSPLIB_H_*/
+
+/*****************************************************************************
+ **                            End Of File
+ *****************************************************************************/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cr_dsplib_blockfir32.s	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,144 @@
+   
+; Los cuatro argumentos de la funcion llegan por r0, r1, r2 y r3.
+; r0 = Puntero a las muestras de salida.
+; r1 = Puntero a las muestras de entrada.
+; r2 = Puntero a la estructura de los coeficientes.
+; r3 = Cantidad de muestras de entrada.
+; r4 = Cantidad de coeficientes.
+; r3 y r5 = Temporales donde se cargan los coeficientes de entrada (r3 esta sobrecargado)
+; r6,r7,r8,r9 = Acumuladores.
+; r10,r11,r12,r14 = Temporales en donde se cargan las muestras de entrada.
+; r0 = Se utiliza como mascara (r0 esta sobrecargado)
+
+    AREA asm_func, CODE, READONLY
+    
+    EXPORT vF_dspl_blockfir32
+
+vF_dspl_blockfir32
+
+    push {r4-r12,lr}   ; Almacena registros en el stack.
+    ldr r4,[r2,#4]     ; Levanta en el registro r4 la cantidad de coeficientes.
+    ldr r2,[r2]        ; Carga en r2 el puntero hacia los coeficientes.
+
+    ; Le resto la cantidad de coeficientes a r3 para evitar que genere el transitorio final.
+    ; r3 = r3 - r4 + 4
+    ; Recordar que las ultimas tres muestras de salida tienen que ser descartadas.
+  
+    sub r3,r3,r4
+    add r3,r3,#4
+
+LoopSample
+    mov r6,#0               ; Limpia los acumuladores (0 a 3)
+    mov r7,r6
+    mov r8,r6
+    mov r9,r6
+
+    push {r0, r3, r4} ; Guarda r3, r4 y r0 (son registros) en el stack.
+
+    ldr r0,=0x80000000
+
+    ldmia r1!,{r10,r11,r12,r14} ; Carga 4 muestras en r10, r11, r12 y r14. r1 queda apuntando a la proxima muestra.
+
+    ; Desplazo hacia la izquierda lo mas posible y complemento el bit MSB.
+    eor r10,r0,r10,LSL#16
+    eor r11,r0,r11,LSL#16
+    eor r12,r0,r12,LSL#16
+    eor r14,r0,r14,LSL#16
+
+    ; Desplazo aritmeticamente lo mas posible hacia la derecha.
+    mov r10,r10,ASR#22
+    mov r11,r11,ASR#22
+    mov r12,r12,ASR#22
+    mov r14,r14,ASR#22
+
+LoopTaps
+    ldmia r2!,{r3,r5} ;Carga 2 coeficientes en r3 y r5. r2 queda apuntando al proximo coeficiente.
+    
+    ; mla = multiply and accumulate
+    ; Multiplica un coeficiente por las cuatro muestras leidas y acumula.
+    mla r6,r10,r3,r6      ; r6 = (r6 + (r10 * r3))[31:0]
+    mla r7,r11,r3,r7      ; r7 = (r7 + (r11 * r3))[31:0]
+    mla r8,r12,r3,r8      ; r8 = (r8 + (r12 * r3))[31:0]
+    mla r9,r14,r3,r9      ; r9 = (r9 + (r14 * r3))[31:0]
+    
+    ldr r10,[r1],#4          ; Se carga en r10 lo apuntado por r1. Luego se incrementa r1 en 4 (r1=r1+4)
+
+    ; Enmascaro, complemento el MSB y hago extension de signo.
+    eor r10,r0,r10,LSL#16
+    mov r10,r10,ASR#22
+
+    ldr r3,[r2],#4    ; Se carga en r3 lo apuntado por r2. Luego se incrementa r1 en 4 (r2=r2+4)
+    
+    mla r6,r11,r5,r6   ; r6 = (r6 + (r11 * r5))[31:0]
+    mla r7,r12,r5,r7   ; r7 = (r7 + (r12 * r5))[31:0]
+    mla r8,r14,r5,r8   ; r8 = (r8 + (r14 * r5))[31:0]
+    mla r9,r10,r5,r9   ; r9 = (r9 + (r10 * r5))[31:0]
+    
+    ldr r11,[r1],#4        ; Se carga en r11 lo apuntado por r1. Luego se incrementa r1 en 4 (r1=r1+4)
+
+    ; Enmascaro, complemento el MSB y hago extension de signo.
+    eor r11,r0,r11,LSL#16
+    mov r11,r11,ASR#22
+
+    ldr r5,[r2],#4    ; Se carga en r5 lo apuntado por r2. Luego se incrementa r2 en 4 (r2=r2+4)
+                          ; Supongo que como se trabaja con la memoria alineada de a bytes, incrementar en 4 significa
+                          ; pararse en la proxima muestra (las muestras son de 32 bits).
+    
+    mla r6,r12,r3,r6   ; r6 = (r6 + (r12 * r3))[31:0]
+    mla r7,r14,r3,r7   ; r7 = (r7 + (r14 * r3))[31:0]
+    mla r8,r10,r3,r8   ; r8 = (r8 + (r10 * r3))[31:0]
+    mla r9,r11,r3,r9   ; r9 = (r9 + (r11 * r3))[31:0]
+    
+    ldr r12,[r1],#4        ; Se carga en r12 lo apuntado por r1. Luego se incrementa r1 en 4 (r1=r1+4)
+
+    ; Enmascaro, complemento el MSB y hago extension de signo.
+    eor r12,r0,r12,LSL#16
+    mov r12,r12,ASR#22
+
+    subs r4,r4,#4   ;Este resta se puso aqu&#65533; para evitar que se forme una burbuja antes del branch.
+                          ;r4 = r4 - 4
+
+    mla r6,r14,r5,r6   ; r6 = (r6 + (r14 * r5))[31:0]
+    mla r7,r10,r5,r7   ; r7 = (r7 + (r10 * r5))[31:0]
+    mla r8,r11,r5,r8   ; r8 = (r8 + (r11 * r5))[31:0]
+    mla r9,r12,r5,r9   ; r9 = (r9 + (r12 * r5))[31:0]
+
+    ldr r14,[r1],#4        ; Se carga en r14 lo apuntado por r1. Luego se incrementa r1 en 4 (r1=r1+4)
+
+    ; Enmascaro, complemento el MSB y hago extension de signo.
+    eor r14,r0,r14,LSL#16
+    mov r14,r14,ASR#22
+
+    bne LoopTaps          ; Mira si se terminaron los coeficientes.
+    
+    ; Enmascaro y complemento el MSB (lo vuelvo a formato DAC).
+    ldr r0,=0xFFC0
+    and r6,r0,r6,LSR#16
+    and r7,r0,r7,LSR#16
+    and r8,r0,r8,LSR#16
+    and r9,r0,r9,LSR#16
+    eor r6,r6,#0x8000
+    eor r7,r7,#0x8000
+    eor r8,r8,#0x8000
+    eor r9,r9,#0x8000
+
+    pop {r0, r3, r4} ; Recupera r3, r4 y r0 desde el stack.
+    
+    ; Store the outputs
+    stmia r0!,{r6,r7,r8,r9} ; Guarda r6-4 en r0. r0 queda apuntando al proximo valor.
+
+    subs r3,r3,#4    ; hoisted up to avoid pipe delay before branch
+                                 ; r3 = r3 - 4
+
+    ; Reset Coeffs to start
+    sub r2,r2,r4,LSL#2 ; r2 = r2 - (r4 * 4)
+    
+    ; Walk along the input data by 4 samples each LoopSample iteration
+    sub r1,r1,r4,LSL#2 ; r1 = r1 - (r4 * 4)
+    
+    bne LoopSample ; Se terminaron las muestras de entrada?
+    
+    pop {r4-r12,lr} ; Restauro registros a su estado inicial.
+    bx lr ; Return
+    
+    end
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dma.c	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,89 @@
+
+#include "dma.h"
+
+bool_t BufferTransferCompleted = FALSE;
+pingpong_t BufferToProcess = PONG;
+
+/* Interrupcion del DMA */
+/* Se encarga de informar que se termino de leer un bloque desde el ADC */
+extern "C" void DMA_IRQHandler(void)
+{
+    /* Aquí llega cuando se produce una interrupcion del DMA.
+     * Dicha interrupcion se genera cada vez que se llena uno de los dos
+     * buffers de entrada de datos del ADC. Como esto tambien esta sincronizado
+     * con el DAC, la interrupcion tambien coincide con el cambio de buffer del
+     * DAC.
+     */
+     
+    /* Limpio flag de interrupcion */
+    LPC_GPDMA->DMACIntTCClear = (1 << 0);
+
+    /* Informo la aparicion de la interrupcion */
+    BufferTransferCompleted = TRUE;
+
+    /* Verifico que buffer corresponde procesar */
+    /* Recordar que los buffers PING y PONG se procesan alternadamente */
+    if(BufferToProcess == PONG)
+    {
+        BufferToProcess = PING;
+    }
+    else
+    {
+        BufferToProcess = PONG;
+    }
+
+}
+
+
+void initDMAs(dmaLinkedListNode * pListADC, dmaLinkedListNode * pListDAC)
+{
+    LPC_SC->PCONP |= (1UL << 29);        /* Enciendo modulo DMA */
+
+    LPC_GPDMA->DMACConfig = 1;     /* Habilito el DMA */
+
+    LPC_GPDMA->DMACIntTCClear = 0xFF; /* Limpio cualquier interrupcion previa*/
+    LPC_GPDMA->DMACIntErrClr = 0xFF;
+    NVIC_EnableIRQ(DMA_IRQn);
+    
+    LPC_SC->RESERVED9 |= 1; /* Selecciono a MAT0.0 como fuente de DMA request (RESERVED9 == DMAREQSEL) */
+
+    /* Inicializo el canal 0 con el primer nodo de la lista del ADC */
+    LPC_GPDMACH0->DMACCSrcAddr = pListADC->sourceAddr;
+    LPC_GPDMACH0->DMACCDestAddr = pListADC->destAddr;
+    LPC_GPDMACH0->DMACCControl = pListADC->dmaControl;
+    LPC_GPDMACH0->DMACCLLI = pListADC->nextNode;
+
+    /* Configuro el canal 0 del DMA:
+       SrcPeripheral = MAT0.0 = 8
+       DestPeripheral = 0
+       Transfer Type = Peripheral to Memory = 2
+       IE = 0 (sin interrupciones de error)
+       ITC = 1 (con interrupciones de transferencia completa)
+       Halt = 0 (acepta DMA requests)
+    */
+    LPC_GPDMACH0->DMACCConfig = (0x8 << 1) | (0x2 << 11) | (0x1 << 15);
+
+    /* Inicializo el canal 1 con el primer nodo de la lista del DAC */
+    LPC_GPDMACH1->DMACCSrcAddr = pListDAC->sourceAddr;
+    LPC_GPDMACH1->DMACCDestAddr = pListDAC->destAddr;
+    LPC_GPDMACH1->DMACCControl = pListDAC->dmaControl;
+    LPC_GPDMACH1->DMACCLLI = pListDAC->nextNode; /*Segun el user manual (pg 601) los dos bits menos significativos deben ser ceros*/
+                                                 /*Seguramente sea porque la memoria esta alineada de cierta forma que sea imposible
+                                                  * que estos dos bits no sean cero. En la note de aplicacion de DMA multiplican por
+                                                  * 0xFFFFFFFC para asegurarse de eso. No creo que sea necesario y no tiene sentido.*/
+
+    /* Configuro el canal 1 del DMA:
+       SrcPeripheral = 0
+       DestPeripheral = MAT0.0 = 8
+       Transfer Type = Memory to Peripheral = 1
+       IE = 0 (sin interrupciones de error)
+       ITC = 0 (sin interrupciones de transferencia completa)
+       Halt = 0 (acepta DMA requests)
+    */
+    LPC_GPDMACH1->DMACCConfig = (0x8 << 6) | (0x1 << 11);
+
+    /*Listo, habilito los canales DMA apropiados*/
+    LPC_GPDMACH0->DMACCConfig |= (1 << 0);
+    LPC_GPDMACH1->DMACCConfig |= (1 << 0);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dma.h	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,39 @@
+
+
+#ifndef DMA_H_
+#define DMA_H_
+
+#include "mbed.h"
+
+
+/************************************DEFINICIONES DE TIPOS********************************************/
+/*Estructura de los nodos usados por las Listas del DMA*/
+typedef struct
+{
+    unsigned long int sourceAddr; /*Direccion inicial de la memoria/periferico de partida*/
+    unsigned long int destAddr;   /*Direccion inicial de la memoria/periferico de destino*/
+    unsigned long int nextNode;   /*Proximo nodo de la lista (una vez que se enviaron todos los datos*/
+    unsigned long int dmaControl; /*Registro de configuracion del DMA que puede ser modificado nodo a nodo*/
+                                  /* Detalle dmaControl: Pagina 603 del User Manual del LPC1768 */
+}dmaLinkedListNode;
+
+/* Tipo de dato booleano */
+typedef enum {FALSE, TRUE} bool_t;
+
+/* Tipo de dato usado para saber que buffer debo procesar/escribir */
+typedef enum {PING, PONG} pingpong_t;
+
+/*****************************************VARIABLES***************************************************/
+/* Se decidio el uso de variables globales en lugar de wrappers para agilizar el codigo lo mas posible. */
+
+/* Esta variable indica si se atendio una interrupcion */
+/* Nos indica si se completo la adquisicion de uno de los buffers */
+extern bool_t BufferTransferCompleted;
+
+/* Esta variable indica que buffer debo procesar/escribir */
+extern pingpong_t BufferToProcess;
+
+/*****************************************FUNCIONES***************************************************/
+void initDMAs(dmaLinkedListNode *, dmaLinkedListNode *); /* Inicializacion de los canales DMA */
+
+#endif /* DMA_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filters.h	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,29 @@
+
+#ifndef FILTERS_H_
+#define FILTERS_H_
+
+/* Todos los filtros deben tener la misma longitud. */
+int filter_length = 256;
+
+const int filters[16][256] =
+{
+		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4194303},  /* No hay filtrado */
+		{-116,-52,-64,-76,-92,-112,-128,-152,-176,-204,-232,-268,-304,-344,-388,-432,-484,-544,-604,-668,-740,-820,-900,-992,-1084,-1188,-1296,-1412,-1536,-1668,-1808,-1956,-2112,-2280,-2452,-2636,-2832,-3036,-3252,-3476,-3712,-3956,-4216,-4484,-4764,-5056,-5360,-5676,-6004,-6348,-6700,-7064,-7440,-7832,-8232,-8648,-9072,-9512,-9964,-10428,-10900,-11388,-11884,-12396,-12916,-13444,-13988,-14540,-15100,-15668,-16248,-16836,-17432,-18032,-18644,-19260,-19880,-20508,-21140,-21776,-22412,-23056,-23696,-24340,-24988,-25632,-26276,-26916,-27556,-28188,-28820,-29448,-30068,-30680,-31288,-31884,-32472,-33052,-33620,-34176,-34720,-35252,-35768,-36268,-36756,-37228,-37680,-38116,-38536,-38936,-39316,-39676,-40016,-40336,-40632,-40908,-41160,-41388,-41596,-41780,-41936,-42072,-42184,-42268,-42332,-42368,4.1943e+006,-42368,-42332,-42268,-42184,-42072,-41936,-41780,-41596,-41388,-41160,-40908,-40632,-40336,-40016,-39676,-39316,-38936,-38536,-38116,-37680,-37228,-36756,-36268,-35768,-35252,-34720,-34176,-33620,-33052,-32472,-31884,-31288,-30680,-30068,-29448,-28820,-28188,-27556,-26916,-26276,-25632,-24988,-24340,-23696,-23056,-22412,-21776,-21140,-20508,-19880,-19260,-18644,-18032,-17432,-16836,-16248,-15668,-15100,-14540,-13988,-13444,-12916,-12396,-11884,-11388,-10900,-10428,-9964,-9512,-9072,-8648,-8232,-7832,-7440,-7064,-6700,-6348,-6004,-5676,-5360,-5056,-4764,-4484,-4216,-3956,-3712,-3476,-3252,-3036,-2832,-2636,-2452,-2280,-2112,-1956,-1808,-1668,-1536,-1412,-1296,-1188,-1084,-992,-900,-820,-740,-668,-604,-544,-484,-432,-388,-344,-304,-268,-232,-204,-176,-152,-128,-112,-92,-76,-64,-52,-116,0,0,0}, /*Filtro Pasa Altos 870Hz */
+		{-108,-52,-64,-76,-92,-108,-128,-148,-172,-196,-228,-260,-296,-336,-376,-424,-476,-532,-592,-656,-728,-804,-884,-972,-1068,-1168,-1276,-1392,-1516,-1644,-1784,-1928,-2084,-2248,-2424,-2608,-2800,-3004,-3216,-3440,-3676,-3920,-4176,-4444,-4724,-5016,-5320,-5632,-5960,-6300,-6652,-7016,-7392,-7784,-8184,-8596,-9024,-9464,-9916,-10376,-10852,-11340,-11836,-12348,-12868,-13400,-13940,-14496,-15056,-15628,-16208,-16796,-17392,-18000,-18608,-19228,-19852,-20480,-21116,-21752,-22396,-23040,-23684,-24332,-24980,-25628,-26272,-26916,-27560,-28200,-28832,-29464,-30088,-30704,-31312,-31912,-32504,-33088,-33660,-34220,-34768,-35300,-35820,-36328,-36816,-37292,-37748,-38188,-38608,-39012,-39392,-39756,-40096,-40420,-40716,-40996,-41248,-41480,-41688,-41872,-42032,-42168,-42280,-42368,-42432,-42468,4.1943e+006,-42468,-42432,-42368,-42280,-42168,-42032,-41872,-41688,-41480,-41248,-40996,-40716,-40420,-40096,-39756,-39392,-39012,-38608,-38188,-37748,-37292,-36816,-36328,-35820,-35300,-34768,-34220,-33660,-33088,-32504,-31912,-31312,-30704,-30088,-29464,-28832,-28200,-27560,-26916,-26272,-25628,-24980,-24332,-23684,-23040,-22396,-21752,-21116,-20480,-19852,-19228,-18608,-18000,-17392,-16796,-16208,-15628,-15056,-14496,-13940,-13400,-12868,-12348,-11836,-11340,-10852,-10376,-9916,-9464,-9024,-8596,-8184,-7784,-7392,-7016,-6652,-6300,-5960,-5632,-5320,-5016,-4724,-4444,-4176,-3920,-3676,-3440,-3216,-3004,-2800,-2608,-2424,-2248,-2084,-1928,-1784,-1644,-1516,-1392,-1276,-1168,-1068,-972,-884,-804,-728,-656,-592,-532,-476,-424,-376,-336,-296,-260,-228,-196,-172,-148,-128,-108,-92,-76,-64,-52,-108,0,0,0}, /*Filtro Pasa Altos 873Hz */
+		{1864,524,592,668,752,836,928,1024,1124,1228,1340,1452,1572,1692,1820,1948,2080,2216,2352,2492,2632,2772,2912,3052,3192,3328,3464,3596,3720,3844,3960,4068,4168,4260,4344,4412,4472,4520,4548,4568,4568,4552,4516,4464,4388,4292,4172,4028,3860,3664,3444,3196,2920,2612,2276,1908,1508,1076,608,112,-420,-988,-1588,-2224,-2896,-3600,-4340,-5116,-5924,-6768,-7644,-8556,-9496,-10472,-11476,-12512,-13576,-14672,-15788,-16936,-18104,-19296,-20508,-21736,-22988,-24252,-25532,-26820,-28124,-29432,-30744,-32060,-33380,-34696,-36012,-37320,-38620,-39908,-41188,-42448,-43692,-44916,-46116,-47292,-48440,-49556,-50644,-51696,-52712,-53692,-54628,-55524,-56376,-57180,-57940,-58648,-59304,-59908,-60460,-60956,-61400,-61784,-62108,-62376,-62584,-62736,-62824,4.1943e+006,-62824,-62736,-62584,-62376,-62108,-61784,-61400,-60956,-60460,-59908,-59304,-58648,-57940,-57180,-56376,-55524,-54628,-53692,-52712,-51696,-50644,-49556,-48440,-47292,-46116,-44916,-43692,-42448,-41188,-39908,-38620,-37320,-36012,-34696,-33380,-32060,-30744,-29432,-28124,-26820,-25532,-24252,-22988,-21736,-20508,-19296,-18104,-16936,-15788,-14672,-13576,-12512,-11476,-10472,-9496,-8556,-7644,-6768,-5924,-5116,-4340,-3600,-2896,-2224,-1588,-988,-420,112,608,1076,1508,1908,2276,2612,2920,3196,3444,3664,3860,4028,4172,4292,4388,4464,4516,4552,4568,4568,4548,4520,4472,4412,4344,4260,4168,4068,3960,3844,3720,3596,3464,3328,3192,3052,2912,2772,2632,2492,2352,2216,2080,1948,1820,1692,1572,1452,1340,1228,1124,1024,928,836,752,668,592,524,1864,0}, /*Filtro Pasa Altos 877Hz */
+		{1772,508,580,652,736,820,912,1008,1108,1216,1324,1440,1560,1688,1816,1948,2084,2220,2360,2504,2648,2796,2940,3088,3232,3376,3520,3656,3792,3920,4044,4164,4272,4372,4464,4548,4616,4672,4716,4744,4756,4752,4728,4684,4620,4536,4428,4296,4136,3952,3744,3504,3236,2940,2612,2252,1860,1432,976,480,-48,-608,-1208,-1840,-2512,-3216,-3956,-4736,-5548,-6396,-7276,-8192,-9144,-10128,-11144,-12188,-13264,-14372,-15504,-16664,-17852,-19060,-20292,-21544,-22812,-24100,-25400,-26716,-28040,-29376,-30716,-32060,-33404,-34748,-36092,-37428,-38756,-40076,-41380,-42672,-43944,-45196,-46424,-47628,-48804,-49952,-51064,-52144,-53188,-54188,-55152,-56072,-56944,-57768,-58548,-59272,-59948,-60568,-61136,-61644,-62096,-62492,-62828,-63104,-63316,-63472,-63564,4.1943e+006,-63564,-63472,-63316,-63104,-62828,-62492,-62096,-61644,-61136,-60568,-59948,-59272,-58548,-57768,-56944,-56072,-55152,-54188,-53188,-52144,-51064,-49952,-48804,-47628,-46424,-45196,-43944,-42672,-41380,-40076,-38756,-37428,-36092,-34748,-33404,-32060,-30716,-29376,-28040,-26716,-25400,-24100,-22812,-21544,-20292,-19060,-17852,-16664,-15504,-14372,-13264,-12188,-11144,-10128,-9144,-8192,-7276,-6396,-5548,-4736,-3956,-3216,-2512,-1840,-1208,-608,-48,480,976,1432,1860,2252,2612,2940,3236,3504,3744,3952,4136,4296,4428,4536,4620,4684,4728,4752,4756,4744,4716,4672,4616,4548,4464,4372,4272,4164,4044,3920,3792,3656,3520,3376,3232,3088,2940,2796,2648,2504,2360,2220,2084,1948,1816,1688,1560,1440,1324,1216,1108,1008,912,820,736,652,580,508,1772,0}, /*Filtro Pasa Altos 884Hz */
+		{1560,464,532,604,684,768,856,948,1048,1152,1260,1376,1492,1616,1744,1876,2012,2152,2296,2440,2588,2736,2884,3036,3188,3336,3484,3628,3772,3908,4044,4172,4292,4404,4508,4600,4684,4752,4812,4852,4880,4888,4884,4856,4808,4740,4648,4532,4388,4224,4028,3808,3556,3272,2960,2616,2236,1824,1380,900,380,-172,-760,-1384,-2048,-2748,-3484,-4256,-5068,-5916,-6796,-7716,-8672,-9660,-10680,-11736,-12824,-13940,-15088,-16264,-17468,-18696,-19944,-21216,-22512,-23820,-25148,-26492,-27844,-29208,-30576,-31952,-33332,-34708,-36084,-37456,-38820,-40176,-41516,-42844,-44152,-45440,-46704,-47944,-49156,-50336,-51488,-52600,-53676,-54708,-55704,-56652,-57552,-58408,-59208,-59960,-60660,-61300,-61884,-62412,-62880,-63288,-63636,-63920,-64144,-64300,-64396,4.1943e+006,-64396,-64300,-64144,-63920,-63636,-63288,-62880,-62412,-61884,-61300,-60660,-59960,-59208,-58408,-57552,-56652,-55704,-54708,-53676,-52600,-51488,-50336,-49156,-47944,-46704,-45440,-44152,-42844,-41516,-40176,-38820,-37456,-36084,-34708,-33332,-31952,-30576,-29208,-27844,-26492,-25148,-23820,-22512,-21216,-19944,-18696,-17468,-16264,-15088,-13940,-12824,-11736,-10680,-9660,-8672,-7716,-6796,-5916,-5068,-4256,-3484,-2748,-2048,-1384,-760,-172,380,900,1380,1824,2236,2616,2960,3272,3556,3808,4028,4224,4388,4532,4648,4740,4808,4856,4884,4888,4880,4852,4812,4752,4684,4600,4508,4404,4292,4172,4044,3908,3772,3628,3484,3336,3188,3036,2884,2736,2588,2440,2296,2152,2012,1876,1744,1616,1492,1376,1260,1152,1048,948,856,768,684,604,532,464,1560,0}, /*Filtro Pasa Altos 897Hz */
+		{-2284,204,212,228,256,292,340,396,456,528,608,696,788,892,1004,1120,1244,1376,1516,1660,1808,1968,2128,2292,2464,2640,2816,2996,3176,3356,3536,3716,3892,4068,4236,4400,4556,4708,4848,4976,5092,5196,5280,5356,5408,5444,5456,5448,5412,5352,5268,5152,5008,4832,4624,4380,4104,3788,3436,3044,2612,2140,1628,1072,472,-172,-856,-1588,-2364,-3184,-4052,-4960,-5912,-6908,-7948,-9028,-10152,-11316,-12516,-13756,-15032,-16344,-17688,-19060,-20464,-21892,-23348,-24824,-26320,-27836,-29364,-30904,-32452,-34004,-35560,-37116,-38668,-40216,-41752,-43276,-44780,-46268,-47732,-49168,-50576,-51952,-53292,-54592,-55848,-57064,-58228,-59344,-60404,-61412,-62360,-63248,-64072,-64832,-65524,-66152,-66708,-67192,-67600,-67940,-68204,-68392,-68508,4.1943e+006,-68508,-68392,-68204,-67940,-67600,-67192,-66708,-66152,-65524,-64832,-64072,-63248,-62360,-61412,-60404,-59344,-58228,-57064,-55848,-54592,-53292,-51952,-50576,-49168,-47732,-46268,-44780,-43276,-41752,-40216,-38668,-37116,-35560,-34004,-32452,-30904,-29364,-27836,-26320,-24824,-23348,-21892,-20464,-19060,-17688,-16344,-15032,-13756,-12516,-11316,-10152,-9028,-7948,-6908,-5912,-4960,-4052,-3184,-2364,-1588,-856,-172,472,1072,1628,2140,2612,3044,3436,3788,4104,4380,4624,4832,5008,5152,5268,5352,5412,5448,5456,5444,5408,5356,5280,5196,5092,4976,4848,4708,4556,4400,4236,4068,3892,3716,3536,3356,3176,2996,2816,2640,2464,2292,2128,1968,1808,1660,1516,1376,1244,1120,1004,892,788,696,608,528,456,396,340,292,256,228,212,204,-2284,0}, /*Filtro Pasa Altos 922Hz */
+		{-6196,-908,-968,-1024,-1072,-1116,-1156,-1188,-1212,-1228,-1236,-1232,-1216,-1192,-1152,-1100,-1036,-956,-864,-756,-628,-488,-332,-160,32,240,460,700,952,1220,1504,1804,2112,2436,2772,3112,3460,3816,4184,4544,4912,5276,5636,5992,6340,6680,7004,7312,7604,7872,8120,8336,8528,8684,8804,8884,8924,8920,8872,8768,8616,8408,8140,7816,7428,6976,6456,5872,5216,4492,3696,2828,1884,872,-216,-1376,-2608,-3912,-5288,-6732,-8244,-9824,-11468,-13172,-14932,-16752,-18624,-20544,-22508,-24516,-26560,-28636,-30744,-32872,-35016,-37176,-39344,-41512,-43676,-45832,-47976,-50100,-52196,-54260,-56288,-58272,-60208,-62088,-63908,-65664,-67352,-68964,-70496,-71940,-73300,-74568,-75736,-76804,-77768,-78628,-79376,-80016,-80540,-80948,-81244,-81420,4.1943e+006,-81420,-81244,-80948,-80540,-80016,-79376,-78628,-77768,-76804,-75736,-74568,-73300,-71940,-70496,-68964,-67352,-65664,-63908,-62088,-60208,-58272,-56288,-54260,-52196,-50100,-47976,-45832,-43676,-41512,-39344,-37176,-35016,-32872,-30744,-28636,-26560,-24516,-22508,-20544,-18624,-16752,-14932,-13172,-11468,-9824,-8244,-6732,-5288,-3912,-2608,-1376,-216,872,1884,2828,3696,4492,5216,5872,6456,6976,7428,7816,8140,8408,8616,8768,8872,8920,8924,8884,8804,8684,8528,8336,8120,7872,7604,7312,7004,6680,6340,5992,5636,5276,4912,4544,4184,3816,3460,3112,2772,2436,2112,1804,1504,1220,952,700,460,240,32,-160,-332,-488,-628,-756,-864,-956,-1036,-1100,-1152,-1192,-1216,-1232,-1236,-1228,-1212,-1188,-1156,-1116,-1072,-1024,-968,-908,-6196,0,0,0},  /*Filtro Pasa Altos 971Hz */
+		{4536,-1332,-1212,-1140,-1108,-1108,-1132,-1180,-1236,-1308,-1384,-1468,-1556,-1640,-1724,-1808,-1884,-1952,-2012,-2060,-2096,-2120,-2128,-2120,-2096,-2048,-1984,-1896,-1784,-1648,-1488,-1304,-1092,-856,-596,-304,12,352,720,1108,1524,1960,2420,2892,3384,3896,4408,4936,5472,6012,6548,7084,7608,8120,8620,9100,9552,9980,10368,10724,11032,11296,11504,11656,11748,11772,11724,11600,11396,11108,10736,10272,9712,9056,8304,7448,6488,5424,4256,2980,1600,112,-1484,-3180,-4980,-6880,-8876,-10964,-13144,-15408,-17752,-20172,-22664,-25220,-27832,-30492,-33200,-35940,-38708,-41492,-44292,-47092,-49888,-52664,-55420,-58140,-60816,-63444,-66008,-68504,-70924,-73252,-75488,-77620,-79644,-81548,-83324,-84972,-86480,-87848,-89064,-90128,-91036,-91784,-92368,-92788,-93040,4.1943e+006,-93040,-92788,-92368,-91784,-91036,-90128,-89064,-87848,-86480,-84972,-83324,-81548,-79644,-77620,-75488,-73252,-70924,-68504,-66008,-63444,-60816,-58140,-55420,-52664,-49888,-47092,-44292,-41492,-38708,-35940,-33200,-30492,-27832,-25220,-22664,-20172,-17752,-15408,-13144,-10964,-8876,-6880,-4980,-3180,-1484,112,1600,2980,4256,5424,6488,7448,8304,9056,9712,10272,10736,11108,11396,11600,11724,11772,11748,11656,11504,11296,11032,10724,10368,9980,9552,9100,8620,8120,7608,7084,6548,6012,5472,4936,4408,3896,3384,2892,2420,1960,1524,1108,720,352,12,-304,-596,-856,-1092,-1304,-1488,-1648,-1784,-1896,-1984,-2048,-2096,-2120,-2128,-2120,-2096,-2060,-2012,-1952,-1884,-1808,-1724,-1640,-1556,-1468,-1384,-1308,-1236,-1180,-1132,-1108,-1108,-1140,-1212,-1332,4536,0}, /*Filtro Pasa Altos 1066Hz */
+		{-5244,3056,2416,1992,1716,1540,1432,1364,1324,1296,1272,1244,1208,1160,1092,1012,908,784,640,468,280,68,-168,-420,-696,-984,-1292,-1612,-1940,-2276,-2616,-2956,-3296,-3624,-3944,-4244,-4524,-4780,-5004,-5196,-5348,-5456,-5512,-5520,-5468,-5364,-5184,-4952,-4648,-4268,-3828,-3312,-2724,-2068,-1348,-564,284,1196,2152,3160,4204,5280,6384,7508,8632,9756,10860,11944,12988,13984,14920,15780,16552,17224,17784,18220,18520,18668,18660,18480,18116,17568,16816,15864,14700,13316,11716,9892,7848,5580,3088,384,-2540,-5664,-8988,-12504,-16192,-20048,-24060,-28204,-32472,-36840,-41296,-45816,-50384,-54976,-59568,-64144,-68680,-73152,-77540,-81816,-85964,-89960,-93784,-97416,-1.0083e+005,-1.0402e+005,-1.0696e+005,-1.0964e+005,-1.1203e+005,-1.1414e+005,-1.1594e+005,-1.1742e+005,-1.1859e+005,-1.1943e+005,-1.1993e+005,4.1943e+006,-1.1993e+005,-1.1943e+005,-1.1859e+005,-1.1742e+005,-1.1594e+005,-1.1414e+005,-1.1203e+005,-1.0964e+005,-1.0696e+005,-1.0402e+005,-1.0083e+005,-97416,-93784,-89960,-85964,-81816,-77540,-73152,-68680,-64144,-59568,-54976,-50384,-45816,-41296,-36840,-32472,-28204,-24060,-20048,-16192,-12504,-8988,-5664,-2540,384,3088,5580,7848,9892,11716,13316,14700,15864,16816,17568,18116,18480,18660,18668,18520,18220,17784,17224,16552,15780,14920,13984,12988,11944,10860,9756,8632,7508,6384,5280,4204,3160,2152,1196,284,-564,-1348,-2068,-2724,-3312,-3828,-4268,-4648,-4952,-5184,-5364,-5468,-5520,-5512,-5456,-5348,-5196,-5004,-4780,-4524,-4244,-3944,-3624,-3296,-2956,-2616,-2276,-1940,-1612,-1292,-984,-696,-420,-168,68,280,468,640,784,908,1012,1092,1160,1208,1244,1272,1296,1324,1364,1432,1540,1716,1992,2416,3056,-5244,0}, /*Filtro Pasa Altos 1250Hz */
+		{8672,-224,-260,-324,-408,-516,-640,-780,-932,-1088,-1244,-1400,-1548,-1684,-1800,-1892,-1956,-1984,-1980,-1932,-1840,-1700,-1512,-1280,-996,-672,-300,108,552,1020,1508,2012,2516,3012,3492,3944,4360,4720,5028,5252,5416,5472,5428,5288,5036,4672,4192,3604,2900,2096,1192,200,-868,-2000,-3176,-4376,-5588,-6784,-7948,-9048,-10068,-10980,-11764,-12396,-12852,-13120,-13172,-13000,-12592,-11936,-11032,-9872,-8464,-6812,-4928,-2832,-544,1916,4508,7208,9972,12760,15524,18228,20812,23228,25428,27360,28968,30208,31032,31400,31260,30588,29344,27504,25048,21968,18252,13900,8924,3340,-2832,-9556,-16800,-24508,-32632,-41116,-49892,-58888,-68036,-77248,-86456,-95568,-1.0451e+005,-1.1319e+005,-1.2153e+005,-1.2945e+005,-1.3687e+005,-1.4373e+005,-1.4995e+005,-1.5547e+005,-1.6024e+005,-1.6422e+005,-1.6735e+005,-1.6961e+005,-1.7097e+005,4.1943e+006,-1.7097e+005,-1.6961e+005,-1.6735e+005,-1.6422e+005,-1.6024e+005,-1.5547e+005,-1.4995e+005,-1.4373e+005,-1.3687e+005,-1.2945e+005,-1.2153e+005,-1.1319e+005,-1.0451e+005,-95568,-86456,-77248,-68036,-58888,-49892,-41116,-32632,-24508,-16800,-9556,-2832,3340,8924,13900,18252,21968,25048,27504,29344,30588,31260,31400,31032,30208,28968,27360,25428,23228,20812,18228,15524,12760,9972,7208,4508,1916,-544,-2832,-4928,-6812,-8464,-9872,-11032,-11936,-12592,-13000,-13172,-13120,-12852,-12396,-11764,-10980,-10068,-9048,-7948,-6784,-5588,-4376,-3176,-2000,-868,200,1192,2096,2900,3604,4192,4672,5036,5288,5428,5472,5416,5252,5028,4720,4360,3944,3492,3012,2516,2012,1508,1020,552,108,-300,-672,-996,-1280,-1512,-1700,-1840,-1932,-1980,-1984,-1956,-1892,-1800,-1684,-1548,-1400,-1244,-1088,-932,-780,-640,-516,-408,-324,-260,-224,8672,0}, /*Filtro Pasa Altos 1606Hz */
+		{-8916,2112,1940,1812,1720,1640,1564,1472,1360,1212,1024,792,516,196,-156,-532,-920,-1304,-1668,-1996,-2264,-2460,-2564,-2568,-2460,-2232,-1888,-1432,-872,-224,488,1244,2012,2756,3452,4056,4540,4872,5024,4980,4724,4252,3560,2676,1604,380,-944,-2336,-3736,-5096,-6344,-7428,-8288,-8876,-9148,-9072,-8628,-7800,-6600,-5048,-3184,-1056,1260,3688,6140,8520,10732,12668,14236,15352,15940,15936,15308,14028,12112,9584,6504,2956,-960,-5108,-9352,-13528,-17476,-21020,-24000,-26256,-27652,-28072,-27428,-25668,-22776,-18772,-13720,-7740,-976,6372,14084,21900,29536,36688,43056,48328,52212,54428,54740,52936,48856,42392,33500,22200,8568,-7248,-25032,-44520,-65380,-87236,-1.0968e+005,-1.3227e+005,-1.5454e+005,-1.7604e+005,-1.9629e+005,-2.1486e+005,-2.3134e+005,-2.4537e+005,-2.5663e+005,-2.6486e+005,-2.6987e+005,4.1943e+006,-2.6987e+005,-2.6486e+005,-2.5663e+005,-2.4537e+005,-2.3134e+005,-2.1486e+005,-1.9629e+005,-1.7604e+005,-1.5454e+005,-1.3227e+005,-1.0968e+005,-87236,-65380,-44520,-25032,-7248,8568,22200,33500,42392,48856,52936,54740,54428,52212,48328,43056,36688,29536,21900,14084,6372,-976,-7740,-13720,-18772,-22776,-25668,-27428,-28072,-27652,-26256,-24000,-21020,-17476,-13528,-9352,-5108,-960,2956,6504,9584,12112,14028,15308,15936,15940,15352,14236,12668,10732,8520,6140,3688,1260,-1056,-3184,-5048,-6600,-7800,-8628,-9072,-9148,-8876,-8288,-7428,-6344,-5096,-3736,-2336,-944,380,1604,2676,3560,4252,4724,4980,5024,4872,4540,4056,3452,2756,2012,1244,488,-224,-872,-1432,-1888,-2232,-2460,-2568,-2564,-2460,-2264,-1996,-1668,-1304,-920,-532,-156,196,516,792,1024,1212,1360,1472,1564,1640,1720,1812,1940,2112,-8916,0}, /*Filtro Pasa Altos 2295Hz */
+		{-4836,9184,2040,-1076,-2216,-2412,-2160,-1704,-1152,-552,64,652,1188,1620,1904,2004,1892,1564,1032,336,-456,-1276,-2020,-2600,-2936,-2968,-2660,-2020,-1092,48,1284,2484,3504,4216,4512,4320,3624,2460,920,-852,-2672,-4344,-5664,-6456,-6592,-6004,-4700,-2772,-388,2220,4788,7016,8644,9436,9252,8032,5844,2852,-676,-4376,-7880,-10760,-12684,-13356,-12616,-10456,-7004,-2536,2512,7648,12320,15984,18168,18540,16932,13376,8116,1608,-5532,-12588,-18788,-23408,-25832,-25640,-22668,-17032,-9136,340,10496,20300,28668,34600,37268,36124,30984,22064,9996,-4200,-19200,-33476,-45452,-53636,-56792,-54088,-45204,-30420,-10648,12616,37344,61140,81408,95548,1.0121e+005,96468,80048,51452,11056,-39856,-99156,-1.6398e+005,-2.3093e+005,-2.9626e+005,-3.5617e+005,-4.0709e+005,-4.459e+005,-4.702e+005,4.1943e+006,-4.702e+005,-4.459e+005,-4.0709e+005,-3.5617e+005,-2.9626e+005,-2.3093e+005,-1.6398e+005,-99156,-39856,11056,51452,80048,96468,1.0121e+005,95548,81408,61140,37344,12616,-10648,-30420,-45204,-54088,-56792,-53636,-45452,-33476,-19200,-4200,9996,22064,30984,36124,37268,34600,28668,20300,10496,340,-9136,-17032,-22668,-25640,-25832,-23408,-18788,-12588,-5532,1608,8116,13376,16932,18540,18168,15984,12320,7648,2512,-2536,-7004,-10456,-12616,-13356,-12684,-10760,-7880,-4376,-676,2852,5844,8032,9252,9436,8644,7016,4788,2220,-388,-2772,-4700,-6004,-6592,-6456,-5664,-4344,-2672,-852,920,2460,3624,4320,4512,4216,3504,2484,1284,48,-1092,-2020,-2660,-2968,-2936,-2600,-2020,-1276,-456,336,1032,1564,1892,2004,1904,1620,1188,652,64,-552,-1152,-1704,-2160,-2412,-2216,-1076,2040,9184,-4836,0,0,0}, /*Filtro Pasa Altos 3629Hz */
+		{-6416,8320,2424,-844,-2216,-2300,-1588,-480,660,1532,1904,1668,880,-240,-1344,-2072,-2148,-1488,-256,1176,2332,2788,2316,996,-788,-2464,-3436,-3304,-2012,92,2352,4000,4412,3340,1020,-1848,-4324,-5520,-4928,-2592,820,4232,6472,6684,4632,840,-3536,-7048,-8436,-7064,-3192,2060,7008,9952,9752,6228,356,-6080,-10924,-12432,-9864,-3788,4008,11004,14792,13876,8232,-580,-9816,-16400,-17944,-13576,-4344,6992,16776,21620,19560,10796,-2196,-15376,-24340,-25792,-18704,-4840,11644,25428,31708,27832,14336,-4980,-24100,-36620,-37828,-26444,-5260,19420,39628,48220,41332,19912,-10156,-39588,-58452,-59396,-40324,-5576,34828,67920,81716,69260,31452,-22292,-76028,-1.1158e+005,-1.1404e+005,-76992,-5768,82252,1.6088e+005,2.012e+005,1.7902e+005,81924,-86164,-3.0422e+005,-5.3763e+005,-7.452e+005,-8.8822e+005,4.1943e+006,-8.8822e+005,-7.452e+005,-5.3763e+005,-3.0422e+005,-86164,81924,1.7902e+005,2.012e+005,1.6088e+005,82252,-5768,-76992,-1.1404e+005,-1.1158e+005,-76028,-22292,31452,69260,81716,67920,34828,-5576,-40324,-59396,-58452,-39588,-10156,19912,41332,48220,39628,19420,-5260,-26444,-37828,-36620,-24100,-4980,14336,27832,31708,25428,11644,-4840,-18704,-25792,-24340,-15376,-2196,10796,19560,21620,16776,6992,-4344,-13576,-17944,-16400,-9816,-580,8232,13876,14792,11004,4008,-3788,-9864,-12432,-10924,-6080,356,6228,9752,9952,7008,2060,-3192,-7064,-8436,-7048,-3536,840,4632,6684,6472,4232,820,-2592,-4928,-5520,-4324,-1848,1020,3340,4412,4000,2352,92,-2012,-3304,-3436,-2464,-788,996,2316,2788,2332,1176,-256,-1488,-2148,-2072,-1344,-240,880,1668,1904,1532,660,-480,-1588,-2300,-2216,-844,2424,8320,-6416,0}, /*Filtro Pasa Altos 6210Hz */
+		{-2024,4864,-2616,-1800,704,1580,600,-796,-1200,-340,848,1160,264,-948,-1208,-184,1120,1316,104,-1328,-1436,20,1588,1568,-168,-1880,-1692,364,2208,1808,-596,-2568,-1912,880,2960,2000,-1212,-3380,-2064,1604,3832,2096,-2048,-4312,-2096,2560,4820,2056,-3140,-5352,-1968,3792,5904,1824,-4520,-6480,-1620,5336,7072,1348,-6236,-7680,-992,7236,8296,548,-8336,-8924,4,9552,9556,-668,-10888,-10188,1460,12364,10812,-2404,-13988,-11436,3524,15784,12044,-4840,-17776,-12640,6396,20000,13212,-8228,-22496,-13768,10404,25336,14288,-13000,-28600,-14780,16132,32412,15240,-19968,-36968,-15660,24760,42552,16036,-30920,-49648,-16372,39136,59100,16660,-50708,-72528,-16896,68332,93516,17084,-98772,-1.3178e+005,-17216,1.6502e+005,2.2624e+005,17300,-4.2802e+005,-8.8274e+005,2.0972e+006,-8.8274e+005,-4.2802e+005,17300,2.2624e+005,1.6502e+005,-17216,-1.3178e+005,-98772,17084,93516,68332,-16896,-72528,-50708,16660,59100,39136,-16372,-49648,-30920,16036,42552,24760,-15660,-36968,-19968,15240,32412,16132,-14780,-28600,-13000,14288,25336,10404,-13768,-22496,-8228,13212,20000,6396,-12640,-17776,-4840,12044,15784,3524,-11436,-13988,-2404,10812,12364,1460,-10188,-10888,-668,9556,9552,4,-8924,-8336,548,8296,7236,-992,-7680,-6236,1348,7072,5336,-1620,-6480,-4520,1824,5904,3792,-1968,-5352,-3140,2056,4820,2560,-2096,-4312,-2048,2096,3832,1604,-2064,-3380,-1212,2000,2960,880,-1912,-2568,-596,1808,2208,364,-1692,-1880,-168,1568,1588,20,-1436,-1328,104,1316,1120,-184,-1208,-948,264,1160,848,-340,-1200,-796,600,1580,704,-1800,-2616,4864,-2024,0}, /*Filtro Pasa Altos 11204Hz */
+		{76,1188,-3200,5192,-5516,3372,140,-2572,2200,284,-2256,1696,748,-2380,1332,1316,-2592,916,1968,-2768,364,2684,-2832,-360,3416,-2708,-1276,4112,-2336,-2372,4696,-1664,-3608,5072,-652,-4928,5148,708,-6228,4832,2404,-7392,4032,4380,-8284,2692,6536,-8752,780,8740,-8648,-1692,10820,-7828,-4660,12568,-6188,-7992,13756,-3656,-11512,14156,-228,-14976,13540,4032,-18092,11732,8976,-20528,8588,14376,-21940,4048,19912,-21976,-1860,25196,-20324,-9000,29764,-16716,-17120,33112,-10960,-25848,34692,-2960,-34708,33980,7256,-43100,30448,19536,-50320,23596,33612,-55596,12976,49072,-58024,-1872,65412,-56604,-21432,82036,-50108,-46408,98296,-36892,-78012,1.1351e+005,-14328,-1.1877e+005,1.2703e+005,22636,-1.7467e+005,1.3825e+005,86376,-2.6295e+005,1.4666e+005,2.1893e+005,-4.5442e+005,1.5187e+005,7.158e+005,-1.6783e+006,2.0972e+006,-1.6783e+006,7.158e+005,1.5187e+005,-4.5442e+005,2.1893e+005,1.4666e+005,-2.6295e+005,86376,1.3825e+005,-1.7467e+005,22636,1.2703e+005,-1.1877e+005,-14328,1.1351e+005,-78012,-36892,98296,-46408,-50108,82036,-21432,-56604,65412,-1872,-58024,49072,12976,-55596,33612,23596,-50320,19536,30448,-43100,7256,33980,-34708,-2960,34692,-25848,-10960,33112,-17120,-16716,29764,-9000,-20324,25196,-1860,-21976,19912,4048,-21940,14376,8588,-20528,8976,11732,-18092,4032,13540,-14976,-228,14156,-11512,-3656,13756,-7992,-6188,12568,-4660,-7828,10820,-1692,-8648,8740,780,-8752,6536,2692,-8284,4380,4032,-7392,2404,4832,-6228,708,5148,-4928,-652,5072,-3608,-1664,4696,-2372,-2336,4112,-1276,-2708,3416,-360,-2832,2684,364,-2768,1968,916,-2592,1316,1332,-2380,748,1696,-2256,284,2200,-2572,140,3372,-5516,5192,-3200,1188,76,0,0,0}, /*Filtro Pasa Altos 20870Hz */
+};
+
+
+#endif /* FILTERS_H_ */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/leds_mbed.c	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,65 @@
+/* Rutina util para debuggear. Solo sirve para la placa MBED */
+
+#include "leds_mbed.h"
+
+void show_number_on_leds(uint32_t number)
+{
+    DigitalOut led_1(LED1);
+    DigitalOut led_2(LED2);
+    DigitalOut led_3(LED3);
+    DigitalOut led_4(LED4);
+    
+    /* De led mas significativo a menos significativo se lee: LED4 LED3 LED2 LED1 */
+
+    switch(number)
+    {
+        case 0: led_4 = led_3 = led_2 = led_1 = 0;
+                break;
+        case 1: led_4 = led_3 = led_2 = 0;
+                led_1 = 1;
+                break;
+        case 2: led_4 = led_3 = led_1 = 0;
+                led_2 = 1;
+                break;
+        case 3: led_4 = led_3 = 0;
+                led_2 = led_1 = 1;
+                break;
+        case 4: led_4 = led_2 = led_1 = 0;
+                led_3 = 1;
+                break;
+        case 5: led_4 = led_2 = 0;
+                led_3 = led_1 = 1;
+                break;
+        case 6: led_4 = led_1 = 0;
+                led_3 = led_2 = 1;
+                break;
+        case 7: led_4 = 0;
+                led_3 = led_2 = led_1 = 1;
+                break;
+        case 8: led_3 = led_2 = led_1 = 0;
+                led_4 = 1;
+                break;
+        case 9: led_3 = led_2 = 0;
+                led_4 = led_1 = 1;
+                break;
+        case 10: led_3 = led_1 = 0;
+                 led_4 = led_2 = 1;
+                 break;
+        case 11: led_3 = 0;
+                 led_4 = led_2 = led_1 = 1;
+                 break;
+        case 12: led_2 = led_1 = 0;
+                 led_4 = led_3 = 1;
+                 break;
+        case 13: led_2 = 0;
+                 led_4 = led_3 = led_1 = 1;
+                 break;
+        case 14: led_1 = 0;
+                 led_4 = led_3 = led_2 = 1;
+                 break;
+        case 15: led_4 = led_3 = led_2 = led_1 = 1;
+                 break;
+        default: led_4 = led_3 = led_2 = led_1 = 1;
+                 break;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/leds_mbed.h	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,11 @@
+
+#ifndef LEDS_MBED_H_
+#define LEDS_MBED_H_
+
+/* Funciones de debug para el MBED */
+
+#include "mbed.h"
+
+void show_number_on_leds(uint32_t number);
+
+#endif /* LEDS_MBED_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.c	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,200 @@
+/*
+==============================================================================================
+ Name                        : QuiPad
+ Contest Registration Number : NXP3854
+ Description                 : Real time FIR filter controlled by a touchpad
+==============================================================================================
+*/
+
+#include "mbed.h"
+#include "cr_dsplib.h"
+#include "filters.h"
+#include "dma.h"
+#include "adc_dac.h"
+#include "timer.h"
+#include "config.h"
+#include "touchpad.h"
+#include "leds_mbed.h"
+
+
+#define init_ahb_ram0 0x2007c000
+#define mid_ahb_ram0 0x2007DE00
+#define init_ahb_ram1 0x20080000
+#define mid_ahb_ram1 0x20081E00
+
+/*Los buffers y listas de guardan en la memoria AHB SRAM*/
+/*Esto es porque esta seccion de la memoria tiene menor tiempo de accesso*/
+/*Los buffer del DAC tienen 3 muestras extra por un detalle del algoritmo de filtrado */
+/*Esas tres muestras son descartadas luego al ser ignoradas por el DMA */
+int dac_buff_ping[BLOCKSIZE+3] __attribute__ ((at(init_ahb_ram0))); /*Buffers de datos para el DAC*/
+int dac_buff_pong[BLOCKSIZE+3] __attribute__ ((at(init_ahb_ram1)));
+int adc_buff_ping[(COEFF_AMOUNT-1)+BLOCKSIZE] __attribute__ ((at(mid_ahb_ram0))); /*Buffers de datos para el ADC*/
+int adc_buff_pong[(COEFF_AMOUNT-1)+BLOCKSIZE] __attribute__ ((at(mid_ahb_ram1)));
+/* Los buffers estan distribuidos de tal forma que el filtrado de datos se realice solo en una
+ * memoria SRAM a la vez y no estorbe la otra. De la misma forma, el DMA usa la otra memoria unicamente.
+ * Asi logro que el DMA y el filtrado no compitan por la memoria y acelero el filtrado.
+ */
+
+int main(void)
+{
+    tS_blockfir32_Coeff filter_pad;
+
+    int i;
+
+    /* La declaro como static para que se almacene en RAM */
+    static int filterRAM[256];
+
+    /* Estructura para obtencion de coordenadas */
+    touchpad_position current_position, prev_position, valid_position;
+
+    valid_position.pos_x = 0;
+    valid_position.pos_y = 0;
+
+    /* Inicializacio DMA */
+
+    static dmaLinkedListNode DACdmaList[2];    /*Lista del DMA del DAC*/
+    static dmaLinkedListNode ADCdmaList[2];    /*Lista del DMA del ADC*/
+
+    dmaLinkedListNode *pNodeDACping = &(DACdmaList[0]);
+    dmaLinkedListNode *pNodeDACpong = &(DACdmaList[1]);
+    dmaLinkedListNode *pNodeADCping = &(ADCdmaList[0]);
+    dmaLinkedListNode *pNodeADCpong = &(ADCdmaList[1]);
+
+    /* Configuro los nodos de las listas de los canales DMA */
+
+    /* Nodos del DMA que copia de la memoria al DAC */
+    pNodeDACping->sourceAddr = (unsigned int) dac_buff_ping; /*Direccion inicial de lectura del buffer DAC*/
+    pNodeDACping->destAddr = (unsigned int) &(LPC_DAC->DACR); /*Direccion del DAC*/
+    pNodeDACping->nextNode = (unsigned int) pNodeDACpong; /*Proximo nodo de la lista*/
+    pNodeDACping->dmaControl =  (unsigned int)BLOCKSIZE  | /*Numero de transferencias en total (BLOCKSIZE)*/
+                               ((unsigned int)0x0 << 12) | /*Numero de transferencias por burst de origen (1)*/
+                               ((unsigned int)0x0 << 15) | /*Numero de transferencias por burst de destino (1)*/
+                               ((unsigned int)0x2 << 18) | /*Ancho de bus de origen de 32 bits */
+                               ((unsigned int)0x2 << 21) | /*Ancho de bus de destino de 32 bits */
+                               ((unsigned int)0x0 << 24) | /*Reservado*/
+                               ((unsigned int)0x1 << 26) | /*Incrementar source address luego de cada transferencia*/
+                               ((unsigned int)0x0 << 27) | /*No incrementar el destination address luego de cada transferencia*/
+                               ((unsigned int)0x0 << 28) | /*No usado en el LPC17xx*/
+                               ((unsigned int)0x0 << 29) | /*No usado en el LPC17xx*/
+                               ((unsigned int)0x0 << 30) | /*No usado en el LPC17xx*/
+                               ((unsigned int)0x0 << 31);  /*Deshabilito interrupcion de "transferencia completa"*/
+
+    pNodeDACpong->sourceAddr = (unsigned int) dac_buff_pong; /*Direccion inicial de lectura del buffer DAC*/
+    pNodeDACpong->destAddr = (unsigned int) &(LPC_DAC->DACR); /*Direccion del DAC*/
+    pNodeDACpong->nextNode = (unsigned int) pNodeDACping; /*Proximo nodo de la lista*/
+    pNodeDACpong->dmaControl =  (unsigned int)BLOCKSIZE  | /*Numero de transferencias en total (BLOCKSIZE)*/
+                               ((unsigned int)0x0 << 12) | /*Numero de transferencias por burst de origen (1)*/
+                               ((unsigned int)0x0 << 15) | /*Numero de transferencias por burst de destino (1)*/
+                               ((unsigned int)0x2 << 18) | /*Ancho de bus de origen de 32 bits */
+                               ((unsigned int)0x2 << 21) | /*Ancho de bus de destino de 32 bits */
+                               ((unsigned int)0x0 << 24) | /*Reservado*/
+                               ((unsigned int)0x1 << 26) | /*Incrementar source address luego de cada transferencia*/
+                               ((unsigned int)0x0 << 27) | /*No incrementar el destination address luego de cada transferencia*/
+                               ((unsigned int)0x0 << 28) | /*No usado en el LPC17xx*/
+                               ((unsigned int)0x0 << 29) | /*No usado en el LPC17xx*/
+                               ((unsigned int)0x0 << 30) | /*No usado en el LPC17xx*/
+                               ((unsigned int)0x0 << 31);  /*Deshabilito interrupcion de "transferencia completa"*/
+
+    /* Nodos del DMA que copia del ADC a la memoria */
+    pNodeADCping->sourceAddr = (unsigned int) &(LPC_ADC->ADDR0); /*Direccion de los datos de salida del ADC*/
+    pNodeADCping->destAddr = (unsigned int) &(adc_buff_ping[(COEFF_AMOUNT-1)]) ; /*Direccion del buffer del ADC*/
+    pNodeADCping->nextNode = (unsigned int) pNodeADCpong; /*Proximo nodo de la lista*/
+    pNodeADCping->dmaControl =  (unsigned int)BLOCKSIZE  | /*Numero de transferencias en total (BLOCKSIZE)*/
+                               ((unsigned int)0x0 << 12) | /*Numero de transferencias por burst de origen (1)*/
+                                  ((unsigned int)0x0 << 15) | /*Numero de transferencias por burst de destino (1)*/
+                                  ((unsigned int)0x2 << 18) | /*Ancho de bus de origen de 32 bits */
+                                  ((unsigned int)0x2 << 21) | /*Ancho de bus de destino de 32 bits */
+                                  ((unsigned int)0x0 << 24) | /*Reservado*/
+                                  ((unsigned int)0x0 << 26) | /*No Incrementar source address luego de cada transferencia*/
+                                  ((unsigned int)0x1 << 27) | /*Incrementar el destination address luego de cada transferencia*/
+                                  ((unsigned int)0x0 << 28) | /*No usado en el LPC17xx*/
+                                  ((unsigned int)0x0 << 29) | /*No usado en el LPC17xx*/
+                                  ((unsigned int)0x0 << 30) | /*No usado en el LPC17xx*/
+                                  ((unsigned int)0x1 << 31);  /*Habilito interrupcion de "transferencia completa"*/
+
+    pNodeADCpong->sourceAddr = (unsigned int) &(LPC_ADC->ADDR0); /*Direccion de los datos de salida del ADC*/
+    pNodeADCpong->destAddr = (unsigned int) &(adc_buff_pong[(COEFF_AMOUNT-1)]) ; /*Direccion del buffer del ADC*/
+    pNodeADCpong->nextNode = (unsigned int) pNodeADCping; /*Proximo nodo de la lista*/
+    pNodeADCpong->dmaControl =  (unsigned int)BLOCKSIZE  | /*Numero de transferencias en total (BLOCKSIZE)*/
+                                  ((unsigned int)0x0 << 12) | /*Numero de transferencias por burst de origen (1)*/
+                                  ((unsigned int)0x0 << 15) | /*Numero de transferencias por burst de destino (1)*/
+                                  ((unsigned int)0x2 << 18) | /*Ancho de bus de origen de 32 bits */
+                                  ((unsigned int)0x2 << 21) | /*Ancho de bus de destino de 32 bits */
+                                  ((unsigned int)0x0 << 24) | /*Reservado*/
+                                  ((unsigned int)0x0 << 26) | /*No Incrementar source address luego de cada transferencia*/
+                                  ((unsigned int)0x1 << 27) | /*Incrementar el destination address luego de cada transferencia*/
+                                 ((unsigned int)0x0 << 28) | /*No usado en el LPC17xx*/
+                                  ((unsigned int)0x0 << 29) | /*No usado en el LPC17xx*/
+                                  ((unsigned int)0x0 << 30) | /*No usado en el LPC17xx*/
+                                  ((unsigned int)0x1 << 31);  /*Habilito interrupcion de "transferencia completa"*/
+
+    /* Inicializo perifericos */
+    init_touchpad();
+    initADC();
+    initDAC();
+    initDMAs(pNodeADCping , pNodeDACping);
+    init_timer();
+
+    /* Una vez inicializado el sistema, se tienen que atender las interrupciones generadas por el
+     * DMA (cuando se llenan los buffer) y llamar a la funcion de filtrado FIR. */
+
+     /* Loop infinito. */
+    while(1)
+    {
+        if(BufferTransferCompleted == TRUE)
+        {
+            BufferTransferCompleted = FALSE;
+
+            /* Obtengo posicion del touchpad */
+            current_position = get_position();
+
+            /* Aplico filtrado al valor de posicion para evitar ruido */
+            /* Verifico que la misma posicion se haya registrado dos veces seguidas */
+            /* En caso negativo, la descarto */
+            if ((prev_position.pos_x == current_position.pos_x) && (prev_position.pos_y == current_position.pos_y))
+            {
+                valid_position.pos_x = current_position.pos_x;
+                valid_position.pos_y = current_position.pos_y;
+            }
+
+            prev_position.pos_x = current_position.pos_x;
+            prev_position.pos_y = current_position.pos_y;
+
+            show_number_on_leds(valid_position.pos_y);
+
+            /* Copio el filtro a utilizar a la RAM (mejora el tiempo de filtrado) */
+            for(i = 0; i < 256; i++)
+            {
+                /* filterRAM[i] = filters[valid_position.pos_x][valid_position.pos_y][i]; */
+                /* Por ahora, a modo de ejemplo, solo utilizo la coordenada Y */
+                filterRAM[i] = filters[valid_position.pos_y][i];
+            }
+
+            filter_pad.NTaps = filter_length;
+            filter_pad.pi_Coeff = filterRAM;
+
+            if(BufferToProcess == PING)
+            {
+                /* Copio las ultimas (COEFF-1) muestras del buffer ping al buffer pong */
+                for(i=0; i < COEFF_AMOUNT-1; i++)
+                {
+                    adc_buff_pong[i] = adc_buff_ping[BLOCKSIZE + i];
+                }
+                /* Proceso el buffer adc_buff_ping y guardo resultados en dac_buff_ping */
+                vF_dspl_blockfir32(dac_buff_ping, adc_buff_ping, &filter_pad, (COEFF_AMOUNT-1)+BLOCKSIZE);
+            }
+            else
+            {
+                /* Copio las ultimas (COEFF-1) muestras del buffer pong al buffer ping */
+                for(i=0; i < COEFF_AMOUNT-1; i++)
+                {
+                    adc_buff_ping[i] = adc_buff_pong[BLOCKSIZE + i];
+                }
+                /* Proceso el buffer adc_buff_pong y guardo resultados en dac_buff_pong */
+                vF_dspl_blockfir32(dac_buff_pong, adc_buff_pong, &filter_pad, (COEFF_AMOUNT-1)+BLOCKSIZE);
+            }
+           }
+    }
+
+    return 1 ; /* Si se llego aqui, hay un problema! */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/timer.c	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,52 @@
+
+#include "timer.h"
+#include "leds_mbed.h"
+
+void init_timer(void)
+{
+    /* Configuro el MAT0.0 para que genere el clock de muestreo de
+     * tanto el DAC como el ADC (mediante el manejo de los DMA requests) */
+
+    LPC_SC->PCONP |= 1 << 1;    /* Enciendo modulo Timer 0 */
+
+    LPC_SC->PCLKSEL0 &= ~(0x03 << 2);    /* Clock del Timer 0: */
+                                        /* 00 = CLCK/4    */
+                                        /* 01 = CLCK      */
+                                        /* 10 = CLCK/2    */
+                                        /* 11 = CLCK/8    */
+                                        /* Actualmente configurado en CLCK/4 */
+
+    /* Interrupt register */
+    LPC_TIM0->IR = 0x0;    /* Limpio cualquier interrupcion previa */
+
+    /* Timer Control Register */
+    LPC_TIM0->TCR = 0x2; /* Reseteo contadores y deshabilito el timer */
+
+    /* Count Control Register */
+    LPC_TIM0->CTCR = 0x0; /* Modo timer (NO contador!) */
+
+    /* Preescale Register */
+    LPC_TIM0->PR = 0x1; /* Es la cantidad de clocks que deben pasar para incrementar el Timer 0 */
+                        /* Si PR=0, el timer incrementa en cada CLK. Si PR=1, el timer incrementa cada dos CLK, etc. */
+
+    /* Match Register 0 */
+    LPC_TIM0->MR0 = SAMPLING_DIV; /* El valor del Match Register se comparará continuamente con el valor del Timer.
+                                * Cuando sean iguales se producira un DMA request desde el ADC y hacia el DAC.
+                                * Es por eso que este valor determina la frecuencia de muestreo de ambos.
+                                * Para calcular el valor hay que hacer lo siguiente: Suponiendo una frecuencia
+                                * de muestreo deseada de Fx, y un clock (preescaler igual a cero) de CLK/8
+                                * el valor de MR0 necesario será = (CLK/8)/Fx */
+                               /* Con 283 tenemos una frecuencia de muestreo de ~44.1KHz */
+                               /* Con 125 tenemos una frecuencia de muestreo de 100KHz */
+
+    /* Match Control Register. */
+    LPC_TIM0->MCR = (0 << 0) | /* Interrupcion por Match 0 deshabilitada */
+                    (1 << 1) | /* Resetear el timer cuando haya un match 0 */
+                    (0 << 2);  /* No parar el timer cuando hay un match 0 */
+
+    /* Inicio el Timer 0 */
+    LPC_TIM0->TCR = 0x1;
+    
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/timer.h	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,10 @@
+
+#ifndef TIMER_H_
+#define TIMER_H_
+
+#include "mbed.h"
+#include "config.h"
+
+void init_timer(void);
+
+#endif /* TIMER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/touchpad.c	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,117 @@
+
+/* Esta rutina de touchpad esta pensada especificamente para la aplicacion del KaossPad */
+/* Si se quisiera portar a otro proyecto se deber� agregar una configuracion inicial del ADC */
+/* As� como esta presupone que el ADC ya est� corriendo (modo BURST) */
+
+#include "touchpad.h"
+
+/* Configuracion del touchpad */
+/*
+ *  AD0.4                 OPEN-DRAIN              OPEN-DRAIN        AD0.5
+ *  P1[30]                   P2[0]                   P2[1]          P1[31]
+ *    |                        |                       |              |
+ *    |           _____________|______________         |              |
+ *    |          |                            |        |              |
+ *    |          |                            |        |              |
+ *    |__________|         Touchpad           |________|              |
+ *               |                            |                       |
+ *               |                            |                       |
+ *               |____________________________|                       |
+ *                             |                                      |
+ *                             |______________________________________|
+ */
+
+void init_touchpad() {
+    /* P2[0] y P2[1] se configuran como GPIO */
+    LPC_PINCON->PINSEL4 &= ~(((unsigned int)0x3 << 0) | ((unsigned int)0x3 << 2));
+
+    /*Deshabilito todas las R de pullup y pulldown (de P2[0], P2[1], P1[30] y P1[31])*/
+    LPC_PINCON->PINMODE4 |= ((unsigned int)0x2 << 0) | ((unsigned int)0x2 << 2);
+    LPC_PINCON->PINMODE3 |= ((unsigned int)0x2 << 28) | ((unsigned int)0x2 << 30);
+
+    /* P2[0] y P2[1] se configuran como salidas */
+    LPC_GPIO2->FIODIR |= ((unsigned int)0x1 << 0) | ((unsigned int)0x1 << 1);
+
+    /* P2[0] y P2[1] se configuran como Open-Drain */
+    LPC_PINCON->PINMODE_OD2 |= ((unsigned int)0x1 << 0) | ((unsigned int)0x1 << 1);
+
+    /* Los pines P1[31] y P1[30] funcionaran tanto como ADC como GPIO
+     * y por eso no se configuran inicialmente */
+}
+
+touchpad_position get_position(void) {
+    touchpad_position positions;
+    int i;
+
+    /* Paro Modo Burst y desactivo canal AD0.0 (del audio) */
+    LPC_ADC->ADCR &= ~(((unsigned int)0x1 << 16) | ((unsigned int)0x1 << 0));
+
+    /* Configuro el touchpad para que me indique la posicion de X */
+
+    LPC_PINCON->PINSEL3 |= ((unsigned int)0x3 << 30);  /* P1[31] -> AD0.5 */
+    LPC_PINCON->PINSEL3 &= ~((unsigned int)0x3 << 28); /* P1[30] -> GPIO */
+    LPC_GPIO1->FIODIR |= ((unsigned int)0x1 << 30); /* P1[30] es una salida */
+
+    LPC_GPIO2->FIOCLR |= ((unsigned int)0x1 << 1);    /* Pongo en 0 el pin P2[1] */
+    LPC_GPIO2->FIOSET |= ((unsigned int)0x1 << 0);    /* Pongo en 1 el pin P2[0] */
+    LPC_GPIO1->FIOSET |= ((unsigned int)0x1 << 20);    /* Pongo en 1 el pin P1[30] */
+
+    /* Delay de 1uS aprox. para que se estabilizen las lineas */
+    for (i = 0; i < 100; i++);
+
+    /* Activo canal AD0.5 (coordenada X) */
+    LPC_ADC->ADCR |= ((unsigned int)0x1 << 5);
+
+    /* Comienzo la conversion */
+    LPC_ADC->ADCR |= ((unsigned int)0x1 << 24);
+
+    /* Espero a que se complete la conversion */
+    while ( (LPC_ADC->ADDR5 & 0x80000000) == 0x0 ) {
+    }
+
+    /* Almaceno la posicion X */
+    positions.pos_x = ((LPC_ADC->ADDR5 & ((unsigned int)0x7 << 12)) >> 12 );
+
+    /* Desactivo canal AD0.5 (coordenada X) */
+    LPC_ADC->ADCR &= ~((unsigned int)0x1 << 5);
+
+    /* Configuro el touchpad para que me indique la posicion de Y */
+
+    LPC_PINCON->PINSEL3 &= ~((unsigned int)0x3 << 30);  /* P1[31] -> GPIO */
+    LPC_PINCON->PINSEL3 |= ((unsigned int)0x3 << 28);   /* P1[30] -> AD0.4 */
+    LPC_GPIO1->FIODIR |= ((unsigned int)0x1 << 31); /* P1[31] es una salida */
+
+    LPC_GPIO2->FIOSET |= ((unsigned int)0x1 << 1);    /* Pongo en 1 el pin P2[1] */
+    LPC_GPIO2->FIOCLR |= ((unsigned int)0x1 << 0);    /* Pongo en 0 el pin P2[0] */
+    LPC_GPIO1->FIOSET |= ((unsigned int)0x1 << 31);    /* Pongo en 1 el pin P1[31] */
+
+    /* Delay de 1uS aprox. para que se estabilizen las lineas */
+    for (i = 0; i < 100; i++);
+
+    /* Activo canal AD0.4 (coordenada Y) */
+    LPC_ADC->ADCR |= ((unsigned int)0x1 << 4);
+
+    /* Comienzo la conversion */
+    LPC_ADC->ADCR |= ((unsigned int)0x1 << 24);
+
+    /* Espero a que se complete la conversion */
+    while ( (LPC_ADC->ADDR4 & (unsigned int)0x80000000) == (unsigned int)0x0 ) {
+    }
+
+    /* Almaceno la posicion Y */
+    positions.pos_y = (((LPC_ADC->ADDR4) & ((unsigned int)0xF << 12)) >> 12 );
+
+    /* Desactivo canal AD0.4 (coordenada Y) */
+    LPC_ADC->ADCR &= ~((unsigned int)0x1 << 4);
+
+    /* Restauro configuracion del ADC */
+
+    /* Activo canal AD0.0 (del audio) */
+    LPC_ADC->ADCR |= ((unsigned int)0x1 << 0);
+
+    /* Activo modo Burst */
+    LPC_ADC->ADCR |= ((unsigned int)0x1 << 16);
+
+
+    return positions;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/touchpad.h	Sat Aug 13 17:35:52 2011 +0000
@@ -0,0 +1,42 @@
+
+#ifndef TOUCHPAD_H_
+#define TOUCHPAD_H_
+
+#include "mbed.h"
+#include "cr_dsplib.h"
+
+/* Debido a la linealidad del touchscreen, la posicion Y va de 0 a 6 y la posicion X va de 0 a 5 */
+/* Esto se debe corregir en futuras revisiones mediante una calibracion del touchscreen */
+
+/* Configuracion del touchpad */
+/*
+ *  AD0.4                 OPEN-DRAIN              OPEN-DRAIN        AD0.5
+ *  P1[30]                   P2[0]                   P2[1]          P1[31]
+ *    |                        |                       |              |
+ *    |           _____________|______________         |              |
+ *    |          |                            |        |              |
+ *    |          |                            |        |              |
+ *    |__________|         Touchpad           |________|              |
+ *               |                            |                       |
+ *               |                            |                       |
+ *               |____________________________|                       |
+ *                             |                                      |
+ *                             |______________________________________|
+ */
+
+/************************************DEFINICIONES DE TIPOS********************************************/
+/*Estructura de la posicion actual del dedo*/
+typedef struct
+{
+	uint32_t pos_x;	/*Coordenada X*/
+	uint32_t pos_y; /*Coordenada Y*/
+
+} touchpad_position;
+
+/************************************DEFINICIONES DE FUNCIONES*****************************************/
+
+touchpad_position get_position(void); /*Funcion para obtencion de coordendas actuales del dedo en el touchpad*/
+
+void init_touchpad(void);
+
+#endif /* TOUCHPAD_H_ */