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

📄 dtmftone.c

📁 一个滤波器和一个音效处理程序 TI 的CCS 编译器编程。
💻 C
字号:
/* ***********************************************************
* THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
* REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 
* INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS 
* FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR 
* COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE. 
* TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET 
* POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY 
* INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR 
* YOUR USE OF THE PROGRAM.
*
* IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL, 
* CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY 
* THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED 
* OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT 
* OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM. 
* EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF 
* REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS 
* OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF 
* USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S 
* AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF 
* YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS 
* (U.S.$500).
*
* Unless otherwise stated, the Program written and copyrighted 
* by Texas Instruments is distributed as "freeware".  You may, 
* only under TI's copyright in the Program, use and modify the 
* Program without any charge or restriction.  You may 
* distribute to third parties, provided that you transfer a 
* copy of this license to the third party and the third party 
* agrees to these terms by its first use of the Program. You 
* must reproduce the copyright notice and any other legend of 
* ownership on each copy or partial copy, of the Program.
*
* You acknowledge and agree that the Program contains 
* copyrighted material, trade secrets and other TI proprietary 
* information and is protected by copyright laws, 
* international copyright treaties, and trade secret laws, as 
* well as other intellectual property laws.  To protect TI's 
* rights in the Program, you agree not to decompile, reverse 
* engineer, disassemble or otherwise translate any object code 
* versions of the Program to a human-readable form.  You agree 
* that in no event will you alter, remove or destroy any 
* copyright notice included in the Program.  TI reserves all 
* rights not specifically granted under this license. Except 
* as specifically provided herein, nothing in this agreement 
* shall be construed as conferring by implication, estoppel, 
* or otherwise, upon you, any license or other right under any 
* TI patents, copyrights or trade secrets.
*
* You may not use the Program in non-TI devices.
* ********************************************************* */
/***********************************************************************
**  File Name:     DTMFTone.c
**  Part Number:   TLV320AIC10/11EVM-SW-00003
************************************************************************
**  Copyright (c) Texas Instruments, Inc. 2000
************************************************************************
**
**  Release History:
**     Version      Date          Engr          Description
**      1.00     10-11-2000    Wendy X Fang   Original Release
**
************************************************************************
**
**  Function: 
**    This program generates 10 DTMF tones, and each consists of a high
**    and a low frequency sine components. There are 7 basic sine waves
**    with the frequencies of 1477, 1336, 1209, 941, 852, 770 & 697 Hz,
**    which are made up the 10 tones. For 16KHz AIC10 sample frequency,
**    each tone last 1/10 second, and the 10 tone "music" is repeated
**    at a 1Hz frequency, which is controled by main loop, refer to file
**    "InitC5402.asm" & "LoopControl.asm" for frequency information.
**
***********************************************************************/

/***********************************************************************
** Include Statements
***********************************************************************/
#include   "DTMFTone.h"

/***********************************************************************
**  Function Routine
***********************************************************************/
void  DTMFTone(void)
{   

    ToneCount += 1;                 /* increase ToneCounter */
    if (ToneCount >= 1600)          /* interval between 2 tones = 1/10 sec */
    {
        ToneCount  = 0;             /* reset tone interval counter */ 
        ToneIndex += 1;             /* change to next tone(increase index)*/
        if (ToneIndex >= 10)        /* there are 10 DTMF tones */
            ToneIndex=0;            /* reset DTMF tone index */
    }

    if (s697 < 23)                  /* freq 697 sine table index */
        s697 += 1;                  /*     increase the index    */
    else                            /*     limit max index to 23 */
        s697 = 0;
    if (s770 < 21)                  /* freq 770 sine table index */
        s770 += 1;                  /*     increase the index    */
    else                            /*     limit max index to 21 */
        s770 = 0;
    if (s852 < 19)                  /* freq 852 sine table index */
        s852 += 1;                  /*     increase the index    */
    else                            /*     limit max index to 19 */
        s852 = 0;
    if (s941 < 17)                  /* freq 941 sine table index */
        s941 += 1;                  /*     increase the index    */
    else                            /*     limit max index to 17 */
        s941 = 0;
    if (s1209 < 13)                 /* freq 1209 sine table index */
        s1209 += 1;                 /*     increase the index    */
    else                            /*     limit max index to 13 */
        s1209 = 0;
    if (s1336 < 12)                 /* freq 1336 sine table index */
        s1336 += 1;                 /*     increase the index     */
    else                            /*     limit max index to 12  */
        s1336 = 0; 
    if (s1477 < 11)                 /* freq 1477 sine table index */
        s1477 += 1;                 /*     increase the index     */
    else                            /*     limit max index to 11  */
        s1477 = 0;

    switch (ToneIndex)
    {
        case 0:
            ToneHi = f1477[s1477];  /* tone #0 */
            ToneLo = f852[s852];
            break;
        case 1:
            ToneHi = f1209[s1209];  /* tone #1 */
            ToneLo = f852[s852];
            break;      
        case 2:
            ToneHi = f1336[s1336];  /* tone #2 */
            ToneLo = f697[s697];
            break;            
        case 3:
            ToneHi = f1209[s1209];  /* tone #3 */
            ToneLo = f770[s770];
            break;            
        case 4:
            ToneHi = f1336[s1336];  /* tone #4 */
            ToneLo = f852[s852];
            break;            
        case 5:
            ToneHi = f1336[s1336];  /* tone #5 */
            ToneLo = f941[s941];
            break;            
        case 6:
            ToneHi = f1209[s1209];  /* tone #6 */
            ToneLo = f697[s697];
            break;            
        case 7:
            ToneHi = f1336[s1336];  /* tone #7 */
            ToneLo = f941[s941];
            break;            
        case 8:
            ToneHi = f1477[s1477];  /* tone #8 */
            ToneLo = f852[s852];
            break;            
        default:
            ToneHi = f1209[s1209];  /* tone #9 */
            ToneLo = f770[s770];
    }
    ToneWave  = ((ToneHi+ToneLo) >> 2); /* get the new tone */
    ToneWave &= 0xFFFE;                 /* put it on 15 MSB */ 
    McBSP0_DXR1 = ToneWave;
}

/***********************************************************************
**  End of File -- DTMFTone.c
***********************************************************************/

⌨️ 快捷键说明

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