-
Notifications
You must be signed in to change notification settings - Fork 0
/
dds.asm
461 lines (444 loc) · 18.8 KB
/
dds.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
; Copyright (c) 2019 Malik Enes Şafak
;
; Permission is hereby granted, free of charge, to any person obtaining
; a copy of this software and associated documentation files (the
; "Software"), to deal in the Software without restriction, including
; without limitation the rights to use, copy, modify, merge, publish,
; distribute, sublicense, and/or sell copies of the Software, and to
; permit persons to whom the Software is furnished to do so, subject to
; the following conditions:
;
; The above copyright notice and this permission notice shall be
; included in all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
; LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
; WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.msp430
.include "msp430g2452.inc"
RAM equ 0x0200
ROM equ 0xE000
REGPHASELOW equ R15
REGPHASEHIGH equ R14
REGTUNINGLOW equ R13
REGTUNINGHIGH equ R12
REGPITCH equ R11
OSCSTATUS equ R10
REGCOUNTER equ R9
OSC1MUTE equ BIT0
OSC2MUTE equ BIT1
OSC1 equ BIT2
OSC2 equ BIT3
PRECALCTDIVS equ 0x0863
;------------------------------------------------------------------------------
; Main Code
; This program uses Q16.16 fixed point calculations for DDS
;------------------------------------------------------------------------------
.entry_point RESET ;SET ENTRY POINT
.org ROM ;ENTRY POINT ADDRESS IS BEGINNING ADDRESS OF FLASH
RESET:
MOV.W #0x0300, SP ;SET SP TO HIGHEST RAM ADDRESS
STOPWDT:
MOV.W #WDTPW+WDTHOLD, &WDTCTL ;STOP WDT
CONFCPU:
MOV.B &CALBC1_16MHZ_, &BCSCTL1 ;SET BCSCTL1 TO FACTORY CALIBRATED 16MHZ VALUE
MOV.B &CALDCO_16MHZ_, &DCOCTL ;SET DCOCTL TO FACTORY CALIBRATED 16MHZ VALUE
CONFTIMER:
MOV.W #TASSEL_2+ID_1+MC_1, &TACTL ;TIMER A CLOCK SOURCE SMCLK, INPUT DIVIDER 2, UP MODE
MOV.W #255, &TACCR0 ;SMCLK UPDATES AT 8MHZ OUR SAMPLING FREQUENCY IS 31.25KHZ
BIS.W #CCIE, &TACCTL0 ;TIMER A C/C 0 IRQ IS ENABLED
CONFPWM:
MOV.B #0xFF, &P1DIR ;SET P1 OUTPUT AND LOW FOR LOWER ENERGY CONSUMPTION AND NOISE
MOV.B #0, &P1OUT
BIS.B #BIT6, &P1DIR ;SET P1.6 TO OUTPUT
BIS.B #BIT6, &P1SEL ;SET P1.6 SPECIAL FUNC1 (FOR PWM)
BIC.B #BIT6, &P1SEL2 ;CLEAR P1.6 SPECIAL FUNC2
MOV.W #OUTMOD_7, &TACCTL1 ;SET C/C 1 OUTMOD TO RESET/SET
MOV.W #128, &TACCR1
BIS.W #CCIE, &TACCTL1 ;ENABLE C/C 1 CCIE IRQ
CONFADC:
BIC.W #ENC, &ADC10CTL0
MOV.W #0, &TACCR2
MOV.W #ADC10SR+ADC10ON+MSC, &ADC10CTL0
MOV.W #SHS_1+ADC10DIV_7+ADC10SSEL_3+CONSEQ_2, &ADC10CTL1
BIS.B #BIT0, &ADC10AE0
BIS.W #ADC10IE, &ADC10CTL0
BIS.W #ENC, &ADC10CTL0
CONFBUTTON:
BIC.B #BIT3, &P1DIR ;SET P1.3 TO INPUT
BIS.B #BIT3, &P1REN ;ENABLE PULLUP/PULLDOWN RESISTOR
BIS.B #BIT3, &P1OUT ;SELECT PULLUP RESISTOR
BIS.B #BIT3, &P1IES ;SET FALLING EDGE INTERRUPT
BIS.B #BIT3, &P1IE ;ENABLE INTERRUPT IN P1.3
BIC.B #BIT3, &P1IFG ;CLEAR INTERRUPT FLAG (CAUSED BY CHANGING SETTINGS)
MAIN:
MOV.B #0xFF, &P2DIR ;DISABLE P2 FOR LOWER ENERGY CONSUMPTION AND NOISE
MOV.B #0, &P2OUT
MOV.W #PRECALCTDIVS, &TDIVSLOWEST ;COPY PRECALCULATED TABLESIZE/SAMPLERATE (1024/62500) CONSTANT TO RAM
MOV.W #1, &FREQUENCYLOW ;SET FREQUENCY (IN THIS CASE 1)
JMP CLCTNW
SETSR:
BIS.W #GIE, R2 ;ENABLE GLOBAL INTERRUPTS
BIS.W #CPUOFF, R2 ;ENABLE LPM0
LOOP:
JMP LOOP
; calculate frequency * (table size / sample rate) and store result in tuning word registers
CLCTNW:
MOV.W #32, REGCOUNTER ;WE MULTIPLY 32x32-BIT VALUES
CLCTNWLOOP:
RRC.W &FREQUENCYHIGHEST
RRC.W &FREQUENCYHIGH ;SHIFT FREQUENCY TO RIGHT
RRC.W &FREQUENCYLOW
RRC.W &FREQUENCYLOWEST
JNC CLCTNWTEST ;IF CARRY 0 GOTO CLCTNWTEST
ADD &TDIVSLOWEST, &MULREGLOWEST ;IF CARRY 1 ADD TDIVS TO PRODUCT
ADDC &TDIVSLOW, &MULREGLOW
ADDC &TDIVSHIGH, &MULREGHIGH
ADDC &TDIVSHIGHEST, &MULREGHIGHEST
CLCTNWTEST:
RLA.W &TDIVSLOWEST ;SHIFT TDIVS TO LEFT
RLC.W &TDIVSLOW
RLC.W &TDIVSHIGH
RLC.W &TDIVSHIGHEST
DEC.W REGCOUNTER ;DECREASE COUNTER
JNZ CLCTNWLOOP ;IF COUNTER NOT 0 GOTO CLCTNWLOOP
CLCTNWSTORE:
MOV.W &MULREGLOW, REGTUNINGLOW ;IF COUNTER IS 0 COPY PRODUCT TO TUNING WORD
MOV.W &MULREGHIGH, REGTUNINGHIGH
JMP SETSR ;GOTO SET STATUS REGISTER
DDSINTERRUPT:
BIC.W #CCIFG, &TACCTL0 ;CLEAR C/C 0 CCIFG IRQ FLAG
BIT.W #OSC1MUTE, OSCSTATUS
JZ DDSRETURN
ADD.W REGTUNINGLOW, REGPHASELOW ;ADD TUNING WORD TO PHASEACCUMULATOR
ADDC.W REGTUNINGHIGH, REGPHASEHIGH
CMP.W #0x0400, REGPHASEHIGH
JL DDSRETURN
MOV.W #0, REGPHASEHIGH ;BECAUSE OUR TABLE SIZE IS 1024 IN SIZE
DDSRETURN:
RETI ;RETURN FROM INTERRUPT
PWMINTERRUPT:
BIC.W #CCIFG, &TACCTL1
BIT.W #OSC1MUTE, OSCSTATUS
JZ PWMRETURN
MOV.B SINTABLE(REGPHASEHIGH), &TACCR1
PWMRETURN:
RETI
BUTTONINTERRUPT:
BIC.B #BIT3, &P1IFG
XOR.W #OSC1MUTE, OSCSTATUS
MOV.W #0, &TACCR1
RETI
ADCINTERRUPT:
BIC.W #ADC10IFG, &ADC10CTL0
MOV.W &ADC10MEM, REGPITCH
RRA.W REGPITCH
BIC.W #BIT0, REGPITCH
BIC.W #BIT1, REGPITCH
MOV.W PITCHTABLE(REGPITCH), REGTUNINGHIGH
MOV.W PITCHTABLE+2(REGPITCH), REGTUNINGLOW
RRA.W REGPITCH
RRA.W REGPITCH
RETI
; Frequency Table
PITCHTABLE:
DW 0, 17557 ;C-1
DW 0, 18601 ;C#-1
DW 0, 19707 ;D-1
DW 0, 20879 ;D#-1
DW 0, 22120 ;E-1
DW 0, 23436 ;F-1
DW 0, 24829 ;F#-1
DW 0, 26306 ;G-1
DW 0, 27870 ;G#-1
DW 0, 29527 ;A-1
DW 0, 31283 ;A#-1
DW 0, 33143 ;B-1
DW 0, 35114 ;C0
DW 0, 37202 ;C#0
DW 0, 39415 ;D0
DW 0, 41758 ;D#0
DW 0, 44241 ;E0
DW 0, 46872 ;F0
DW 0, 49659 ;F#0
DW 0, 52612 ;G0
DW 0, 55741 ;G#0
DW 0, 59055 ;A0
DW 0, 62567 ;A#0
DW 1, 751 ;B0
DW 1, 4693 ;C1
DW 1, 8869 ;C#1
DW 1, 13294 ;D1
DW 1, 17981 ;D#1
DW 1, 22947 ;E1
DW 1, 28209 ;F1
DW 1, 33783 ;F#1
DW 1, 39689 ;G1
DW 1, 45946 ;G#1
DW 1, 52575 ;A1
DW 1, 59598 ;A#1
DW 2, 1503 ;B1
DW 2, 9387 ;C2
DW 2, 17739 ;C#2
DW 2, 26588 ;D2
DW 2, 35963 ;D#2
DW 2, 45895 ;E2
DW 2, 56418 ;F2
DW 3, 2031 ;F#2
DW 3, 13842 ;G2
DW 3, 26357 ;G#2
DW 3, 39615 ;A2
DW 3, 53661 ;A#2
DW 4, 3007 ;B2
DW 4, 18774 ;C3
DW 4, 35478 ;C#3
DW 4, 53176 ;D3
DW 5, 6390 ;D#3
DW 5, 26254 ;E3
DW 5, 47300 ;F3
DW 6, 4062 ;F#3
DW 6, 27685 ;G3
DW 6, 52714 ;G#3
DW 7, 13694 ;A3
DW 7, 41787 ;A#3
DW 8, 6015 ;B3
DW 8, 37548 ;C4
DW 9, 5421 ;C#4
DW 9, 40816 ;D4
DW 10, 12780 ;D#4
DW 10, 52509 ;E4
DW 11, 29065 ;F4
DW 12, 8124 ;F#4
DW 12, 55371 ;G4
DW 13, 39892 ;G#4
DW 14, 27388 ;A4
DW 15, 18039 ;A#4
DW 16, 12030 ;B4
DW 17, 9561 ;C5
DW 18, 10842 ;C#5
DW 19, 16096 ;D5
DW 20, 25560 ;D#5
DW 21, 39483 ;E5
DW 22, 58131 ;F5
DW 24, 16249 ;F#5
DW 25, 45207 ;G5
DW 27, 14248 ;G#5
DW 28, 54777 ;A5
DW 30, 36078 ;A#5
DW 32, 24060 ;B5
DW 34, 19122 ;C6
DW 36, 21684 ;C#6
DW 38, 32193 ;D6
DW 40, 51120 ;D#6
DW 43, 13431 ;E6
DW 45, 50727 ;F6
DW 48, 32499 ;F#6
DW 51, 24879 ;G6
DW 54, 28496 ;G#6
DW 57, 44019 ;A6
DW 61, 6620 ;A#6
DW 64, 48121 ;B6
DW 68, 38244 ;C7
DW 72, 43369 ;C#7
DW 76, 64386 ;D7
DW 81, 36704 ;D#7
DW 86, 26862 ;E7
DW 91, 35919 ;F7
DW 96, 64999 ;F#7
DW 102, 49758 ;G7
DW 108, 56992 ;G#7
DW 115, 22502 ;A7
DW 122, 13240 ;A#7
DW 129, 30706 ;B7
DW 137, 10953 ;C8
DW 145, 21202 ;C#8
DW 153, 63236 ;D8
DW 163, 7873 ;D#8
DW 172, 53724 ;E8
DW 183, 6302 ;F8
DW 193, 64463 ;F#8
DW 205, 33980 ;G8
DW 217, 48448 ;G#8
DW 230, 45004 ;A8
DW 244, 26480 ;A#8
DW 258, 61413 ;B8
DW 274, 21907 ;C9
DW 290, 42405 ;C#9
DW 307, 60937 ;D9
DW 326, 15747 ;D#9
DW 345, 41913 ;E9
DW 366, 12605 ;F9
DW 387, 63391 ;F#9
DW 411, 2425 ;G9
; Sine Wave Table
SINTABLE:
DB 128,128,129,130,131,131,132,133,134,135,135,136,137,138,138,139
DB 140,141,142,142,143,144,145,145,146,147,148,149,149,150,151,152
DB 152,153,154,155,155,156,157,158,158,159,160,161,162,162,163,164
DB 165,165,166,167,167,168,169,170,170,171,172,173,173,174,175,176
DB 176,177,178,178,179,180,181,181,182,183,183,184,185,186,186,187
DB 188,188,189,190,190,191,192,192,193,194,194,195,196,196,197,198
DB 198,199,200,200,201,202,202,203,203,204,205,205,206,207,207,208
DB 208,209,210,210,211,211,212,213,213,214,214,215,215,216,217,217
DB 218,218,219,219,220,220,221,221,222,222,223,224,224,225,225,226
DB 226,227,227,228,228,228,229,229,230,230,231,231,232,232,233,233
DB 234,234,234,235,235,236,236,236,237,237,238,238,238,239,239,240
DB 240,240,241,241,241,242,242,242,243,243,243,244,244,244,245,245
DB 245,246,246,246,246,247,247,247,248,248,248,248,249,249,249,249
DB 250,250,250,250,250,251,251,251,251,251,252,252,252,252,252,252
DB 253,253,253,253,253,253,253,254,254,254,254,254,254,254,254,254
DB 254,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255
DB 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254
DB 254,254,254,254,254,254,254,254,254,254,253,253,253,253,253,253
DB 253,252,252,252,252,252,252,251,251,251,251,251,250,250,250,250
DB 250,249,249,249,249,248,248,248,248,247,247,247,246,246,246,246
DB 245,245,245,244,244,244,243,243,243,242,242,242,241,241,241,240
DB 240,240,239,239,238,238,238,237,237,236,236,236,235,235,234,234
DB 234,233,233,232,232,231,231,230,230,229,229,228,228,228,227,227
DB 226,226,225,225,224,224,223,222,222,221,221,220,220,219,219,218
DB 218,217,217,216,215,215,214,214,213,213,212,211,211,210,210,209
DB 208,208,207,207,206,205,205,204,203,203,202,202,201,200,200,199
DB 198,198,197,196,196,195,194,194,193,192,192,191,190,190,189,188
DB 188,187,186,186,185,184,183,183,182,181,181,180,179,178,178,177
DB 176,176,175,174,173,173,172,171,170,170,169,168,167,167,166,165
DB 165,164,163,162,162,161,160,159,158,158,157,156,155,155,154,153
DB 152,152,151,150,149,149,148,147,146,145,145,144,143,142,142,141
DB 140,139,138,138,137,136,135,135,134,133,132,131,131,130,129,128
DB 128,127,126,125,124,124,123,122,121,120,120,119,118,117,117,116
DB 115,114,113,113,112,111,110,110,109,108,107,106,106,105,104,103
DB 103,102,101,100,100,99,98,97,97,96,95,94,93,93,92,91
DB 90,90,89,88,88,87,86,85,85,84,83,82,82,81,80,79
DB 79,78,77,77,76,75,74,74,73,72,72,71,70,69,69,68
DB 67,67,66,65,65,64,63,63,62,61,61,60,59,59,58,57
DB 57,56,55,55,54,53,53,52,52,51,50,50,49,48,48,47
DB 47,46,45,45,44,44,43,42,42,41,41,40,40,39,38,38
DB 37,37,36,36,35,35,34,34,33,33,32,31,31,30,30,29
DB 29,28,28,27,27,27,26,26,25,25,24,24,23,23,22,22
DB 21,21,21,20,20,19,19,19,18,18,17,17,17,16,16,15
DB 15,15,14,14,14,13,13,13,12,12,12,11,11,11,10,10
DB 10,9,9,9,9,8,8,8,7,7,7,7,6,6,6,6
DB 5,5,5,5,5,4,4,4,4,4,3,3,3,3,3,3
DB 2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1
DB 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
DB 1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2
DB 2,3,3,3,3,3,3,4,4,4,4,4,5,5,5,5
DB 5,6,6,6,6,7,7,7,7,8,8,8,9,9,9,9
DB 10,10,10,11,11,11,12,12,12,13,13,13,14,14,14,15
DB 15,15,16,16,17,17,17,18,18,19,19,19,20,20,21,21
DB 21,22,22,23,23,24,24,25,25,26,26,27,27,27,28,28
DB 29,29,30,30,31,31,32,33,33,34,34,35,35,36,36,37
DB 37,38,38,39,40,40,41,41,42,42,43,44,44,45,45,46
DB 47,47,48,48,49,50,50,51,52,52,53,53,54,55,55,56
DB 57,57,58,59,59,60,61,61,62,63,63,64,65,65,66,67
DB 67,68,69,69,70,71,72,72,73,74,74,75,76,77,77,78
DB 79,79,80,81,82,82,83,84,85,85,86,87,88,88,89,90
DB 90,91,92,93,93,94,95,96,97,97,98,99,100,100,101,102
DB 103,103,104,105,106,106,107,108,109,110,110,111,112,113,113,114
DB 115,116,117,117,118,119,120,120,121,122,123,124,124,125,126,127
; Triangle Wave Table
TRIANGLETABLE:
DB 0x0,0x1,0x1,0x2,0x2,0x3,0x3,0x4,0x4,0x5,0x5,0x6,0x6,0x7,0x7,0x8
DB 0x8,0x9,0x9,0xa,0xa,0xb,0xb,0xc,0xc,0xd,0xd,0xe,0xe,0xf,0xf,0x10
DB 0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,0x16,0x17,0x17,0x18
DB 0x18,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x20
DB 0x20,0x21,0x21,0x22,0x22,0x23,0x23,0x24,0x24,0x25,0x25,0x26,0x26,0x27,0x27,0x28
DB 0x28,0x29,0x29,0x2a,0x2a,0x2b,0x2b,0x2c,0x2c,0x2d,0x2d,0x2e,0x2e,0x2f,0x2f,0x30
DB 0x30,0x31,0x31,0x32,0x32,0x33,0x33,0x34,0x34,0x35,0x35,0x36,0x36,0x37,0x37,0x38
DB 0x38,0x39,0x39,0x3a,0x3a,0x3b,0x3b,0x3c,0x3c,0x3d,0x3d,0x3e,0x3e,0x3f,0x3f,0x40
DB 0x40,0x41,0x41,0x42,0x42,0x43,0x43,0x44,0x44,0x45,0x45,0x46,0x46,0x47,0x47,0x48
DB 0x48,0x49,0x49,0x4a,0x4a,0x4b,0x4b,0x4c,0x4c,0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x50
DB 0x50,0x51,0x51,0x52,0x52,0x53,0x53,0x54,0x54,0x55,0x55,0x56,0x56,0x57,0x57,0x58
DB 0x58,0x59,0x59,0x5a,0x5a,0x5b,0x5b,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5f,0x5f,0x60
DB 0x60,0x61,0x61,0x62,0x62,0x63,0x63,0x64,0x64,0x65,0x65,0x66,0x66,0x67,0x67,0x68
DB 0x68,0x69,0x69,0x6a,0x6a,0x6b,0x6b,0x6c,0x6c,0x6d,0x6d,0x6e,0x6e,0x6f,0x6f,0x70
DB 0x70,0x71,0x71,0x72,0x72,0x73,0x73,0x74,0x74,0x75,0x75,0x76,0x76,0x77,0x77,0x78
DB 0x78,0x79,0x79,0x7a,0x7a,0x7b,0x7b,0x7c,0x7c,0x7d,0x7d,0x7e,0x7e,0x7f,0x7f,0x80
DB 0x80,0x80,0x81,0x81,0x82,0x82,0x83,0x83,0x84,0x84,0x85,0x85,0x86,0x86,0x87,0x87
DB 0x88,0x88,0x89,0x89,0x8a,0x8a,0x8b,0x8b,0x8c,0x8c,0x8d,0x8d,0x8e,0x8e,0x8f,0x8f
DB 0x90,0x90,0x91,0x91,0x92,0x92,0x93,0x93,0x94,0x94,0x95,0x95,0x96,0x96,0x97,0x97
DB 0x98,0x98,0x99,0x99,0x9a,0x9a,0x9b,0x9b,0x9c,0x9c,0x9d,0x9d,0x9e,0x9e,0x9f,0x9f
DB 0xa0,0xa0,0xa1,0xa1,0xa2,0xa2,0xa3,0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0x8e,0x8e,0x8d,0x8d,0x8c,0x8c,0x8b,0x8b,0x8a,0x8a,0x89,0x89,0x88,0x88,0x87
DB 0x87,0x86,0x86,0x85,0x85,0x84,0x84,0x83,0x83,0x82,0x82,0x81,0x81,0x80,0x80,0x80
DB 0x7f,0x7f,0x7e,0x7e,0x7d,0x7d,0x7c,0x7c,0x7b,0x7b,0x7a,0x7a,0x79,0x79,0x78,0x78
DB 0x77,0x77,0x76,0x76,0x75,0x75,0x74,0x74,0x73,0x73,0x72,0x72,0x71,0x71,0x70,0x70
DB 0x6f,0x6f,0x6e,0x6e,0x6d,0x6d,0x6c,0x6c,0x6b,0x6b,0x6a,0x6a,0x69,0x69,0x68,0x68
DB 0x67,0x67,0x66,0x66,0x65,0x65,0x64,0x64,0x63,0x63,0x62,0x62,0x61,0x61,0x60,0x60
DB 0x5f,0x5f,0x5e,0x5e,0x5d,0x5d,0x5c,0x5c,0x5b,0x5b,0x5a,0x5a,0x59,0x59,0x58,0x58
DB 0x57,0x57,0x56,0x56,0x55,0x55,0x54,0x54,0x53,0x53,0x52,0x52,0x51,0x51,0x50,0x50
DB 0x4f,0x4f,0x4e,0x4e,0x4d,0x4d,0x4c,0x4c,0x4b,0x4b,0x4a,0x4a,0x49,0x49,0x48,0x48
DB 0x47,0x47,0x46,0x46,0x45,0x45,0x44,0x44,0x43,0x43,0x42,0x42,0x41,0x41,0x40,0x40
DB 0x3f,0x3f,0x3e,0x3e,0x3d,0x3d,0x3c,0x3c,0x3b,0x3b,0x3a,0x3a,0x39,0x39,0x38,0x38
DB 0x37,0x37,0x36,0x36,0x35,0x35,0x34,0x34,0x33,0x33,0x32,0x32,0x31,0x31,0x30,0x30
DB 0x2f,0x2f,0x2e,0x2e,0x2d,0x2d,0x2c,0x2c,0x2b,0x2b,0x2a,0x2a,0x29,0x29,0x28,0x28
DB 0x27,0x27,0x26,0x26,0x25,0x25,0x24,0x24,0x23,0x23,0x22,0x22,0x21,0x21,0x20,0x20
DB 0x1f,0x1f,0x1e,0x1e,0x1d,0x1d,0x1c,0x1c,0x1b,0x1b,0x1a,0x1a,0x19,0x19,0x18,0x18
DB 0x17,0x17,0x16,0x16,0x15,0x15,0x14,0x14,0x13,0x13,0x12,0x12,0x11,0x11,0x10,0x10
DB 0xf,0xf,0xe,0xe,0xd,0xd,0xc,0xc,0xb,0xb,0xa,0xa,0x9,0x9,0x8,0x8
DB 0x7,0x7,0x6,0x6,0x5,0x5,0x4,0x4,0x3,0x3,0x2,0x2,0x1,0x1,0x0,0x0
.org RAM
FREQUENCYLOWEST:
.org RAM+2
FREQUENCYLOW:
.org RAM+4
FREQUENCYHIGH:
.org RAM+6
FREQUENCYHIGHEST:
.org RAM+8
TDIVSLOWEST:
.org RAM+10
TDIVSLOW:
.org RAM+12
TDIVSHIGH:
.org RAM+14
TDIVSHIGHEST:
.org RAM+16
MULREGLOWEST:
.org RAM+18
MULREGLOW:
.org RAM+20
MULREGHIGH:
.org RAM+22
MULREGHIGHEST:
; Interrupt Vectors
.org 0xFFE4 ;P1 INTERRUPT
DW BUTTONINTERRUPT
.org 0xFFEA ;ADC10 INTERRUPT
DW ADCINTERRUPT
.org 0xFFF0 ;TACCIE1 INTERRUPT
DW PWMINTERRUPT
.org 0xFFF2 ;TACCIE0 INTERRUPT
DW DDSINTERRUPT
.org 0xFFFE ;RESET INTERRUPT
DW RESET
.end