9-6 Direct FIR Filter Programs

These are direct FIR filter programs in assembly language.
FIR (Finit Impulse Response) filters have these characteristics.

There are a variety of FIR filter configurations, and in this diagram we are using what is called the direct type.

The system program is configured with the 3 files like this.
These are the startup routine, the file with the main function that executes XY memory initialization and data input and output, and the program file that executes filter operations.

Here are the files that include the main functions and filter operation programs.

This process initializes the X-RAM. The area for data input is here.

This function (initXYRAM() ) initializes X-RAM for coefficients.
The filter coefficients are constant if the characteristics are fixed. In SH3-DSP, the X/Y memory that can be used in DSP functions is only RAM, so coefficients are transferred from ROM to X-RAM.

This process sets the DSP bit of the status register.
Other register settings are initialized by this function (setDSP()).
This function (tuni0()) is the timer interrupt process.
This function (fir()) filters data input from the A/D converter and outputs it from the D/A converter.

8-bit data input from the A/D converter is scaled by shifting 7 bits left to process it as signed 16-bit data.
The result is re-scaled and D/A converted.

Data scaling is like this.

This subroutine initializes the DSP registers.
The repeat function is set. Execution of this line is repeated 48 times.
Sampling data is designated for modulo addressing.

This is the filter operation subroutine.

The newest sampling data replaces the oldest data.

This executes the filter operation.The result is scaled and returned.

This designates the X-RAM area to store the filter coefficients.These are the filter coefficients.

Fixed point uses these control instructions.