7 Replies Latest reply on Aug 24, 2012 3:56 PM by userc_43944

    Filtering a signal

       Project: ADC => DMA => Filter => DMA => DAC


      The input is provided as a DTMF waveform signal. The amplitude is in range 0.2 ..2.2 V.


      The problem is with output signal.  The waveform is rectangular(should be as a sine). It looks like the DAC is in saturation mode.



        • 1. Re: Filtering a signal

          Sounds a bit like DAC is 4.080V but power is set to 3.3V.


          Or can it be that you get the wrong byte from the filter?





          • 2. Re: Filtering a signal

             I've tried DAC's range 4.080V and 1.020V the result is the same.




            "Or can it be that you get the wrong byte from the filter?"


            How can I check it?

            • 3. Re: Filtering a signal

              Have a look into the datasheet, use the table on pg 21. I'm not experienced with that, but would use the 8-bit entry in the table.



              1 of 1 people found this helpful
              • 4. Re: Filtering a signal





                From your project file, I understand that you are using Band Pass filter. In that case, we can't use DMA directly to move the output data from Filter's Holding register to DAC's data register.


                As the ADC is operating between 0-Vdda, its output will have a DC component @ Vdda/2. In the Band pass filter, this DC component will be removed. So the output will be in signed format. But DAC accepts only unsigned numbers. So you need to add an offset of 128 (2^8/2 + 1 for 8 bit DAC) manually before passing the filter output to DAC.


                You can add this offset in an ISR connected to the Interrupt pin of Filter component.


                Note: The same method of adding offset is applicable to HPF as well because HPF also removes the DC component.


                I've herewith attached a sample project for HPF where I'm explaining how to add the offset manually to the output of Filter. Look at this. This should help you.







                1 of 1 people found this helpful
                • 5. Re: Filtering a signal





                  You are absolutely right!!! Filter and DMA are working correctly only in "Low Pass Mode". For Band Pass and High pass we need to use "interrupt request".


                  I've used your example in my project and now my Band Pass Filter works properly.




                  And  I have one question more: Could I transfer signal from one ADC to Filter's Channel_A and Filter's Channel_B simultaneously with ISR? (I don't want to use two ADC. Iis it possible?)





                  • 6. Re: Filtering a signal

                    Hi Zaq,




                    Yes it is possible. Use the below code:






                        int8 adcResult;


                        adcResult = ADC_SAR_GetResult8();


                        Filter_Write8(Filter_CHANNEL_A, adcResult);


                        Filter_Write8(Filter_CHANNEL_B, adcResult);







                    1 of 1 people found this helpful