📄 tonegen.lst
字号:
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 6.60 Sat Dec 22 17:29:53 2001
Copyright (c) 1987-1995 Texas Instruments Incorporated
tonegen.asm PAGE 1
1 ;
2 ; (C) Copyright 1997 White Mountain DSP, Inc. All rights reserved.
3 ; Use of copyright notice is precationary and does not imply publication.
4 ;
5 ; ======== ToneGen.asm ========
6 ;
7 ; Without any audio input to the AIC, this program will generate a
8 ; Sine wave output using a second-order digital sinusoidal
9 ; oscillator algorithm. The algorithm will calculate the sine wave
10 ; data and send it to the AIC using the transmit interrupt of the
11 ; synchronous serial port.
12 ;
14
15 * .include "Dsp_vect.h"
16 .include Dsp_init.h
17 .mmregs
18
19 0010 EN_XINT .set 010h
20 0020 EN_TXRXINT .set 020h
21 ; enable the XINT interrupts
22 002f CLR_XINT .set 02fh
23 ; mark the interrupt as serviced
24
25 4000 SSPCFG1 .set 04000h ; settings for the SSPCR (in reset)
26 4c30 SSPCFG2 .set 04C30h ; settings for the SSPCR (out of reset)
27 ; Tx interrupt fires when Tx FIFO (4-deep) empty
28
29 0000 .data ; starting address for this section is
30 ; 300h in Data Space
31
32 0000 0000 cinfo .word 0 ; cinfo variable
33 0001 0000 data2aic .word 0 ; data to be sent to AIC
34
35 ;
36 ; ======== COEFFS ========
37 ; The table that follows supplies the coefficients and intial
38 ; conditions for the difference equation of the digital sinusoidal
39 ; oscillator.
40 ;
41 ; The basic formulas for a second-order digital sinusoidal oscillator
42 ; are:
43 ; Difference Equation: y(n) = coeff*y(n-1) - y(n-2)
44 ; Initial Conditions: y(-1) = 0
45 ; y(-2) = -A*sin(w0)
46 ; where
47 ; coeff = 2*cos(w0)
48 ; w0 = 2pi*f/fs
49 ; and
50 ; A = desired amplitude of sine wave
51 ; f = desired frequency of sine wave
52 ; fs = sampling frequency
53 ;
54 ; For more on Digital Sinusoidal Oscillators see:
55 ;
56 ; Proakis, J., Manolakis, D. (1988) Introduction to Digital Signal
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 6.60 Sat Dec 22 17:29:53 2001
Copyright (c) 1987-1995 Texas Instruments Incorporated
Include file with I/O register declarations PAGE 2
57 ; Processing, pp. 373-376, MacMillan, New York.
58 ;
59 ;
60 ; Due to the algorithm used to generate the sine wave data the formulas
61 ; for the coefficient and the intial conditions change slightly. They
62 ; become:
63 ; coeff = cos(w0)*32768
64 ; y(-2) = -A*sin(w0)*32768
65 ;
66 ; The format of the sections that follow are:
67 ; .word coeff ;where coeff = cos(w0)*32768
68 ; .word y(-1) ;where y(-1) = 0
69 ; .word y(-2) ;where y(-2) = -A*sin(w0)*32768
70 ;
71 ; Each section starts with a comment stating which values were used
72 ; for A, f, and fs, followed by the three calculated values of coeff
73 ; y(-1) and y(-2). It is important to note that only one section can
74 ; be used (un-commented) at a time.
75 ;
76 ; There are 2 limitations to this application:
77 ;
78 ; 1) Due to the fact that we are using only a second-order
79 ; oscillator the frequency observed on the output of the
80 ; AIC will not match exactly with the value of f that was
81 ; used to calculate the coefficients. If more precision is
82 ; required, a higher order oscillator may be used.
83 ;
84 ; 2) The default state of the AIC at power-up is for a sampling
85 ; rate of 16kHz and a low-pass filter on the output with its
86 ; -3dB point located at 7.2kHz. Therefore as f increases
87 ; towards the -3dB point of the filter the amplitude of the
88 ; generated sine wave will decrease. If increased bandwidth
89 ; is desired then the AIC can be setup to increase the sampling
90 ; rate and the frequency at which the -3dB point occurs in the
91 ; filter. See the TLC320AC02C Data Manual (SLAS084B) for further
92 ; information.
93 ;
94 ; NOTE:
95 ; It is extemely important that when the Interrupt Mask register is setup
96 ; that the TXRXINT interrupt (for the Async Serial Port) be enabled in
97 ; addition to any interrupts being used by the user's program. If the
98 ; TXRXINT is not enabled then the monitor program will not function properly.
99
100 ; Just uncomment a set of COEFFS to use them in your calculations.
101 ; Default COEFFS are for a 1kHz sine wave
102
103 ;COEFFS ; for f = 500Hz, A = .25, fs = 16000
104 ; .word 32138
105 ; .word 0
106 ; .word -1598
107
108 0002 COEFFS ; for f = 1kHz, A = .25, fs = 16000
109 0002 7642 .word 30274
110 0003 0000 .word 0
111 0004 f3c1 .word -3135
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 6.60 Sat Dec 22 17:29:53 2001
Copyright (c) 1987-1995 Texas Instruments Incorporated
Include file with I/O register declarations PAGE 3
112
113 ;COEFFS ; for f = 1.5kHz, A = .25 fs = 16000
114 ; .word 27246
115 ; .word 0
116 ; .word -4551
117
118 ;COEFFS ; for f = 2kHz, A = .25 fs = 16000
119 ; .word 23170
120 ; .word 0
121 ; .word -5793
122
123 ;COEFFS ; for f = 2.5kHz, A = .25 fs = 16000
124 ; .word 18205
125 ; .word 0
126 ; .word -6811
127
128 ;COEFFS ; for f = 3kHz, A = .25 fs = 16000
129 ; .word 12540
130 ; .word 0
131 ; .word -7568
132
133 ;COEFFS ; for f = 3.5kHz, A = .25 fs = 16000
134 ; .word 6393
135 ; .word 0
136 ; .word -8035
137
138 ;COEFFS ; for f = 4kHz, A = .25 fs = 16000
139 ; .word 0
140 ; .word 0
141 ; .word -8192
142
143 ;COEFFS ; for f = 4.5kHz, A = .25 fs = 16000
144 ; .word -6393
145 ; .word 0
146 ; .word -8035
147
148 ;COEFFS ; for f = 5kHz, A = .25 fs = 16000
149 ; .word -12540
150 ; .word 0
151 ; .word -7568
152
153 ;COEFFS ; for f = 5.5kHz, A = .25 fs = 16000
154 ; .word -18205
155 ; .word 0
156 ; .word -6811
157
158 ;COEFFS ; for f = 6kHz, A = .25 fs = 16000
159 ; .word -23170
160 ; .word 0
161 ; .word -5793
162
163 ;COEFFS ; for f = 6.5kHz, A = .25 fs = 16000
164 ; .word -27246
165 ; .word 0
166 ; .word -4551
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 6.60 Sat Dec 22 17:29:53 2001
Copyright (c) 1987-1995 Texas Instruments Incorporated
Include file with I/O register declarations PAGE 4
167
168 ;COEFFS ; for f = 7kHz, A = .25 fs = 16000
169 ; .word -30274
170 ; .word 0
171 ; .word -3135
172
173 ;COEFFS ; for f = 7.5kHz, A = .25 fs = 16000
174 ; .word -32138
175 ; .word 0
176 ; .word -1598
177
178 ;
179 ; ======== vectors ========
180 ;
181 ; This is the interrupt vector table that tells the DSP where
182 ; the various ISRs are located that will be serviced during the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -