Introduction: - Digital 5

advertisement
Digital 5 Band Equalizer
Electrical Engineering 113D
Instructor: Professor Jain
TA: Rick Lan
Spring 2006
June 6, 2006
Authors
Michael Kim – 103109105
Gordon Tsui Introduction and Background
Digital signal processing is widely used in audio processing, which is the
processing of a representation of audio signals and sounds. For this project, we dealt with
the audio process of equalization. Equalization is defined as the process of modifying the
frequency envelope of sound and to adjust the frequency response of an audio device.
This process is achieved through the use of various filters. These filters include a
combination of low pass, band pass and high pass filters. With the combination of these
filters, we were able to isolate certain frequencies in the audio waveform, keeping the
range of frequencies we desired and eliminating those undesired. To be more precise, for
our project, a 5-band equalizer was implemented through the use of a single low pass
filter, three band pass filters and a single high pass filter.
In order to implement our equalizer using DSP, we were first required to design
digital finite impulse response filters (FIR) using MATLAB. FIR filters operate on a
basis of samples rather than a continuous signal, which makes it very easy to configure
different filters with DSP implementation. Basically, by just changing the coefficient
values, we were able to modify and create the low pass, band pass and high pass filters
needed for our project. These coefficients were then quantized and assembly code was
written to implement difference equations associated with them. The input for our
sampled data values would be from the AC01 and the output would be sent through the
D/A converter found on the AC01. Our input was an analog signal, which was converted
through the A/D converter and then fed into the DSP. From there the filters were applied
and then fed through the D/A converter where the output was analyzed.
Project Development
Step 1 – Materializing Ideas
The first stage of the project development was finding a topic to use for our
project. In looking over the various experiments and topics covered in the beginning
weeks of the class, we decided to model our project from the digital filtering experiment.
For that experiment, it only dealt with the implementation of a low pass filter, but with
the knowledge of changing filters through the modification of coefficient values, we were
able to apply that knowledge and extend it to create digital sound equalization.
Step 2 – Implementations of FIR Filters
Through the use of the fdatool found in MATLAB, we were able to create the
desired filters for our project. Since we decided on creating a 5-band equalizer, we
needed to design a low pass, three band pass and high pass filter. The original
specifications for these filters were as follows:
Filter Type
Low Pass
Band Pass 1
Band Pass 2
Band Pass 3
High Pass
Frequency Range
0-2kHz
2kHz-4kHz
4kHz-7kHz
7kHz-10kHz
10khz and above
But in being restricted in having a ripple of 1dB, changes were made in the
frequency ranges for each of the filters. The modified ranges for the filters are:
Filter Type
Low Pass
Band Pass 1
Band Pass 2
Band Pass 3
High Pass
Frequency Range
0-2kHz
1.6kHz-3.6kHz
4.2kHz-7.2kHz
7.7kHz-9.7kHz
10.28khz and above
The system response representation for these filters can be seen to be:
LOW PASS
BAND PASS
OUTPUT
INPUT
BAND PASS
BAND PASS
HIGH PASS
From this system diagram, we then needed to find the impulse response of the
system and verify it with the specifications of our filters. We were able to get a ripple of
1dB and once the proper filters were created, the coefficients were exported and then
quantized. The impulse response is shown below.
Step 3 – DSP Coding in Assembly
We modified the assembly code from Experiment 2 as well as the 3-band
equalizer that was posted on line. We will walk through the code and talk about the
changes we made started from the beginning.
Since we are implementing a 5-band equalizer, we need to allocate sections of
memory (.setsect) for the five filters.
In the .data section, since each filter has 123 coefficients, we needed to create 123
data buffers to hold the delayed values. We added an additional five data bits to round
the total memory size to 128 since the size should be a power of two. At the end of the
data section, there are five gain labels, XGL, XGB, XGBB, XGBBB, XGH, which hold
the value of the gain we will apply to each filter output. Since we only attenuate instead
of applying actual gain to a signal, we can apply from zero to one gain to the signal
(normalized by 2^15-1).
In the .text section, accumulator A receives the value of the data. Then the
pointer AR1 is used and reused to point to the first slot in memory for each of the five
filter sections. Then using the same code as Exp 2., after performing the difference
equations with the appropriate coefficients, the output of each filter is stored into A.
Separate pointers (AR2, AR4, AR5, AR6) are used for each filter to hold the MSB value
of A. Then we use the lines:
MACP(*AR0, XGL,A)
*AR0 = hi(A)
where AR0 has the value of the low pass filter output, XGL is the gain to be applied for
the low pass, and A is the accumulator. These two lines multiply the value pointed to by
AR0 and the value XGL and store it in A. Then AR0 holds the new MSB of A. This
process of gain is applied to each filter. At the end, all of these five outputs are summed
up to reconstruct our modified signal.
Also, since our filters were created using a Fs of 48K, we set REG1 = 10Ah and
REG2 = 10Ah which gives a Fs of 50K.
Step 4 – Test and Results
Finally when all the coding and debugging was done, we now needed to test out
our code and apply it to real time audio signals. Audio files were fed into the DSP board
through a laptop and the output was recorded back through the laptop as well. Within the
assembly code, we changed the gain values for each of the filters to create modifications
in our audio file. We then observed the low bass frequency sounds, the mid-range sounds
and the high treble sounds of the audio input.
Discussion of Results
MATLAB Results
This is the magnitude responses of the filters created through the fdatool in
MATLAB.
Low Pass Filter
Magnitude Response (dB)
20
0
-20
Magnitude (dB)
-40
-60
-80
-100
-120
-140
-160
0
5
10
15
Frequency (kHz)
20
Band Pass Filter 1
Magnitude Response (dB)
20
0
-20
Magnitude (dB)
-40
-60
-80
-100
-120
-140
-160
0
5
10
15
Frequency (kHz)
20
Band Pass Filter 2
Magnitude Response (dB)
20
0
-20
Magnitude (dB)
-40
-60
-80
-100
-120
-140
-160
0
5
10
15
Frequency (kHz)
20
Band Pass Filter 3
Magnitude Response (dB)
20
0
-20
Magnitude (dB)
-40
-60
-80
-100
-120
-140
-160
0
5
10
15
Frequency (kHz)
20
High Pass Filter
Magnitude Response (dB)
20
0
-20
Magnitude (dB)
-40
-60
-80
-100
-120
-140
-160
0
5
10
15
Frequency (kHz)
20
We then quantized these coefficients and graphed them to make sure that they
matched the specifications from the original filters created. We use the value 55933 to
scale all the maximum of the coefficients up to 2^15-1. When graphed they looked
exactly like the same filter, except when zooming in we see that there is a slight
difference seen for every filter that was plotted. Below is a comparison of the low pass
filter that was implemented, but similar graphs were produced when the quantized and
the un-quantized filter coefficients were plotted.
Magnitude (dB)
-40.664
Quantized Coeff.
Unquantized Coeff.
-40.666
-40.668
0.514
0.514 0.514
0.514
0.514 0.514
0.514
Normalized Frequency ( rad/sample)
0.514
Phase (degrees)
0
-200
-400
-600
-800
-1000
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
1
A frequency sweep was then applied to obtain the magnitude response of the
filters through the DSP board. The following graphs were obtained for each of the filters:
Low Pass Filter Magnitude Response
15
10
5
Magnitude (dB)
0
-5
0
500
1000
1500
-10
-15
-20
-25
-30
-35
-40
Frequency (Hz)
2000
2500
Band Pass Filter 1 Magnitude Response
15
10
5
Magnitude (dB)
0
-5
0
1000
2000
3000
4000
5000
-10
-15
-20
-25
-30
-35
Frequency (Hz)
Band Pass Filter 2 Magnitude Response
15
10
5
Magnitude (dB)
0
-5
0
2000
4000
6000
-10
-15
-20
-25
-30
-35
Frequency (Hz)
8000
10000
Band Pass Filter 3 Magnitude Response
15
10
5
Magnitude (dB)
0
-5
0
2000
4000
6000
8000
10000
12000
-10
-15
-20
-25
-30
-35
-40
Frequency (Hz)
High Pass Filter Magnitude Response
15
10
5
Magnitude (dB)
0
-5
0
2000
4000
6000
8000
10000
-10
-15
-20
-25
-30
-35
Frequency (Hz)
12000
14000
16000
What was observed from the magnitude responses from the DSP board was that
for the low pass filter, there was a dip for the beginning frequencies. This was due to the
fact that the DSP board has a built in anti-aliasing high pass filter, which for our case
seemed to have filtered out frequencies 500Hz and below. This would cause a major
change in our music, blocking out most of the lower frequencies, which can be audibly
heard from the music samples obtained. Another observation to note would be in the drop
off at around 12 kHz for the high pass filter. This is due to the fact that the FLP of the
DSP causes attenuation at around 12.5 kHz, for our sample frequency of 50 kHz. But
since the range of sound for the human ear is at a range of 20 Hz to 20 kHz, it is still
valid to hear the differences for our filters.
Calculations of Frequencies
REGA = 10 REGB = 10
MCLK
10 MHz
Fs 

 50kHz
