Path: utzoo!attcan!uunet!ginosko!sol.ctr.columbia.edu!cica!tut.cis.ohio-state.edu!husc6!rutgers!orstcs!boone@oce.orst.edu From: boone@oce.orst.edu (Jeff Boone) Newsgroups: comp.sys.next Subject: YADSPQ (Yet Another DSP Question) Message-ID: <11494@orstcs.CS.ORST.EDU> Date: 5 Jul 89 07:40:32 GMT Sender: usenet@orstcs.CS.ORST.EDU Reply-To: boone@oce.orst.edu (Jeff Boone) Organization: College of Oceanography, Oregon State Univ., Corvallis, Or. Lines: 73 I have been struggling with the DSP for the past week or so, and thought I should tap into the net knowledge before I pull out the rest of my hair. Below is the assembly code that return the 256 sine entries in the internal Y memory ROM. I used the initialization posted by Eric Thayer to configure the DSP (although I don't use external memory, I still need to enable the ROM data). The rest of the code just marches through the sine table and sends the entries to the host. What actually comes out is the first 128 entries in the table, some garbage, and then part of the table started over from the first. And to top it all off, it takes about 4 or 5 seconds to send this to the host. JEEZ I might as well use my calculator! What gives? Would some kind soul please shine the light on me. :-) ------------------------------ DSP Assembly code ----------------------- reset equ $0000 ; Address of reset vector start equ $40 ; Start of program mem data equ $100 ; Start of ROM sine table in Y mem org p:reset jmp >init dup $40-2 nop endm org p:start init movec #6,omr ; Data rom enabled, mode 2 bset #0,x:m_pbc ; Host port movep #>$0001F7,x:m_pcc ; Both serial ports (SC0 not available) bset #3,x:m_pcddr ; pc3 is an output with value bclr #3,x:m_pcd ; zero to enable the external ram movep #>$004000,x:m_cra ; Set up for external clock on DSP port movep #>$002300,x:m_crb ; Read L/~R on IF1 movep #>$000000,x:m_bcr ; No wait states on the external sram movep #>$00B400,x:m_ipr ; Intr levels: SSI=2, SCI=1, HOST=0 move #data,R2 ; Point R2 to the ROM sine table nop ; Allow R2 time to update move y:(R2)+,A0 ; Load first sine table value do #256,end_out ; Send 256 sine values to host xmt_dat jclr #1,x:$FFE9,xmt_dat ; Wait for host move A0,x:$FFEB ; Send sample to host move y:(R2)+,A0 ; Update A0 with next sine value end_out end $40 ------------------ Program to read the sine table ---------------- #include #include main() { int count; int output[256]; DSPBootFile("sine.dsp"); // Load the dsp image file DSPGetRXArray(output,256); // Get the 256 sine values from DSP for (count=0; count<256; count++) // Print the values printf("0x%X\n",output[count]); }