0,0xC0,0x00},//66
{0x00,0x01,0x0F,0x1F,0x1F,0x30,0x20,0x20,0x20,0x20,0x20,0x38,0x1F,0x0F,0x07,0x00},
/*-- 文字: . --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
{0x00,0x00,0x30,0x30,0x38,0x08,0x88,0x88,0x88,0x88,0xD8,0xF8,0x70,0x20,0x00,0x00},//68
{0x00,0x00,0x18,0x18,0x38,0x20,0x21,0x21,0x21,0x21,0x21,0x3B,0x1E,0x1E,0x04,0x00},
/*-- 文字: . --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
{0x00,0x00,0x70,0xF0,0xD8,0xC8,0x88,0x88,0x88,0x88,0x88,0x88,0xF8,0x70,0x20,0x00},//70
{0x00,0x08,0x1E,0x1E,0x33,0x21,0x21,0x21,0x21,0x21,0x23,0x23,0x1E,0x1E,0x0C,0x00},
/*-- 文字: . --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
{0x00,0x80,0xC0,0xBC,0x84,0x84,0x84,0xF4,0x82,0x82,0x83,0x82,0x80,0xC0,0x80,0x00},//72 .
/*-- 文字:.--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
{0x10,0x10,0xD0,0xFF,0x90,0x10,0xFC,0x84,0x84,0x84,0xF4,0x82,0x83,0xC2,0x80,0x00},//74 {.
/*-- 文字: . --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
{0x04,0x84,0xE4,0x9C,0x86,0xC4,0x80,0xFC,0x84,0x84,0xF4,0x82,0x83,0xC2,0x80,0x00},//76 .
/*-- 文字: . --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
{0x00,0x00,0xE0,0xF0,0xF0,0x18,0x08,0x08,0x08,0x08,0x08,0x38,0xF0,0xE0,0xC0,0x00},//78
{0x00,0x01,0x0F,0x1F,0x1F,0x30,0x20,0x20,0x20,0x20,0x20,0x38,0x1F,0x0F,0x07,0x00},
/*-- 文字: . --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
{0x00,0x00,0x20,0x70,0x78,0x08,0x08,0x08,0x08,0x08,0x88,0xF8,0xF8,0x70,0x00,0x00},//80
{0x00,0x00,0x30,0x30,0x38,0x3C,0x34,0x36,0x32,0x33,0x31,0x31,0x30,0x38,0x08,0x00},
/*-- 文字: . --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
{0x00,0x00,0x00,0x00,0x80,0x80,0x40,0x60,0x30,0xF0,0xF8,0xF8,0x00,0x00,0x00,0x00},//82
{0x00,0x00,0x06,0x07,0x05,0x04,0x24,0x24,0x24,0x3F,0x3F,0x3F,0x24,0x24,0x24,0x00},
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, //84
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} //清空 };
unsigned int uWork;
int nCount,nCursorCount;
unsigned int nScanCode,nKeyCode,state; unsigned int cKey,tKey; main() {
nIn=0; nOut=0; fInput=fOutput=0; f2PI=2*PI;
fSignal1=PI*0.6; fSignal2=0.0;
fStepSignal1=2*PI/16; fStepSignal2=7*PI/8; state=4; tKey=0; cKey=tKey;
REGISTERCLKMD=0;
CTRGR=0; // 初始化ICETEK-CTR CTRGR=0x80; CTRGR=0;
CTRLR=0; // 关闭东西方向的交通灯 CTRLR=0x40; // 关闭南北方向的交通灯 TurnLcdOn(); // 打开显示 LcdCls(); // 清除显示内存
CTRLCDCMDR=LCDCMDSTARTLINE; // 设置显示起始行 CTRLCDCR=0;
tKey=port8002; // 清键盘缓冲区
//REGISTERCLKMD=0x1007; // 设DSP主频改为两倍PLL时钟=32MHz asm(\ssbx INTM\// 关中断,进行关键设置时不许打扰 port3004=0; // 使能XINT2
uWork=PMST; // 设置PMST寄存器 PMST =uWork&0xff; // 中断向量表起始地址=80H IMR = 4; // 使能XINT2 IFR = 4; // 清中断标志位 asm(\rsbx INTM\// 开中断 DisplayEnterSystem(); for (;;) {
switch(state) {
case 0:
if(display){ display=0; LcdCls(); }
break;
case 1:
if(display){ display=0; Display1(); }
fInput=InputWave(); fIn[nIn]=fInput; nIn++; nIn%=256;
fOutput=IIR(fH1,fA1,fB1); fOut[nOut]=fOutput;
nOut++; /* break point */ if ( nOut>=256 ) {
nOut=0; }
break;
case 2:
if(display){
display=0; Display2(); }
fInput=InputWave(); fIn[nIn]=fInput; nIn++; nIn%=256;
fOutput=IIR(fH2,fA2,fB2); fOut[nOut]=fOutput; nOut++; nOut%=256; /* break point */ break; case 3:
if(display){
display=0; Display3(); } break;
default:break; } }
}
float InputWave() {
for ( i=IIRNUMBER-1;i>0;i-- ) {
fXn[i]=fXn[i-1];
fYn[i]=fYn[i-1]; //输出也参加移位 }
fXn[0]=2*sin((double)fSignal1)/5+cos((double)fSignal2); fYn[0]=0.0;
fSignal1+=fStepSignal1;
if ( fSignal1>=f2PI ) fSignal1-=f2PI; fSignal2+=fStepSignal2;
if ( fSignal2>=f2PI ) fSignal2-=f2PI; return(fXn[0]); }
float IIR(float fHn[],float fAn[],float fBn[])
{
float fSum; fSum=0;
for(i=0;i fSum+=(fXn[i]*fBn[i]); fSum+=(fYn[i]*fAn[i]); } return(fSum); } void LcdCls() { int i,j; port8001=LCDCMDSTARTLINE; LcdDelay(LCDDELAY); port8002=0; LcdDelay(LCDDELAY); for ( i=0;i<8;i++ ) { port8001=LCDCMDPAGE+i; LcdDelay(LCDDELAY); port8002=0; LcdDelay(LCDDELAY); port8001=LCDCMDSTARTCOLUMN; LcdDelay(LCDDELAY); port8002=0; LcdDelay(LCDDELAY); for ( j=0;j<64;j++ ) { port8003=0; LcdDelay(LCDDELAY); port8002=0; LcdDelay(LCDDELAY); } port8001=LCDCMDPAGE+i; LcdDelay(LCDDELAY); port8002=0; LcdDelay(LCDDELAY); port8001=LCDCMDSTARTCOLUMN; LcdDelay(LCDDELAY); port8002=0; LcdDelay(LCDDELAY); for ( j=0;j<64;j++ ) 百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库DSP综合设计-IIR滤波器综合设计 浙江大学宁波理工学院DSP课程大在线全文阅读。
相关推荐: