|
哪位大佬,能不能帮忙把这个文件变成hex文件可以直接烧录的
- #include "src\STC12C5A.h"
- #include <intrins.h>
- #include <math.h>
- #include "src\Define.h"
- uchar data DelayTime=9;
- uchar data gain=6,tt=0;
- uchar idata refreshflag[40];
- uchar data LEDBuf[35];
- #include "src\ADC.c"
- #include "src\fft.h"
- uchar code ax[]={0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,
- 0x00,0x00,0x00,0x70,0xF8,0xFC,0xFE,0x7F,0x7F,0x7F,0xFE,0xFC,0xF8,0x70,0x00,0x00,
- 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,
- };
- void Delays(uint t) {
- uint j;
- while(--t)
- {
- for(j=0;j<5;j++);
- }
- }
- void IOINIT()
- {
- P0M1 = 0x00; P0M0 = 0xff; P0=0; //点阵列(Y)(L:OFF; H,H+:ON,ON+;)
- P1M1 = B(01000011); P1M0 = B(00110000);P1=B(10111111); //(P17@(高阻,IN)&P16@(高阻,IN) ... P11@(高阻,IN)AD2;P10@(高阻,IN)AD1;
- P2M1 = B(00000000); P2M0 = B(11111111);P2=0; //点阵行(X0(Left))(L:OFF; H,H+:ON,ON+;)
- P3M1 = B(00000000); P3M0 = B(11111111);P3=0; //点阵行(X1(Right))(L:OFF; H,H+:ON,ON+;)
- P1ASF =B(00000011); //将P10,P11的IO设置为模拟输入功能;
- }
- void BufToLED_Refresh() //把LEDBuf的数值数据传到P0,通过LED显示出来
- {
- uchar data i;
- uint temp=0x7fff;
- for(i=0;i<32;i+=2)
- {
- P0=0x00;
- P2=temp/256;
- P3=temp%256;
- P0=~LEDBuf[i];
- Delays(DelayTime);
- P2=0xff;
- P3=0xff;
- temp>>=1;
- temp|=0x8000;
- }
- }
- void LOVE()
- {
- uchar data i;
- uint temp=0x7fff;
- for(i=0;i<16;i++)
- {
- P0=0x00;
- P2=temp/256;
- P3=temp%256;
- P0=ax[i+tt];
- Delays(DelayTime);
- P2=0xff;
- P3=0xff;
- temp>>=1;
- temp|=0x8000;
- }
- }
- void Timer_INT()
- {
- TMOD = 0x10;
- EA = 1;
- TH1 = 0x00;
- TL1 = 0x00;
- ET1 = 1;
- TR1 = 1;
- }
- void ax_xs()
- {
- uint pp=4000;
- while(pp--)
- while循环)
- {
- if(pp%250==0)
- {
- tt++;
- }
- LOVE();
- }
- pp=4000;
- while(pp--)
- while循环)
- {
- LOVE();
- }
- pp=4000;
- while(pp--)
- while循环)
- {
- if(pp%250==0) )
- {
- tt++;
- }
- LOVE();
- }
- }
- void Main()
- {
- uint data Count=700;
- uchar data i,Cgain,num=0;
- IOINIT();
- ax_xs();
- InitADC();
- Timer_INT();
- while(1) //主循环
- {
- for(i=0;i<65;i++) )
- {
- dd[i].real=(GetADCResult(0)+GetADCResult(1))<<gain;
- }
- processfft();
- if(dd[2].real<32)
- {
- if(++Count==300)
- {
- Count=0; //Count清0
- gain=6; //gain=6
- }
- }
- else
- {
- Count=1;
- if(++num==0xAF)
- {
- num=0;
- /*自动增益的作用: 当输入的音频信号的音量变大或变小时,采样的 AD 值幅度也会有相应趋势的变化,
- 于是根据这个值自动调节 AD 值放大的倍数,维持在一定的范围内,从而使显示的效果最好,
- 不会出现满屏或者空屏的现象*/
- //自动增益;Automatic gain;
- Cgain=dd[2].real/32;
- if(7<Cgain<=8)
- {
- gain=4; //4
- }
- else if(4<Cgain<=6)
- {
- gain=5; //5
- }
- else if(2<Cgain<=4)
- {
- gain=6; //6
- }
- else
- {
- gain=7; //7
- }
- }
- }
- }
- }
- void LEDRefresh_INT() interrupt 3 //定时器中断服务函数
- {
- TH1 = 0x8A;
- TL1 = 0xD0;
-
- BufToLED_Refresh();
-
- }
复制代码
|
|