;//_ parallel dac dds ;//_ stk500/atmega168p ;//_ 2007.11.6.01 ;//_ by rmrubin@darkertechnologies.com ;//_ part file .include "m164pdef.inc" ;//_ program constants .equ sample_rate =39 ;500KHz @ 20MHz cpu clk = 39 .equ test_note =28 .equ dac_port =portb .equ dac_ddr =ddrb ;//_ register definitions .def lpmin =r0 ;flash read data register .def phase0 =r1 ;32b phase accumulator .def phase1 =r2 .def phase2 =r3 .def phase3 =r4 .def time0 =r5 ;32b phase incriment .def time1 =r6 .def time2 =r7 .def time3 =r8 .def note =r20 ;midi note .def point0 =r18 ;flash pointer buffer .def point1 =r19 .def temp =r16 ;working registers .def temp2 =r17 ;//_ interrupt vectors .org $0 jmp reset ;poweron/reset jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp sample_out ;ocr1a jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int jmp stray_int stray_int: reti ;//_ program init reset: ldi temp,high(ramend) ;stack setup ldi temp2,low(ramend) out sph,temp out spl,temp2 clr temp ;sample timer setup sts tccr1a,temp ldi temp,0b00001001 sts tccr1b,temp ldi temp,high(sample_rate) sts ocr1ah,temp ldi temp,low(sample_rate) sts ocr1al,temp ldi temp,(1<