C114门户论坛百科APPEN| 举报 切换到宽版

亚星游戏官网

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索
查看: 7102|回复: 2

[固网终端] 固网终端中的DTMF软拨号基础程序 [复制链接]

军衔等级:

亚星游戏官网-yaxin222  特邀版主

注册:2007-12-4
发表于 2007-12-28 16:47:00 |显示全部楼层
<p><br/><br/>;&nbsp;dtmf dial<br/>;&nbsp;fx=8M<br/>;=====================================================<br/>.include "sys.h"<br/>.include "def_macro.h"<br/>.include "sys_var.h"<br/>.include&nbsp;"InterruptServer.h"</p><p>.global&nbsp;DialOutController_DialOut<br/>.global&nbsp;DialOutController_Initial<br/>.global&nbsp;DialOutController_SetIndex<br/>.global&nbsp;DialOutController_Int_TimerA<br/>.global&nbsp;DialOutController_Int_DA</p><p>_sr_DA_OUT&nbsp;&nbsp;equ&nbsp;&nbsp;_doc_data<br/>_sr_DTMF_FLAG&nbsp;equ&nbsp;&nbsp;_doc_flag</p><p>bDIAL_INP&nbsp;&nbsp;equ&nbsp;&nbsp;0<br/>bFINISH&nbsp;&nbsp;&nbsp;equ&nbsp;&nbsp;1</p><p>cDIAL_TIME&nbsp;equ 50&nbsp;;25&nbsp;&nbsp;&nbsp;;0x600*(286/8000000)=54.912ms<br/>cDTSLI_TIME&nbsp;equ 100&nbsp;;50&nbsp;&nbsp;;(0xc00-0x600)*286/8000000=54.912ms</p><p>;DACNT_TBL is the da numbers in one sin wave of a frequency<br/>DACNT_TBL:&nbsp;DW&nbsp;86,78,71,64,50,45,41,37 </p><p>;DTRANS_TBL is used to calculate the two freq for one number<br/>DTRANS_TBL:&nbsp;DW&nbsp;0DH, 00H, 01H, 02H, 04H, 05H, 06H, 08H, 09H, 0AH, 0CH, 0EH, 0BH, 0FH, 03H, 07H; '*'-&gt;0AH, '#'-&gt;0BH<br/>; the DA out table<br/>;×××××××频率低采样个数多,频率高采样点少××××××××××<br/>F_697:<br/>&nbsp;DW&nbsp;0X1C0,0X1E0,0X201,0X221,0X241,0X260,0X27E,0X29B,0X2B7,0X2D1,0X2EA,0X302,0X318,0X32C,0X33E,0X34E,0X35C,0X368,0X371,0X378<br/>&nbsp;DW&nbsp;0X37D,0X37F,0X37F,0X37D,0X378,0X371,0X368,0X35C,0X34E,0X33E,0X32C,0X318,0X302,0X2EA,0X2D1,0X2B7,0X29B,0X27E,0X260,0X241<br/>&nbsp;DW&nbsp;0X221,0X201,0X1E0,0X1C0,0X19F,0X17E,0X15E,0X13E,0X11F,0X101,0XE4,0XC8,0XAE,0X95,0X7D,0X67,0X53,0X41,0X31,0X23<br/>&nbsp;DW&nbsp;0X17,0XE,0X7,0X2,0X0,0X0,0X2,0X7,0XE,0X17,0X23,0X31,0X41,0X53,0X67,0X7D,0X95,0XAE,0XC8,0XE4<br/>&nbsp;DW&nbsp;0X101,0X11F,0X13E,0X15E,0X17E,0X19F</p><p>F_770:<br/>&nbsp;DW&nbsp;0X1C0,0X1E4,0X207,0X22B,0X24D,0X26F,0X290,0X2AF,0X2CD,0X2E9,0X303,0X31B,0X330,0X343,0X354,0X362,0X36E,0X376,0X37C,0X37F<br/>&nbsp;DW&nbsp;0X37F,0X37C,0X376,0X36E,0X362,0X354,0X343,0X330,0X31B,0X303,0X2E9,0X2CD,0X2AF,0X290,0X26F,0X24D,0X22B,0X207,0X1E4,0X1C0<br/>&nbsp;DW&nbsp;0X19B,0X178,0X154,0X132,0X110,0XEF,0XD0,0XB2,0X96,0X7C,0X64,0X4F,0X3C,0X2B,0X1D,0X11,0X9,0X3,0X0,0X0<br/>&nbsp;DW&nbsp;0X3,0X9,0X11,0X1D,0X2B,0X3C,0X4F,0X64,0X7C,0X96,0XB2,0XD0,0XEF,0X110,0X132,0X154,0X178,0X19B</p><p>F_852:<br/>&nbsp;DW&nbsp;0X1C0,0X1E7,0X20E,0X235,0X25B,0X27F,0X2A2,0X2C4,0X2E3,0X300,0X31A,0X332,0X347,0X358,0X367,0X372,0X37A,0X37F,0X37F,0X37D<br/>&nbsp;DW&nbsp;0X377,0X36D,0X360,0X350,0X33D,0X326,0X30D,0X2F2,0X2D3,0X2B3,0X291,0X26D,0X248,0X222,0X1FB,0X1D3,0X1AC,0X184,0X15D,0X137<br/>&nbsp;DW&nbsp;0X112,0XEE,0XCC,0XAC,0X8D,0X72,0X59,0X42,0X2F,0X1F,0X12,0X8,0X2,0X0,0X0,0X5,0XD,0X18,0X27,0X38<br/>&nbsp;DW&nbsp;0X4D,0X65,0X7F,0X9C,0XBB,0XDD,0X100,0X124,0X14A,0X171,0X198</p><p>F_941:<br/>&nbsp;DW&nbsp;0X1C0,0X1EB,0X217,0X242,0X26B,0X293,0X2B8,0X2DC,0X2FC,0X31A,0X334,0X34B,0X35D,0X36C,0X377,0X37D,0X380,0X37D,0X377,0X36C<br/>&nbsp;DW&nbsp;0X35D,0X34B,0X334,0X31A,0X2FC,0X2DC,0X2B8,0X293,0X26B,0X242,0X217,0X1EB,0X1C0,0X194,0X168,0X13D,0X114,0XEC,0XC7,0XA3<br/>&nbsp;DW&nbsp;0X83,0X65,0X4B,0X34,0X22,0X13,0X8,0X2,0X0,0X2,0X8,0X13,0X22,0X34,0X4B,0X65,0X83,0XA3,0XC7,0XEC<br/>&nbsp;DW&nbsp;0X114,0X13D,0X168,0X194</p><p>F_1209:<br/>&nbsp;DW&nbsp;0X240,0X288,0X2CF,0X314,0X355,0X392,0X3CA,0X3FB,0X426,0X449,0X463,0X475,0X47E,0X47E,0X475,0X463,0X449,0X426,0X3FB,0X3CA<br/>&nbsp;DW&nbsp;0X392,0X355,0X314,0X2CF,0X288,0X240,0X1F7,0X1B0,0X16B,0X12A,0XED,0XB5,0X84,0X59,0X36,0X1C,0XA,0X1,0X1,0XA<br/>&nbsp;DW&nbsp;0X1C,0X36,0X59,0X84,0XB5,0XED,0X12A,0X16B,0X1B0,0X1F7</p><p>F_1336:<br/>&nbsp;DW&nbsp;0X240,0X290,0X2DE,0X32A,0X371,0X3B2,0X3EC,0X41D,0X445,0X463,0X477,0X47F,0X47C,0X46E,0X456,0X432,0X405,0X3D0,0X392,0X34E<br/>&nbsp;DW&nbsp;0X305,0X2B7,0X268,0X217,0X1C8,0X17A,0X131,0XED,0XAF,0X7A,0X4D,0X29,0X11,0X3,0X0,0X8,0X1C,0X3A,0X62,0X93<br/>&nbsp;DW&nbsp;0XCD,0X10E,0X155,0X1A1,0X1EF</p><p>F_1477:<br/>&nbsp;DW&nbsp;0X240,0X297,0X2ED,0X33F,0X38B,0X3CF,0X40A,0X43A,0X45E,0X475,0X47F,0X47C,0X46B,0X44D,0X423,0X3EE,0X3AE,0X366,0X317,0X2C3<br/>&nbsp;DW&nbsp;0X26C,0X213,0X1BC,0X168,0X119,0XD1,0X91,0X5C,0X32,0X14,0X3,0X0,0XA,0X21,0X45,0X75,0XB0,0XF4,0X140,0X192<br/>&nbsp;DW&nbsp;0X1E8</p><p>F_1633:<br/>&nbsp;DW&nbsp;0X240,0X2A1,0X2FF,0X358,0X3A9,0X3F0,0X42A,0X456,0X473,0X47F,0X47B,0X466,0X442,0X40F,0X3CE,0X382,0X32D,0X2D1,0X270,0X20F<br/>&nbsp;DW&nbsp;0X1AE,0X152,0XFD,0XB1,0X70,0X3D,0X19,0X4,0X0,0XC,0X29,0X55,0X8F,0XD6,0X127,0X180,0X1DE<br/>;FREQ_INDEX is the adresss for the sin data<br/>FREQ_COM_TBL&nbsp;DW&nbsp;F_697,F_770,F_852,F_941,F_1209,F_1336,F_1477,F_1633</p><p>TMR16_CON&nbsp;DB&nbsp;1</p><p><br/>; 子程序=&gt;&gt;</p><p>DialOutController_Initial:<br/>&nbsp;&nbsp;ret</p><p>DialOutController_SetIndex:<br/>&nbsp;cp&nbsp;r3,#0bh<br/>&nbsp;jp&nbsp;UGT,_set_index_fail<br/>&nbsp;ld&nbsp;_doc_index,r3<br/>&nbsp;jp&nbsp;_set_index_exit<br/>_set_index_fail:<br/>&nbsp;ld&nbsp;r3,#0fh<br/>&nbsp;ld&nbsp;_doc_index,r3&nbsp;<br/>_set_index_exit:<br/>&nbsp;ret<br/>&nbsp;&nbsp;<br/>DialOutController_Int_TimerA:<br/>&nbsp;LD&nbsp;&nbsp;R0,_sr_DA_OUT<br/>&nbsp;BITS&nbsp;ADCON.5&nbsp;&nbsp;&nbsp;<br/>&nbsp;LD&nbsp;&nbsp;DADATA,R0<br/>&nbsp;LD&nbsp;&nbsp;DADATA,R0<br/>&nbsp;LD&nbsp;&nbsp;DADATA,R0<br/>&nbsp;LD&nbsp;&nbsp;DADATA,R0<br/>&nbsp;BITS&nbsp;_sr_DTMF_FLAG.bFINISH&nbsp;<br/>&nbsp;ret<br/>&nbsp;<br/>DialOutController_Int_DA:<br/>&nbsp;<br/>&nbsp;ret<br/>&nbsp;&nbsp;&nbsp;&nbsp;<br/>;------------拨号程序&gt;&gt;----------------&nbsp;<br/>;&nbsp;&nbsp;&nbsp; PUBLIC _fun_DTMF_DIAL<br/>;**********************************************<br/>;*_FUN_DIAL<br/>;*FUNCTION:&nbsp;DIAL (NUMBER)<br/>;*OUTPUT:&nbsp;DTMF wave<br/>;*HW STACK:&nbsp;USED 1+1=2 LEVEL<br/>;*SW STACK:&nbsp;USED 0 BYTES<br/>;*USED:&nbsp;&nbsp;NUM_COUNTER,L_FQ_DA_NUM,H_FQ_DA_NUM,LOW_FREQ_I,HIGH_FREQ_I,LOW_F_CNTR,HIGH_F_CNTR,TIMECNTR<br/>;*&nbsp;&nbsp;&nbsp;IDH,IDL0,ILH,ILL,TBL,TBH,R0,R1,R2,R3_tr_MAC_TMP0[0-1]<br/>;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FLAG C(Z,NZ)<br/>;**********************************************<br/>;tempdata<br/>STACK_SIZE&nbsp;.SETVAR&nbsp;0<br/>_tm_LOWFDA_CNT&nbsp;&nbsp;EQU&nbsp;STACK_SIZE&nbsp;;DA num in one cycle of&nbsp; low frequency wave<br/>STACK_SIZE&nbsp;.SETVAR&nbsp;STACK_SIZE+1<br/>_tm_HIGFDA_CNT&nbsp;&nbsp;EQU&nbsp;STACK_SIZE&nbsp;;DA num in one cycle of&nbsp; high frequency wave<br/>STACK_SIZE&nbsp;.SETVAR&nbsp;STACK_SIZE+1<br/>_tm_LOWF_INDEX&nbsp;&nbsp;EQU&nbsp;STACK_SIZE&nbsp;;STORE LOW FREQUENCY SIN DATA ADDRESS<br/>STACK_SIZE&nbsp;.SETVAR&nbsp;STACK_SIZE+2<br/>_tm_HIGF_INDEX&nbsp;&nbsp;EQU&nbsp;STACK_SIZE&nbsp;;STORE HIGH FREQUENCY SIN DATA ADDRESS<br/>STACK_SIZE&nbsp;.SETVAR&nbsp;STACK_SIZE+2<br/>_tm_LOWF_CNTR&nbsp;&nbsp;EQU&nbsp;STACK_SIZE&nbsp;;low freq counter<br/>STACK_SIZE&nbsp;.SETVAR&nbsp;STACK_SIZE+1<br/>_tm_HIGF_CNTR&nbsp;&nbsp;EQU&nbsp;STACK_SIZE&nbsp;;high freq counter<br/>STACK_SIZE&nbsp;.SETVAR&nbsp;STACK_SIZE+1<br/>_tm_TIME_CNTR&nbsp;&nbsp;EQU&nbsp;STACK_SIZE&nbsp;;counter to control the output time<br/>STACK_SIZE&nbsp;.SETVAR&nbsp;STACK_SIZE+2</p><p>bDTMF_FINISH&nbsp;&nbsp;EQU&nbsp;&nbsp;bFINISH<br/>;*--------------------------------------------------------------<br/>; Func: _fun_DTMF_DIAL,<br/>; Input: _doc_index, the number to dial out<br/>;*--------------------------------------------------------------</p><p>DialOutController_DialOut:<br/>&nbsp;&nbsp;bitr&nbsp;p4.0<br/>&nbsp;&nbsp;_macro_ALLOC STACK_SIZE<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;ld&nbsp;r3,#IS_TIMER_A_DIALOUT<br/>&nbsp;&nbsp;lcall&nbsp;InterruptServer_Regist<br/>&nbsp;&nbsp;ld&nbsp;r3,#IS_DA_DIALOUT<br/>&nbsp;&nbsp;lcall&nbsp;InterruptServer_Regist<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;ld&nbsp;r3,_doc_index<br/>&nbsp;&nbsp;cp&nbsp;r3,#0fh<br/>&nbsp;&nbsp;jp&nbsp;z,_dial_out_exit<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;BMS<br/>&nbsp;&nbsp;LD&nbsp;R0, #&lt;DTRANS_TBL&nbsp;; Transfe from number to position<br/>&nbsp;&nbsp;LD&nbsp;ILH, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, #&gt;DTRANS_TBL<br/>&nbsp;&nbsp;ADD&nbsp;R0, R3<br/>&nbsp;&nbsp;LD&nbsp;ILL, R0<br/>&nbsp;&nbsp;LDC&nbsp;@IL<br/>&nbsp;&nbsp;LD&nbsp;R2, TBL<br/>&nbsp;&nbsp;LD&nbsp;R3, R2&nbsp;&nbsp;&nbsp;; Get the DA count for the frequent combination<br/>&nbsp;&nbsp;SR&nbsp;R3<br/>&nbsp;&nbsp;SR&nbsp;R3<br/>&nbsp;&nbsp;AND&nbsp;R2, #3&nbsp;&nbsp;&nbsp;; R2 for high freq, R3 for low freq<br/>&nbsp;&nbsp;ADD&nbsp;R2, #4<br/>&nbsp;&nbsp;LD&nbsp;R0, #&lt;DACNT_TBL<br/>&nbsp;&nbsp;LD&nbsp;ILH, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, #&gt;DACNT_TBL<br/>&nbsp;&nbsp;ADD&nbsp;R0, R3<br/>&nbsp;&nbsp;LD&nbsp;ILL, R0<br/>&nbsp;&nbsp;LDC&nbsp;@IL<br/>&nbsp;&nbsp;LD&nbsp;R0, TBL<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_LOWFDA_CNT, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, #&gt;DACNT_TBL<br/>&nbsp;&nbsp;ADD&nbsp;R0, R2<br/>&nbsp;&nbsp;LD&nbsp;ILL, R0<br/>&nbsp;&nbsp;LDC&nbsp;@IL<br/>&nbsp;&nbsp;LD&nbsp;R0, TBL<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_HIGFDA_CNT, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, #&lt;FREQ_COM_TBL&nbsp;; Get the freq combination index<br/>&nbsp;&nbsp;LD&nbsp;ILH, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, #&gt;FREQ_COM_TBL<br/>&nbsp;&nbsp;ADD&nbsp;R0, R3<br/>&nbsp;&nbsp;LD&nbsp;ILL, R0<br/>&nbsp;&nbsp;LDC&nbsp;@IL<br/>&nbsp;&nbsp;LD&nbsp;R0, TBH<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_LOWF_INDEX, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, TBL<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_LOWF_INDEX+1, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, #&gt;FREQ_COM_TBL<br/>&nbsp;&nbsp;ADD&nbsp;R0, R2<br/>&nbsp;&nbsp;LD&nbsp;ILL, R0<br/>&nbsp;&nbsp;LDC&nbsp;@IL<br/>&nbsp;&nbsp;LD&nbsp;R0, TBH<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_HIGF_INDEX, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, TBL<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_HIGF_INDEX+1, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, #0<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_LOWF_CNTR, R0<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_HIGF_CNTR, R0<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_TIME_CNTR, R0<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_TIME_CNTR+1, R0<br/>&nbsp;&nbsp;BITS&nbsp;_sr_DTMF_FLAG.bDIAL_INP<br/>&nbsp;&nbsp;<br/>; Set the timer A for DTMF usage <br/>&nbsp;&nbsp;LD&nbsp;R0, TACON<br/>&nbsp;&nbsp亚星游戏官网-yaxin222USH&nbsp;R0<br/>&nbsp;&nbsp;LD&nbsp;R0, #43H&nbsp;&nbsp;; timer A run, Fxx/1<br/>&nbsp;&nbsp;LD&nbsp;TACON, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, TADATA<br/>&nbsp;&nbsp亚星游戏官网-yaxin222USH&nbsp;R0<br/>&nbsp;&nbsp;LD&nbsp;R0, #134; the FREQ dividor<br/>&nbsp;&nbsp;LD&nbsp;TADATA, R0<br/>&nbsp;&nbsp;BITS&nbsp;ADCON.6&nbsp;&nbsp;&nbsp;; Enable the DA int&nbsp;<br/>; Backup the interrupt setting<br/>&nbsp;&nbsp;DI<br/>&nbsp;&nbsp;LD&nbsp;R0, IMR00<br/>&nbsp;&nbsp亚星游戏官网-yaxin222USH&nbsp;R0<br/>&nbsp;&nbsp;LD&nbsp;R0, #00<br/>&nbsp;&nbsp;LD&nbsp;IMR00, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, IMR01<br/>&nbsp;&nbsp亚星游戏官网-yaxin222USH&nbsp;R0<br/>&nbsp;&nbsp;LD&nbsp;R0, #00<br/>&nbsp;&nbsp;LD&nbsp;IMR01, R0<br/>&nbsp;&nbsp;LD&nbsp;R0, IMR1<br/>&nbsp;&nbsp亚星游戏官网-yaxin222USH&nbsp;R0&nbsp;<br/>&nbsp;&nbsp;LD&nbsp;R0, #00&nbsp;<br/>&nbsp;&nbsp;LD&nbsp;IMR1, R0<br/>; Initial the interrupt setting&nbsp;&nbsp;<br/>&nbsp;&nbsp;BITS&nbsp;ADCON.5&nbsp;&nbsp;&nbsp;&nbsp;; Enable the AD/DA clk<br/>&nbsp;&nbsp;BITS&nbsp;IMR00.0&nbsp;&nbsp;&nbsp;&nbsp;; Enable the DA INT<br/>&nbsp;&nbsp;BITS&nbsp;IMR00.1&nbsp;&nbsp;&nbsp;&nbsp;; Enable timer A<br/>&nbsp;&nbsp;BITS&nbsp;DACON.0&nbsp;&nbsp;&nbsp;&nbsp;; Enable DA<br/>&nbsp;&nbsp;EI<br/>; Dial out the DTMF wave<br/>&nbsp;DA_LOOP:<br/>&nbsp;&nbsp;_macro_READ&nbsp;R2, _tm_LOWF_INDEX&nbsp;; Get the low freq DA out<br/>&nbsp;&nbsp;_macro_READ&nbsp;R0, _tm_LOWF_INDEX+1<br/>&nbsp;&nbsp;_macro_READ&nbsp;R1, _tm_LOWF_CNTR<br/>&nbsp;&nbsp;ADD&nbsp;R0, R1<br/>&nbsp;&nbsp;INCC&nbsp;R2<br/>&nbsp;&nbsp;LD&nbsp;ILH, R2<br/>&nbsp;&nbsp;LD&nbsp;ILL, R0<br/>&nbsp;&nbsp;LDC&nbsp;@IL<br/>&nbsp;&nbsp;LD&nbsp;R0, TBL<br/>&nbsp;&nbsp;PUSH&nbsp;R0<br/>&nbsp;&nbsp;LD&nbsp;R1, TBH<br/>&nbsp;&nbsp;_macro_READ&nbsp;R0, _tm_HIGF_INDEX&nbsp;; Get the high freq DA out<br/>&nbsp;&nbsp;_macro_READ&nbsp;R2, _tm_HIGF_INDEX+1<br/>&nbsp;&nbsp;_macro_READ&nbsp;R3, _tm_HIGF_CNTR<br/>&nbsp;&nbsp;ADD&nbsp;R2, R3<br/>&nbsp;&nbsp;INCC&nbsp;R0<br/>&nbsp;&nbsp;LD&nbsp;ILH, R0<br/>&nbsp;&nbsp;LD&nbsp;ILL, R2<br/>&nbsp;&nbsp;LDC&nbsp;@IL<br/>&nbsp;&nbsp;LD&nbsp;R2, TBL<br/>&nbsp;&nbsp;LD&nbsp;R3, TBH<br/>&nbsp;&nbsp;POP&nbsp;R0<br/>&nbsp;&nbsp;ADD&nbsp;R0, R2<br/>&nbsp;&nbsp;ADC&nbsp;R1, R3<br/>&nbsp;&nbsp;SR&nbsp;R1<br/>&nbsp;&nbsp;RRC&nbsp;R0<br/>&nbsp;&nbsp;SR&nbsp;R1<br/>&nbsp;&nbsp;RRC&nbsp;R0<br/>&nbsp;&nbsp;SR&nbsp;R1&nbsp;&nbsp;<br/>&nbsp;&nbsp;RRC&nbsp;R0<br/>&nbsp;&nbsp;_macro_READ&nbsp;R1, _tm_LOWF_CNTR&nbsp;; loop the DTMF wave<br/>&nbsp;&nbsp;INC&nbsp;R1<br/>&nbsp;&nbsp;_macro_READ&nbsp;R2, _tm_LOWFDA_CNT<br/>&nbsp;&nbsp;CP&nbsp;R1, R2<br/>&nbsp;&nbsp;Jp&nbsp;ULE, %F1<br/>&nbsp;&nbsp;LD&nbsp;R1, #0<br/>&nbsp;%1:&nbsp;<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_LOWF_CNTR, R1<br/>&nbsp;&nbsp;_macro_READ&nbsp;R1, _tm_HIGF_CNTR<br/>&nbsp;&nbsp;INC&nbsp;R1<br/>&nbsp;&nbsp;_macro_READ&nbsp;R2, _tm_HIGFDA_CNT<br/>&nbsp;&nbsp;CP&nbsp;R1, R2<br/>&nbsp;&nbsp;Jp&nbsp;ULE, %F2<br/>&nbsp;&nbsp;LD&nbsp;R1, #0<br/>&nbsp;%2:&nbsp;<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_HIGF_CNTR, R1<br/>&nbsp;&nbsp;LD&nbsp;_sr_DA_OUT, R0<br/>&nbsp;WAIT_DA:<br/>&nbsp;&nbsp;NOP&nbsp;<br/>&nbsp;&nbsp;BITT&nbsp;_sr_DTMF_FLAG.bFINISH<br/>&nbsp;&nbsp;Jp&nbsp;Z, WAIT_DA<br/>&nbsp;&nbsp;BMS<br/>&nbsp;&nbsp;BITR&nbsp;_sr_DTMF_FLAG.bFINISH<br/>&nbsp;&nbsp;_macro_READ&nbsp;R0, _tm_TIME_CNTR&nbsp;; output enough long time<br/>&nbsp;&nbsp;_macro_READ&nbsp;R1, _tm_TIME_CNTR+1<br/>&nbsp;&nbsp;INC&nbsp;R1<br/>&nbsp;&nbsp;INCC&nbsp;R0<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_TIME_CNTR, R0<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_TIME_CNTR+1, R1<br/>&nbsp;&nbsp;CP&nbsp;R1, #0<br/>&nbsp;&nbsp;Jp&nbsp;NZ, DA_LOOP<br/>&nbsp;&nbsp;CP&nbsp;R0, #cDIAL_TIME<br/>&nbsp;&nbsp;Jp&nbsp;ULE, DA_LOOP<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;LD&nbsp;R0, #7FH&nbsp;&nbsp;&nbsp;; output enough long empty time<br/>&nbsp;&nbsp;LD&nbsp;_sr_DA_OUT, R0<br/>&nbsp;DTMF_WTIME:<br/>&nbsp;&nbsp;NOP&nbsp;<br/>&nbsp;&nbsp;BITT&nbsp;_sr_DTMF_FLAG.bDTMF_FINISH&nbsp;<br/>&nbsp;&nbsp;Jp&nbsp;Z, DTMF_WTIME<br/>&nbsp;&nbsp;BITR&nbsp;_sr_DTMF_FLAG.bDTMF_FINISH<br/>&nbsp;&nbsp;_macro_READ&nbsp;R0, _tm_TIME_CNTR<br/>&nbsp;&nbsp;_macro_READ&nbsp;R1, _tm_TIME_CNTR+1<br/>&nbsp;&nbsp;INC&nbsp;R1<br/>&nbsp;&nbsp;INCC&nbsp;R0<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_TIME_CNTR, R0<br/>&nbsp;&nbsp;_macro_WRITE&nbsp;_tm_TIME_CNTR+1, R1<br/>&nbsp;&nbsp;CP&nbsp;R1, #0<br/>&nbsp;&nbsp;Jp&nbsp;NZ, DTMF_WTIME<br/>&nbsp;&nbsp;CP&nbsp;R0, #cDTSLI_TIME<br/>&nbsp;&nbsp;Jp&nbsp;ULE, DTMF_WTIME<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;BITR&nbsp;_sr_DTMF_FLAG.bDIAL_INP<br/>; Disable the DA clk and interrupt</p><p>&nbsp;&nbsp;DI<br/>&nbsp;&nbsp;BITR&nbsp;ADCON.5&nbsp;&nbsp;; Disable the AD/DA clk<br/>&nbsp;&nbsp;BITR&nbsp;DACON.0&nbsp;&nbsp;; Disable the DA <br/>; Restore the IMR&nbsp;&nbsp;<br/>&nbsp;&nbsp;POP&nbsp;R0<br/>&nbsp;&nbsp;LD&nbsp;IMR1, R0<br/>&nbsp;&nbsp;POP&nbsp;R0<br/>&nbsp;&nbsp;LD&nbsp;IMR01, R0<br/>&nbsp;&nbsp;POP&nbsp;R0<br/>&nbsp;&nbsp;LD&nbsp;IMR00, R0<br/>&nbsp;&nbsp;POP&nbsp;R0<br/>&nbsp;&nbsp;LD&nbsp;TADATA, R0<br/>&nbsp;&nbsp;POP&nbsp;R0<br/>&nbsp;&nbsp;LD&nbsp;TACON, R0<br/>&nbsp;&nbsp;EI<br/>&nbsp;&nbsp;<br/>_dial_out_exit:<br/>&nbsp;&nbsp;ld&nbsp;r3,#IS_TIMER_A_DIALOUT<br/>&nbsp;&nbsp;lcall&nbsp;InterruptServer_Unregist<br/>&nbsp;&nbsp;ld&nbsp;r3,#IS_DA_DIALOUT<br/>&nbsp;&nbsp;lcall&nbsp;InterruptServer_Unregist</p><p>&nbsp;&nbsp;_macro_FREE STACK_SIZE<br/>&nbsp;&nbsp;bits&nbsp;p4.0<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;RET<br/>.end<br/></p>

举报本楼

本帖有 2 个回帖,您需要登录后才能浏览 登录 | 注册
您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系大家 |网站地图  

GMT+8, 2024-11-24 22:47 , Processed in 0.384352 second(s), 15 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部
XML 地图 | Sitemap 地图