2 AB
2*10*10
MCLK
FLP 
 12.5kHz
80 A
From the graphs shown, it showed the validity of our filters and when tested with
an analog audio input, it produced the desired sound output that we wanted. When the
low pass was implemented, the low bass sounds were more apparent, when the band pass
filters were implemented, the mid treble sounds were heard and attenuation of lower
frequencies occurred. Finally, when the high pass filter was implemented, only high
pitched noises were heard, which only concludes that our project was a success.
Examples
Low Pass Filtered Sound
Band Pass Filtered Sound
High Pass Filtered Sound
Band and High Pass Filtered Sound
Original Music File
From the implementation of the equalizer, we can see that it can be applied to
many musical applications found in our everyday lives. It is used everyday when we
listen to music on our iPod, CD player, computer and other audio heard from digital
devices. Our project only dealt with 5-bands, but further bands can be added to recreate
different quality of sounds, such as live music or music in heard in a concert hall. The
uses of audio equalizers are very useful in matching preferences to every user. Whether
they prefer more bass in their music or more vocals, the equalizer can provide for their
every need.
Problems
One of the first problems we encountered was that we had over 2000 coefficients
for each filter. The reason that we had made the transitions on our filters too sharp
(|Fpass-Fstop| was too small) so we had to stretch those out until the board could handle
the size.
When we first tried to right the assembly code, we combined all five filters at
once with an IPod as input, and tried to listen to the output. At the output, we could only
hear a high shrill noise. Initially we had tried using the Exp. 2 code structure:
A = trcv
@XN = A << 0
AR3 = #XNLAST
A= #0
repeat(#18)
MACD(*AR3-,h0,A)
@OUTPUT = hi(A) << 0
A = @OUTPUT << 0
We also tried using the equalizer code online, where they also used the ‘@’ operator as
well as separate pointers to receive samples each of their filter sections in data. But the
‘@’ operator did not work with the combination of the five filters so we reused a single
pointer AR1 to put the samples into each filter’s data sections. Then we used individual
pointers to hold the output values of the filters.
Also for the gain, instead of using the shift ‘<<’ and ‘>>’ to apply gain by powers
of 2, we used the MACP function instead so we could have any attenuation value from 0
to 1 normalized by 2^15-1. When we applied a gain of 1*2^15-1=32767, we discovered
that instead of reproducing the input signal, the output actually decreased the input by a
factor of 2. The reason for this as explain by the TA Rick, is that when we take only the
high bits of A, this cuts the value by half. But this was not a problem since we could
adjust the attenuation for the other filters to be all relative.
Conclusion
Overall, in our project we were successfully able to produce a digital 5-band
equalizer that met the performance standards required for our filters. The impulse
response showed a ripple of less than 1dB and the frequencies were within ranges that
were desirable for selection. The functions of FIR filters were also exemplified and
proved to be highly useful since they operate on a basis of samples rather than that of
continuous signals. By changing coefficient values, different filters were easily
configured, where in the analog case; physical changes must be done to carry out the
same process. This application of digital filters aided us in the design of our equalizer and
how it can be useful for other conditions in which a transmission medium can change
constantly.
References
Electrical Engineering 113D Course Reader
Experiment 2
Source Code Listing
Equalizer.ASM – Main program that implements the FIR filters. This program will
“.include” the following seven files. Compiling this will result in a complete object file
needed to run the FIR filters on the DSP.
********************************************************************
* EE113D: Spring 2006
*
* File: EQUALIZER.ASM
*
* Main program file for implementing a 5-band Equalizer.
*
********************************************************************
*
* This is an 123 tap FIR lowpass, band pass and highpass filter.
* It takes samples of
* an incoming signal and passes it through the filter by performing
* the usual convolution sum. The multiply with accumulate function
* MACD is used for the main FIR computation
*
* The sampling frequency and filter coefficients
* are set to give us a cutoff frequency
* of 12500 Hz for this program.
*
.title "5-Band Equalizer"
.width
80
.length 55
.mmregs
.setsect ".data", 0x400, 1
.setsect ".text", 0x1800, 0
.setsect "vectors", 0x180, 0
.setsect "lowps", 0x2000,0
.setsect "bandps1", 0X2100,0
.setsect "bandps2", 0X2200,0
.setsect "bandps3", 0X2300,0
.setsect "highps", 0X2400,0
.sect "lowps"
.copy "lps.asm"
.sect "bandps1"
.copy "firstbps.asm"
.sect "bandps2"
.copy "secbps.asm"
.sect "bandps3"
.copy "thirdbps.asm"
.sect "highps"
; insert labeled filter
; coefficient values here
.copy "hps.asm"
.sect "vectors"
.copy "firvecs.asm"
.data
; usual vector table
; data section where
; intermediate results of the
; calculations will be stored
XLP
.word
0,0,0,0,0,0,0,0,0,0
HP filter coefficients.
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0
XNLAST
.word
0
OUTPUT
.word
0,0,0,0,0
bit bucket
XBP
.word
0,0,0,0,0,0,0,0,0,0
HP filter coefficients.
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0
XNLASTB
.word
0
OUTPUTB
.word
0,0,0,0,0
XBBP
.word
0,0,0,0,0,0,0,0,0,0
HP filter coefficients.
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
; 123 data locations for 123
; extra word for the
; 123 data locations for 123
; 123 data locations for 123
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0
XNLASTBB .word
0
OUTPUTBB .word
0,0,0,0,0
; add 0 to prevent error.
blocks of 128 in memory.
create
XBBBP
.word
0,0,0,0,0,0,0,0,0,0
; 123 data locations for 123
HP filter coefficients.
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0
XNLASTBBB .word
0
OUTPUTBBB .word
0,0,0,0,0
; add 0 to prevent error. create
blocks of 128 in memory.
XHP
.word
0,0,0,0,0,0,0,0,0,0
; 123 data locations for 123 HP
filter coefficients.
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0,0,0,0,0,0,0,0,0
.word
0,0
XNLASTHP
.word
0
OUTPUTHP
.word
0,0,0,0,0
; add 0 to prevent error. create
blocks of 128 in memory.
XGL
XGB
XGBB
XGBBB
XGH
.word
.word
.word
.word
.word
32767
0
0
0
0
.text
start:
intm
call
pmst
sp =
DP =
; main program section
=1
AC01INIT
= #01a0h
#0ffah
#0
; globally disable all interrupts
; set up iptr
; set up init stack pointer
; set up data pointer to top of
imr = #240h
intm = 0
nop
WAIT:
goto
WAIT
receive:
DP = #XLP
; set up RINT and HPI INT
; turn on all interrupts
; wait for receive interrupt.
; This sets Data Memory Page Pointer
;
to page XN, which is defined
;
earlier in the program.
;-------- get sample and run through filter ------------------------A = trcv
; LOAD ACCUMULATOR WITH WORD
; RECEIVED FROM AIC!
; STORE THE VALUE OF RECEIVED
; WORD TO VARIABLE XN!
AR1=#XLP
*AR1=A
AR1=#XBP
*AR1=A
AR1=#XBBP
*AR1=A
AR1=#XBBBP
*AR1=A
AR1=#XHP
*AR1=A
; !!!!!!!!!!!!
Fill in the details here
!!!!!!!!!!!!!!!!!!!!
AR3 = #XNLAST
A = #0
repeat(#122)
MACD(*AR3-,L0,A)
*AR0 = hi(A)
A=#0
MACP(*AR0, XGL, A)
;gain of 32767=(1*2^15-1)
*AR0 = hi(A)
;should half the signal by taking hi(A)
AR3 = #XNLASTB
A = #0
repeat(#122)
MACD(*AR3-,B0,A)
*AR4 = hi(A)
A=#0
MACP(*AR4, XGB, A)
*AR4 = hi(A)
AR3 = #XNLASTBB
A = #0
repeat(#122)
MACD(*AR3-,BB0,A)
*AR2 = hi(A)
A=#0
MACP(*AR2, XGBB, A)
*AR2 = hi(A)
AR3 = #XNLASTBBB
A = #0
repeat(#122)
MACD(*AR3-,BBB0,A)
*AR5 = hi(A)
A=#0
MACP(*AR5, XGBBB, A)
*AR5 = hi(A)
AR3 = #XNLASTHP
A = #0
repeat(#122)
MACD(*AR3-,H0,A)
*AR6 = hi(A)
A=#0
MACP(*AR6, XGH, A)
*AR6 = hi(A)
A = *AR0
A = A + *AR4
A = A + *AR2
A = A + *AR5
A = A + *AR6
A = #0x0FFFC & A
tdxr = A
return_enable
transmit:
return_enable
; Enable interrupts and return
;
from interrupt.
; Enable interrupts and return
;
from interrupt.
;-------- -------------------------end ISR----------------------.copy "firinit.asm"
.end
These are the Coefficient Values for each filter
LPS.ASM – Low Pass Filter
; Generated from MATLAB
L0
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
7
7
11
15
20
26
32
38
45
52
58
64
68
70
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
70
67
61
51
36
17
-8
-37
-72
-111
-155
-202
-252
-303
-355
-405
-452
-493
-528
-554
-568
-569
-556
-526
-477
-410
-323
-216
-89
58
222
403
598
806
1022
1243
1467
1688
1904
2111
2303
2479
2634
2765
2870
2947
2993
3009
2993
2947
2870
2765
2634
2479
2303
2111
1904
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
1688
1467
1243
1022
806
598
403
222
58
-89
-216
-323
-410
-477
-526
-556
-569
-568
-554
-528
-493
-452
-405
-355
-303
-252
-202
-155
-111
-72
-37
-8
17
36
51
61
67
70
70
68
64
58
52
45
38
32
26
20
15
11
7
7
HPS.ASM – High Pass Filter
; Generated from MATLAB
H0
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
47
-267
555
-483
-24
294
11
-218
-61
166
115
-107
-161
29
178
61
-158
-150
90
212
14
-227
-140
175
250
-58
-312
-107
289
278
-170
-407
-35
436
281
-335
-504
95
622
241
-571
-597
314
861
128
-923
-678
690
1198
-127
-1518
-741
1444
1808
-775
-2922
-780
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
3896
4082
-4564
-17155
32766
-17155
-4564
4082
3896
-780
-2922
-775
1808
1444
-741
-1518
-127
1198
690
-678
-923
128
861
314
-597
-571
241
622
95
-504
-335
281
436
-35
-407
-170
278
289
-107
-312
-58
250
175
-140
-227
14
212
90
-150
-158
61
178
29
-161
-107
115
166
.word
.word
.word
.word
.word
.word
.word
.word
.word
-61
-218
11
294
-24
-483
555
-267
47
FIRSTBPS.ASM – First Band Pass Filter
; Generated from MATLAB
B0
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
10
21
39
61
84
102
109
99
67
12
-62
-146
-225
-285
-310
-293
-231
-135
-23
82
154
173
132
36
-92
-217
-301
-307
-215
-26
237
528
789
963
1007
906
675
365
45
-208
-332
-297
-119
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
142
388
506
396
-2
-684
-1575
-2533
-3371
-3890
-3926
-3381
-2254
-652
1224
3108
4716
5796
6177
5796
4716
3108
1224
-652
-2254
-3381
-3926
-3890
-3371
-2533
-1575
-684
-2
396
506
388
142
-119
-297
-332
-208
45
365
675
906
1007
963
789
528
237
-26
-215
-307
-301
-217
-92
36
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
132
173
154
82
-23
-135
-231
-293
-310
-285
-225
-146
-62
12
67
99
109
102
84
61
39
21
10
SECBPS.ASM – Second Band Pass Filter
; Generated from MATLAB
BB0
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
0
-15
-27
-28
-2
49
96
97
29
-86
-177
-177
-71
78
169
144
42
-31
7
120
169
25
-290
-567
-551
-147
453
872
814
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
300
-327
-659
-543
-192
16
-106
-370
-368
131
895
1348
1032
40
-991
-1361
-902
-136
171
-250
-831
-586
940
3008
3967
2450
-1354
-5436
-7087
-4765
633
6107
8397
6107
633
-4765
-7087
-5436
-1354
2450
3967
3008
940
-586
-831
-250
171
-136
-902
-1361
-991
40
1032
1348
895
131
-368
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
-370
-106
16
-192
-543
-659
-327
300
814
872
453
-147
-551
-567
-290
25
169
120
7
-31
42
144
169
78
-71
-177
-177
-86
29
97
96
49
-2
-28
-27
-15
0
THIRDBPS.ASM – Third Band Pass Filter
; Generated from MATLAB
BBB0
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
10
12
-10
-32
-22
33
65
18
-76
-97
5
124
104
-47
-148
-74
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
73
108
20
-33
6
1
-123
-164
80
391
276
-313
-699
-250
659
908
41
-985
-892
265
1090
618
-467
-820
-225
306
169
-9
384
649
-234
-1564
-1263
1128
2929
1290
-2586
-4014
-541
4227
4380
-866
-5526
-3828
2506
6018
2506
-3828
-5526
-866
4380
4227
-541
-4014
-2586
1290
2929
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
1128
-1263
-1564
-234
649
384
-9
169
306
-225
-820
-467
618
1090
265
-892
-985
41
908
659
-250
-699
-313
276
391
80
-164
-123
1
6
-33
20
108
73
-74
-148
-47
104
124
5
-97
-76
18
65
33
-22
-32
-10
12
10
FIRINIT.ASM – The usual AIC initialization file
********************************************************************
* EE113D: Spring 2006
*
* File: FIRINIT.ASM
*
* AC01 Initialization Routine
*
*
********************************************************************
.width
80
.length 55
.title "AC01 Initialization Program"
.mmregs
***********************************************************************
****
* Certain AC01 registers can be initialized using a conditional
assembly
* constant. By setting the constant REGISTER to the appropriate value,
the
* assembler will either include initialization for certain registers or
* ignore register initialization.
*
* The constant REGISTER should be set to include the following AC01
register:
*
* REGISTER (binary) =
*
*
0000 0000 0000 0001 -> initialize Register 1 (A Register)
*
0000 0000 0000 0010 -> initialize Register 2 (B Register)
*
0000 0000 0000 0100 -> initialize Register 3 (A' Register)
*
0000 0000 0000 1000 -> initialize Register 4 (Amplifier GainSelect)
*
0000 0000 0001 0000 -> initialize Register 5 (Analog
Configuration)
*
0000 0000 0010 0000 -> initialize Register 6 (Digital
Configuration)
*
0000 0000 0100 0000 -> initialize Register 7 (Frame-Sync Delay)
*
0000 0000 1000 0000 -> initialize Register 8 (Fram-Sync number)
*
* Any combination of registers can be initialized by adding the binary
* number to the REGISTER constant. For example to initalize Registers
4
* and 5, REGISTER = 18h. Upon assembly, only code for register 4 & 5
* initialization is included in the AC01INIT module. When called the
* module will load the REG4 and REG5 values into internal AC01
registers.
*
*
* Register 4 is always loaded to get a 6db input gain. This sets fullscale
* to 3v(p-p input) due to the single-ended AC01 configuration.
*
*
REGISTER .set
0bh
; Powerup default values:
REG1 .set
10Ah
;*
112h
REG2 .set
20Ah
;*
212h
REG3 .set
300h
;
300h
REG4 .set
409h
;*
405h
REG5 .set
501h
;
501h
REG6
REG7
REG8
.set
.set
.set
600h
700h
801h
AC01INIT:
xf = 0
intm = 1
tcr = #10h
imr = #280h
tspc = #0008h
tdxr = #0h
tspc = #00c8h
xf = 1
;
;
;
;
600h
700h
801h
; reset ac01
; disable all int service routines
; stop timer
; wakeup from idle when TDM Xmt int
; stop TDM serial port
; send 0 as first xmit word
; reset and start TDM serial port
; release ac01 from reset
--------------- Register init's -----------------------------.eval REGISTER & 1h, SELECT
; if REG1 then include this source
.if SELECT = 1h
;
a = #REG1
; load Acc A with REG1 value
call REQ2
; Call REQ2 subroutine
.endif
.eval REGISTER & 2h, SELECT
.if SELECT = 2h
a = #REG2
call REQ2
; if REG2 then include this source
.endif
.eval REGISTER & 4h, SELECT
.if SELECT = 4h
a = #REG3
call REQ2
.endif
; if REG3 then include this source
.eval REGISTER & 8h, SELECT
.if SELECT = 8h
a = #REG4
call REQ2
.endif
; if REG4 then include this source
.eval REGISTER & 10h, SELECT
.if SELECT = 10h
a = #REG5
call REQ2
.endif
; if REG5 then include this source
.eval REGISTER & 20h, SELECT
.if SELECT = 20h
a = #REG6
call REQ2
.endif
; if REG6 then include this source
.eval REGISTER & 40h, SELECT
.if SELECT = 40h
; if REG7 then include this source
a = #REG7
call REQ2
.endif
.eval REGISTER & 80h, SELECT
.if SELECT = 80h
a = #REG8
call REQ2
.endif
return
; if REG8 then include this source
REQ2
ifr = #080h
tdxr = #03h
; clear flag from IFR
; request secondary when AC01
idle(1)
tdxr = a
ifr = #080h
; wait for primary to xmit
; send register value to serial port
; clear flag from IFR
idle(1)
tdxr = #0h
ifr = #080h
idle(1)
return
;
;
;
;
starts
wait for secondary to xmit
send neutral state in case last init
clear flag from IFR
wait for neutral state to xmit
; return from subroutine
FIRVECS.ASM – The usual interrupt vector table
********************************************************************
* EE113L: Spring 1998
*
* File: FIRVECS.ASM
*
* Interrupt vector table for LOWPSFIR.ASM (Experiment 2 program)
*
* Original TI modified by Mohin Ahmed, UCLA (4/98)
*
********************************************************************
; The vectors in this table can be configured for processing external
and
; internal software interrupts. The DSKplus debugger uses four
interrupt
; vectors. These are RESET, TRAP2, INT2, and HPIINT.
;
* DO NOT MODIFY THESE FOUR VECTORS IF YOU PLAN TO USE THE DEBUGGER
*
;
; All other vector locations are free to use. When programming always
be sure
; the HPIINT bit is unmasked (IMR=200h) to allow the communications
kernel and
; host PC interact. INT2 should normally be masked (IMR(bit 2) = 0) so
that the
; DSP will not interrupt itself during a HINT. HINT is tied to INT2
externally.
;
;
;
.width
80
.length 55
.title "Vector Table"
.mmregs
reset
nmi
trap2
int0
int1
int2
tint
brint
bxint
trint
txint
int3
goto #80h
;00; RESET * DO NOT MODIFY IF USING DEBUGGER *
nop
nop
return_enable
;04; non-maskable external interrupt
nop
nop
nop
goto #88h
;08; trap2 * DO NOT MODIFY IF USING DEBUGGER *
nop
nop
.space 52*16
;0C-3F: vectors for software interrupts 18-30
return_enable
;40; external interrupt int0
nop
nop
nop
return_enable
;44; external interrupt int1
nop
nop
nop
return_enable
;48; external interrupt int2
nop
nop
nop
return_enable
;4C; internal timer interrupt
nop
nop
nop
return_enable
;50; BSP receive interrupt
nop
nop
nop
return_enable
;54; BSP transmit interrupt
nop
nop
nop
dgoto receive
;58; TDM receive interrupt
nop
nop
return_enable
;5C; TDM transmit interrupt
nop
nop
nop
return_enable
;60; external interrupt int3
nop
nop
nop
hpiint
goto #0e4h
DEBUGGER *
nop
nop
.space 24*16
;64; HPIint
* DO NOT MODIFY IF USING
;68-7F; reserved area
Download