Sie sind auf Seite 1von 3

Readme File for Code Example:

CE005 - Using FIR Filters from dsPIC Filter Design and DSP library
-------------------------------------------------------------------

This file contains the following sections:


1. Code Example Description
2. Folder Contents
3. Suggested Development Resources
4. Reconfiguring the project for a different dsPIC30F device
5. Revision History

1. Code Example Description:


----------------------------
Microchip's 16-bit dsPIC� Digital Signal Controllers feature a DSP Engine in the
CPU that is capable of executing Digital FIR and IIR filters with great efficiency
and reliability. The dsPIC� Filter Design Software provides a means of generating
coefficients for digital filters via an easy to use Graphic User Interface (GUI).
The dsPICworks Data Analysis and Design software provides a GUI-based mechanism for
generating signals and exporting them in to data files or assembler files. The
dsPIC30F DSP library provides functions to perform FIR filtering alongside other
DSP functions.

In this code example, we demonstrate how these tools can be used to generate
signals, design filters and implement these in firmware.
This example demonstrates how one can filter a square wave to produce
a sine wave signal. For the example, we have used an input square
wave of 1 KHz frequency sampled at 20 KHz. This signal was generated
by dsPICworks Data Analysis and Design Software.

Four (4) filter examples are provided in this project/workspace:


1. Demonstrating how to use the DSP library and the dsPIC Filter
Design software to perform a Low Pass Filter when:
a. FIR Filter Coefficients are stored in Program Flash Memory
b. FIR Filter Coefficients are stored in RAM
2. Demonstrating how to use the DSP library and the dsPIC Filter
Design software to perform a Band Pass Filter when:
a. FIR Filter Coefficients are stored in Program Flash Memory
b. FIR Filter Coefficients are stored in RAM
The workspace has been configured for example (1a) above.
To reconfigure the project for Bandpass filter, that uses filter
coefficients stored in RAM (example (2b) above), perform the following :
1. Remove the lowpassexample_psv.s file
2. Add the bandpassexample.s file into the project
3. Comment out the line of code that defines "LOWPASSFILTER" as
follows:
// #define LOWPASSFILTER
4. Comment out the line of code that defines the symbol
"FILTERCOEFFS_IN_PROGMEM" as follows:
// #define FILTERCOEFFS_IN_PROGMEM
5. Re-build the project

Use the stopwatch feature in MPLAB SIM to compare the execution


time of a filter that uses coefficients stored in program memory
versus that of a filter that uses coefficients stored in RAM.
You will note that the performace in both cases is comparable.

2. Folder Contents:
-------------------
This folder contains the following sub-folders:
a. gld
This folder contains a linker script file for the example project.
This file is used for building the project for a 30F6014A device.
This file simply includes the relevant device linker script,
"p30F6014A.gld" and the relevant MPLAB� C30 library files,
"libdsp-coff.a", "libc-coff.a", and "libm-coff.a" or
"libdsp-elf.a", "libc-elf.a", and "libm-elf.a" from their installed
location.

b. h
This folder contains C header files useful in building this
project. Device register and bit definitions are provided in
the "p30F6014A.h" file, which may be found in the installation folder
of the MPLAB� C30 toolsuite.

c. hex
This folder contains three file types - coff, hex and map.
These are files generated by the MPLAB� C30 toolsuite on build
operation performed within MPLAB� IDE. The *.map file contains
details on memory allocation for various variables, constants
and dsPIC30F instructions specified in the source and library
code. The *.hex file contains a binary file that may be
programmed into the dsPIC30F device. The *.coff file contains
a binary file that is used by MPLAB� IDE for simulation.

d. src
This folder contains all the C and Assembler source files (*.c,
*.s) used in demonstrating the described example. This folder
also contains a sub-folder named "obj" that stores compiled
object files generated when the project is built.

e. design
This folder contains files created by dsPIC Filter Design and
dsPICworks Data Analysis and Design Software. Input signal files,
output signal files and filter specifications have been provided
here.

3. Suggested Development Resources:


-----------------------------------
a. dsPICDEM� 1.1 Development Board (See below)
b. dsPIC30F6014A Digital Signal Controller Plug-In Module (See below)

4. Reconfiguring the project for a different dsPIC30F device:


-------------------------------------------------------------
The Project/Workspace can be easily reconfigured for any dsPIC30F device.
Please use the following general guidelines:
a. Change device selection within MPLAB� IDE to a dsPIC30F device of
your choice by using the following menu option:
MPLAB IDE>>Configure>>Select Device

b. Provide the correct device linker script and header file for your
device. Device linker scripts and header files are available in your
MPLAB� C30 installation folder under:
Device Linker Script-
YourDrive:>Program Files\Microchip\MPLAB C30\support\gld
Device C Header file-
YourDrive:>Program Files\Microchip\MPLAB C30\support\h
Device ASM Include file-
YourDrive:>Program Files\Microchip\MPLAB C30\support\inc

c. Provide the appropriate path to your MPLAB C30 support file locations
using the menu option:
MPLAB IDE>>Project>>Build Options>>Project

d. Chose the development board applicable to your device. Some options


are provided below:
- dsPICDEM� 2 Development Board supports:
30F2010, 30F2011, 30F2012, 30F3010, 30F3011, 30F3012, 30F3013,
30F3014, 30F4011, 30F4012, 30F4013

- dsPICDEM� 1.1 Development Board supports:


30F5013, 30F6010, 30F6011, 30F6012, 30F6013, 30F6014,
30F6011A, 30F6012A, 30F6013A, 30F6014A

- dsPICDEM� MC1 Development Board supports:


30F6010, 30F6010A, 30F5016

e. Re-build the MPLAB� project using the menu option:


MPLAB IDE>>Project>>Build All

f. Download the hex file into the device and run.

5. Revision History :
---------------------
09/30/2005 - Initial Release of the Code Example

Das könnte Ihnen auch gefallen