* * BFSK WAVEFORM GENERATOR * ;The bit string must end with a '-1'. ; ; NUMBR .word 1,0,0,1,0,1,1,1,0,-1 ; \_______________/ \/ ; Bits to be transmitted Stop word .ds 2000h ; Note: 1. Master clock = 10.000 MHz ; 2. The transmit and receive sections are in synchronous mode. ; Tone generation is synced on the receive interrupt. ; TIME .word 0d60h ; pulse duration TIMER .word 00000h LO_F .word 31160 ; 400 Hz cos(x) (Coefficient) .word 10126 ; sin(x) HI_F .word -19249 ; 2800 Hz .word 26506 BUFF .word 0 .word 0 .word 0 ;-------------------------------; .ds 1000h BITS .word 0,1,0,0,1,1,0,0,0,1,1,1,-1 .include "template.asm" * * Main Loop * LAR AR0,#BITS ; Phone number pointer LAR AR1,#BUFF ; use LAR AR4,#0badh ;DEBUG SPLK #02h,INDX NEXTBIT: LDP #0 SPLK #02h,IMR ; disable receive interrupt LAR AR2,#LO_F ; init freq. pointer CALL MOD ; choose freq. for each bit CALL PAUSESH ; pause between bits LACC #012h ; SAMM IMR ; set rcv interrupt CLRC INTM ; enable interrupts WAIT: LACL TIMER ; check timer BCND NEXTBIT,EQ ; If timer is zero get another digit B WAIT END: CLRC INTM ; enable interrupts B END ; done. ; ---- end of main program ---- ; * * Modulation * MOD: MAR *,AR0 LDP #TIMER SPLK #0,TIMER ; reset timer value = 0 LACC *+,0,AR2 ; get digit ; BCND END,LT ; Negative then end BCND REPETE,LT ; Negative then repete BCND MODBR,EQ ; Use Lo Freq. if Bit=0 MAR *0+ ; Use Hi Freq. if Bit=1 MODBR: LACL TIME ; Load time value SACL TIMER ; Reset timer for pulse duration LACC *+,0,AR1 ; Copy COSX to BUFF(0) SACL *+,0,AR2 LACC *,0,AR1 ; Copy SINX to BUFF(1) SACL *+ ZAP ; Zero BUFF(2) SACL *0- ; AR1 -> BUFF(0) RET REPETE: LAR AR0,#BITS B PAUSELG * * Pause generator * PAUSESH: LACC #06h,15 ; .1 apprx. second pause (50ns cycle) B LOOP PAUSELG: LACC #0cah,15 ; load ACC with value to decrement ADD #0b9ah,4 ; 1 second pause (50ns cycle) LOOP: SUB #01h ; 1 cycle BCND LOOP,GT ; +2 cycles = 3 cycles total RET ; ;-------------------------------------------------------------------- * * RECIEVER ISR * RECEIVE: CLRC INTM ; enable interrupts LDP #TIMER MAR *,AR1 ; AR1 is current AR register ZAP ; ACC => 0 LAMM AR1 ; Load address in AR1 (COSx) CALL GENWF RPT #16 SFR AND #0FFFCh,0 ; bit 0 & 1 have to be 0 for AIC SAMM DXR ; send it to AIC thru serial port LACL TIMER ; Load timer value SUB #01h ; Decrement timer SACL TIMER ; Save the timer. LAMM DRR ; get junk to enable next interrupt RETE * * Tone Generator * GENWF: MAR *0+ ; Increment pointer. Points to Y(n-1)) SAMM BMAR ; save address of COSX to BMAR MPY #0 ; clear P register (TREG0 x 0 -> P) LACC *-,15 ; load ACChi with Y(n-1) NEG ; -ACC ==> ACC MADD * ; coeff*sinx=P and ACC= -y(n-1) APAC ; coeff*sinx - y(n-1) APAC ; 2(coeff*sinx)- y1 SACH *-,1 ; shift one & store ACC_hi ->new sinx value RET ; -- end of Receive ISR -- * * Transmit ISR * transmit interrupt is disabled * TRANSMIT: RETE ; -- end of Transmit ISR -- .end