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

📄 isr_dci.s

📁 该文件包含30F的电机控制程序
💻 S
字号:
;START_HEADER
;
; dsPIC30F6014 Demo Source File
; (c) Copyright 2005 Microchip Technology, All rights reserved
;
; --------------------------------------------------------------------------
; File Revision History:
; --------------------------------------------------------------------------
;
; $Log: isr_dci.s,v $
; Revision 1.3  2005/04/04 23:44:04  VasukiH
; Updates to comments in file header
;
; Revision 1.2  2005/04/04 23:15:35  VasukiH
; Updates for MPLAB C30 v1.30 compatiblity
;
; Revision 1.1.1.1  2003/08/23 00:38:32  VasukiH
; First import of demo source into CVS Repository
;
;
;
; --------------------------------------------------------------------------
;
; Software and Development Tools Info:
; --------------------------------------------------------------------------
; Tool                          Version
; --------------------------------------------------------------------------
; MPLAB IDE                     7.0
; MPLAB C30 Toolsuite           1.30
; dsPICDEM(TM) Processor Board  1.10
; --------------------------------------------------------------------------
;
; File Notes:
;
; 1. The DCI interrupt service routine transfers 4 new tone samples to TXBUF0-4.
;    It also keeps a count of the number of samples transferred thus far.
;
; 2.  A tone sample is 100 milliseconds long and is followed by
;     15 milliseconds of silence.
;
; 3.  A tone sample is obtained by adding amplitudes of the sinusoid components.
;
;END_HEADER


.include "p30fxxxx.inc"


.global __DCIInterrupt
.section .text
__DCIInterrupt:
        bclr    IFS2, #DCIIF                    ;Clear the interrupt flag
        push.d  w0                              ;Save w0-w3 off to stack
        push.d  w2
        mov     RXBUF0, w0                      ;Dummy read of RXBUF0-RXBUF3
        mov     RXBUF1, w0
        mov     RXBUF2, w0
        mov     RXBUF3, w0
        cp0     DTMFSamplesCount                ;Is the number of DTMF samples
        bra     z, send_silence                 ;left to transmit = 0?
                                                ;If so, then send digital silence
sendsamples:                                    ;If not then send next DTMF sample
        push    PSVPAG                          ;DTMF samples are constructed
        push    CORCON                          ;from sine samples stored in
        bset    CORCON, #PSV                    ;Program Memory, so use PSV to
        mov     #psvpage(sin697), w0            ;access the sine-tables.
        mov     w0, PSVPAG                      ;Set up PSVPAG register
        mov     LowTonePtr, w1                  ;Retrieve pointer to lower tone
                                                ;component into w1
        mov     HighTonePtr, w2                 ;Retrieve pointer to higher tone
                                                ;component into w2
        mov     [w1++], w0                      ;Read low-tone sample
        mov     [w2++], w3                      ;Read high-tone sample
        add     w0, w3, w0                      ;Add the two samples into w0
        bclr    w0, #0                          ;Clear the LS bit of the resultant
                                                ;This ensures that the dsPIC does
                                                ;not accidentally request a secondary
                                                ;frame transmission from the codec.
                                                ;Note that the Si3000 codec only provides
                                                ;an 84 dB dynamic range
        mov     w0, TXBUF0                      ;Write the result to TXBUF0
        mov     [w1++], w0                      ;Perform the same steps as above to load
        mov     [w2++], w3                      ;TXBUF1, TXBUF2 and TXBUF3
        add     w0, w3, w0
        bclr    w0, #0
        mov     w0, TXBUF1
        mov     [w1++], w0
        mov     [w2++], w3
        add     w0, w3, w0
        bclr    w0, #0
        mov     w0, TXBUF2
        mov     [w1++], w0
        mov     [w2++], w3
        add     w0, w3, w0
        bclr    w0, #0
        mov     w0, TXBUF3

        dec2    DTMFSamplesCount                ;Decrement the number of DTMF samples left
        dec2    DTMFSamplesCount                ;to transmit by 4

        mov     w1, LowTonePtr                  ;Update the Low and High tone pointers
        mov     w2, HighTonePtr
        pop     CORCON                          ;Restore CORCON
        pop     PSVPAG                          ;Restore PSVPAG
exit_DCI_ISR:
        pop.d   w2                              ;Restore w0, w1, w2 and w3
        pop.d   w0
        retfie                                  ;Return from Interrupt

                                                ;If no DTMF samples left to transmit
                                                ;then transmit silence to fill the
                                                ;"OFF" time as specified in the ITU-T
                                                ;specification for DTMF tones
send_silence:
        cp0     DTMFSilenceCount                ;Check if the required number of
        bra     z, spcl_exit_DCI_ISR            ;"digital silence" samples have been
                                                ;transmitted. If so, then exit.
        clr     w0                              ;If not, load TXBUF0-TXBUF3 with 0x0000
        mov     w0, TXBUF0
        mov     w0, TXBUF1
        mov     w0, TXBUF2
        mov     w0, TXBUF3
        dec2    DTMFSilenceCount                ;Decrement the associated count.
        dec2    DTMFSilenceCount
        bra     exit_DCI_ISR


spcl_exit_DCI_ISR:
        clr     DCIUnavailable                  ;If silence has also been transmitted
        pop.d   w2                              ;then clear the DCIUnavailable flag.
        pop.d   w0                              ;Restore w0-w3
        retfie                                  ;Return from Interrupt

.end                                            ;EOF






⌨️ 快捷键说明

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