STC12C5A60S2单片机实现音频信号的频谱显示(在LCD上显示)

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

利用STC12C5A60S2单片机实现音频信号的频谱显示(在LCD上显示)

思路:外来音频信号经过51单片机,在单片机中进行频谱分析,并将结果显示在LCD(12864或1602)上

要求:频谱显示如同千千静听播放音乐时的频谱显示

希望各位高手能给出详细的解决方案,感激。。。。。。

51做FFT有些困难,可以使用增强型(RAM)的51机子进行

参考程序:

#include

#define uchar unsigned char

#define uint unsigned int

#define channel 0x01 //设置AD通道为 P1.1

//---------------------------------------------------------------------

sbit SDA_R=P1^2;

sbit SDA_R_TOP=P1^3;

sbit SDA_G=P1^4;

sbit SDA_G_TOP=P1^5;

sbit STCP=P1^6;

sbit SHCP=P1^7;

//---------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------------------------

//放大128倍后的sin整数表(128)

code char SIN_TAB[128] = { 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 59, 65, 70, 75, 80, 85, 89, 94, 98, 102,

105, 108, 112, 114, 117, 119, 121, 123, 124, 125, 126, 126, 126, 126, 126, 125, 124, 123, 121, 119, 117, 114, 112,

108, 105, 102, 98, 94, 89, 85, 80, 75, 70, 65, 59, 54, 48, 42, 36, 30, 24, 18, 12, 6, 0, -6, -12, -18, -24, -30,

-36, -42, -48, -54, -59, -65, -70, -75, -80, -85, -89, -94, -98, -102, -105, -108, -112, -114, -117, -119, -121,

-123, -124, -125, -126, -126, -126, -126, -126, -125, -124, -123, -121, -119, -117, -114, -112, -108, -105, -102,

-98, -94, -89, -85, -80, -75, -70, -65, -59, -54, -48, -42, -36, -30, -24, -18, -12, -6 };

//放大128倍后的cos整数表(128)

code char COS_TAB[128] = { 127, 126, 126, 125, 124, 123, 121, 119, 117, 114, 112, 108, 105, 102, 98, 94,

89, 85, 80, 75, 70, 65, 59, 54, 48, 42, 36, 30, 24, 18, 12, 6, 0, -6, -12, -18, -24, -30, -36, -42, -48, -54, -59,

-65, -70, -75, -80, -85, -89, -94, -98, -102, -105, -108, -112, -114, -117, -119, -121, -123, -124, -125, -126, -

126, -126, -126, -126, -125, -124, -123, -121, -119, -117, -114, -112, -108, -105, -102, -98, -94, -89, -85, -80,

-75, -70, -65, -59, -54, -48, -42, -36, -30, -24, -18, -12, -6, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 59, 65, 70,

75, 80, 85, 89, 94, 98, 102, 105, 108, 112, 114, 117, 119, 121, 123, 124, 125, 126, 126 };

//采样存储序列表

code char LIST_TAB[128] = { 0, 64, 32, 96, 16, 80, 48, 112,

8, 72, 40, 104, 24, 88, 56, 120,

4, 68, 36, 100, 20, 84, 52, 116,

12, 76, 44, 108, 28, 92, 60, 124,

2, 66, 34, 98, 18, 82, 50, 114,

10, 74, 42, 106, 26, 90, 58, 122,

6, 70, 38, 102, 22, 86, 54, 118,

14, 78, 46, 110, 30, 94, 62, 126,

1, 65, 33, 97, 17, 81, 49, 113,

9, 73, 41, 105, 25, 89, 57, 121,

5, 69, 37, 101, 21, 85, 53, 117,

13, 77, 45, 109, 29, 93, 61, 125,

3, 67, 35, 99, 19, 83, 51, 115,

11, 75, 43, 107, 27, 91, 59, 123,

7, 71, 39, 103, 23, 87, 55, 119,

相关文档
最新文档