📄 sub_play_tone_seq.s
字号:
;START_HEADER
;
; dsPIC30F6014 Demo Source File
; (c) Copyright 2005 Microchip Technology, All rights reserved
;
; --------------------------------------------------------------------------
; File Revision History:
; --------------------------------------------------------------------------
;
; $Log: sub_play_tone_seq.s,v $
; Revision 1.3 2005/04/04 23:38:42 VasukiH
; Updated comments in header
;
; Revision 1.2 2005/04/04 23:14:20 VasukiH
; Updates for MPLAB C30 v1.30 compatiblity
;
; Revision 1.1.1.1 2003/08/23 00:38:33 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:
;
;
;END_HEADER
.include "p30fxxxx.inc"
.include "common.inc"
.global PlayRecSequence, DtmfSeqPtr, DtmfPauseFlag
.section .ndata, data, near
.align WORD
PlayRecSequence: .hword 0x0000 ;Flag indicating the a request for
;Playing a predefined sequence of tones
;has occurred
DtmfSeqPtr: .hword DtmfSeq ;Pointer to the current tone in the
;predefined sequence of tones
DtmfPauseFlag: .hword 0x0000 ;Typically a DTMF tone has an ON time
;and an OFF time. The ON time is when the
;tone is being played (100ms) and the
;OFF time follows the ON time when silence
;is fed out (15ms). When a sequence of
;tones is being played, an additional
;Pause is required between two consecutive
;tones. The DtmfPauseFlag indicates that a
;Pause time needs to be suffixed to the
;OFF time.
.global _sub_play_tone_seq
.section .text
_sub_play_tone_seq:
push.d w0
btsc DCIUnavailable, #1 ;If the DCI is unavailable/busy
bra exitPlayRtn ;exit this routine without playing
;tone sequence
setm DCIUnavailable ;Else, set the DCI to a busy status
cp0 DTMFSamplesCount ;Second check on the DTMFSamplesCount
bra nz, FaultExitPlayRtn ;If SampleCount is non-zero, exit routine
cp0 DTMFSilenceCount ;Third check on DTMFSilenceCount
bra nz, FaultExitPlayRtn ;If DTMFSilenceCount is non-zero, exit routine
mov #DtmfSeq, w0 ;Deduct starting address of DTMF sequence-
;ASCII string from current contents
sub DtmfSeqPtr, WREG ;of DTMF sequence pointer
cp w0, #0xa ;If not equal to 10, then we need to send
;the next tone
bra nz, SendNextTone
clr PlayRecSequence ;Clear the PlayRecSequence flag, since the
;sequence has been played
clr DtmfPauseFlag ;Clear the DtmfPauseFlag, since the
;sequence has been played
bra exitPlayRtn ;Exit the routine
SendNextTone:
setm DtmfPauseFlag ;Set the Pause Flag so that the OFF time
;following the ON time will be increased
;by a "Pause" time.
mov DtmfSeqPtr, w1 ;Load the address of the next ASCII char
;in the number sequence into w1
mov.b [w1], w0 ;Fetch the number from the sequence
inc DtmfSeqPtr ;Increment the pointer
rcall _sub_dci_kickoff ;Call the _sub_dci_kickoff routine that will
;convert the ASCII number into binary and
;fetch the sine samples to send out of the DCI
exitPlayRtn:
pop.d w0
return
FaultExitPlayRtn:
setm DCIUnavailable ;Set the DCI to a busy state
pop.d w0
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -