⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 signallbmain.asm

📁 用于DSK5416的程序
💻 ASM
字号:
************************************************************************
*
* signalLBmain.asm
*
* This program reads an input signal from the ADC and writes it to
* the DAC on the DSK5416 board. This main module includes the
* entry-point for the program.
* 
* Author:       Avtar Singh, SJSU
*
************************************************************************ 

                .include    "regs.asm"
                .ref        initC5416
                .ref        initMcBSP2
                .ref        initPCM3002
                .def        _c_int00
                .def        brint2_isr
                .ref        sample_receive
                .ref        sample_transmit
                   
VAL_SP          .set        0x0500                  ; initial stack address               


                .data

sample_upper_word   .word   0                       ; received sample
sample_lower_word   .word   0


                .text

* The entry-point for the program

_c_int00:
                stm         #VAL_SP, SP             ; Define the stack                    
                ssbx        INTM                    ; Disable all interrupts
                    
                call        initC5416               ; Init the DSP processor
                call        initMcBSP2              ; Init the McBSP2 port
                call        initPCM3002             ; Init the DSK CODEC

                stm         #SPCR1, MCBSP2_SPSA     ; Enable McBSP2 receiver
                orm         #0001h, MCBSP2_SPSD

                stm         #SPCR2, MCBSP2_SPSA     ; Enable McBSP2 transmitter
                orm         #0001h, MCBSP2_SPSD

                stm         #0FFFFh, IFR            ; Clear pending interrupts
                orm         #040h, IMR              ; Unmask McBSP2 RX int
                    
                rsbx        INTM                    ; Enable all interrupts

wait_main:      idle        1                       ; Wait for an RX interrupt
                b           wait_main
                nop
                nop
                nop


                    
* Interrupt service routine for McBSP2 Receiver

brint2_isr:
                call        sample_receive          ; Receive the sample
                nop                                 ; Process the sample
                call        sample_transmit         ; Transmit the sample
                rete


* This procedure receives a 20-bit value from the ADC
* Return with A (LSBs) = 20 bit received sample

sample_receive:
                pshm        AR5

                ldm         MCBSP2_DRR2, B          ; Retrieve upper 16 bits
                stm         #sample_upper_word, AR5
                stl         B, *AR5+                ; Save upper bits locally

                ldm         MCBSP2_DRR1, A          ; Retrieve lower 16 bits
                and         #0FFFFh, A
                stl         A, *AR5                 ; Save lower bits locally

                sftl        B, 15
                or          B, 1, A                 ; Construct the sample in A
                    
                popm        AR5
                    
                ret
                    

* This procedure sends a 20-bit value in A (LSBs) to the DAC.

sample_transmit:
                stlm        A, MCBSP2_DXR1         ; Transmit lower 16 bits
                sfta        A, -16
                stlm        A, MCBSP2_DXR2         ; Transmit upper bits
                    
                ret
                    
               .end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -