Atmel Software Framework

simulator_examples/dsp32_fir/fir_example.c File Reference

32 bits FIR filtering

Copyright (c) 2011-2012 Atmel Corporation. All rights reserved.

#include <avr32/io.h>
#include "compiler.h"
#include "board.h"
#include "dsp.h"
#include "dsp_debug.h"
#include "sysclk.h"
#include "cycle_counter.h"

Macros

#define FIR_COEF_SIZE   25
 The number of tap. More...
 
#define SIZE   64
 The size of the input signal. More...
 

Functions

int main (int argc, char *argv[])
 The main function. More...
 

Variables

A_ALIGNED dsp32_t fir_coef [FIR_COEF_SIZE]
 The impulse response coefficients of the filter. More...
 
A_ALIGNED dsp32_t x [SIZE]
 Input signal resulting from a multiplication between a cosine and a sine. More...
 
A_ALIGNED dsp32_t y [SIZE-FIR_COEF_SIZE+1]
 The output buffer. More...
 

#define FIR_COEF_SIZE   25

The number of tap.

Referenced by main().

#define SIZE   64

The size of the input signal.

Referenced by main().

int main ( int  argc,
char *  argv[] 
)

The main function.

Note
the call to sysclk_init() will disable all non-vital peripheral clocks, except for the peripheral clocks explicitly enabled in conf_clock.h.

References dsp32_debug_sprintf(), dsp32_filt_fir(), dsp_debug_initialization, fir_coef, FIR_COEF_SIZE, FOSC0, Get_sys_count, i, SIZE, sysclk_init(), x, and y.

Initial value:
= {
DSP32_Q(-0.01559148806),
DSP32_Q(-0.00894210585),
DSP32_Q(0.00000000000),
DSP32_Q(0.01092924048),
DSP32_Q(0.02338723209),
DSP32_Q(0.03678830106),
DSP32_Q(0.05045511524),
DSP32_Q(0.06366197724),
DSP32_Q(0.07568267286),
DSP32_Q(0.08583936913),
DSP32_Q(0.09354892838),
DSP32_Q(0.09836316431),
DSP32_Q(0.10000000000),
DSP32_Q(0.09836316431),
DSP32_Q(0.09354892838),
DSP32_Q(0.08583936913),
DSP32_Q(0.07568267286),
DSP32_Q(0.06366197724),
DSP32_Q(0.05045511524),
DSP32_Q(0.03678830106),
DSP32_Q(0.02338723209),
DSP32_Q(0.01092924048),
DSP32_Q(0.00000000000),
DSP32_Q(-0.00894210585),
}
#define DSP32_Q(fnum)
Convert a float into a 32-bit signed fixed-point type.
Definition: dsp_types.h:301

The impulse response coefficients of the filter.

Input signal resulting from a multiplication between a cosine and a sine.

The output buffer.