|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
大家好,我是DSP初学者,哪位高手能帮我把下面的主程序解释一下吗,谢谢了。
#include "DSP28_Device.h"
#include "ext_inf.h"
unsigned int Led_Flag;
//unsigned int *led_7seg;
//unsigned
int *led_7seg = (unsigned int *)0x02000;
#define led_7seg (*((unsigned int *)0x02400))
void delay_ms(unsigned int n)
{
unsigned int i,j;
for(j=0;j<n;j++)
for(i=0;i<50000;i++);
}
/*void
SendData(Uint16
data);*/
void main(void)
{
unsigned int k;
unsigned int uLED[10]={0x024,0x0af,0x94,0x8c,0x0f,0x4c,0x044,0x0ae,0x004,0x00c};
/*初始化系统*/
InitSysCtrl();
/*关中断*/
DINT;
IER = 0x0000;
IFR = 0x0000;
/*初始化PIE*/
InitPieCtrl();
/*初始化PIE中断矢量表*/
InitPieVectTable();
/*初始化外设*/
InitPeripherals();
/**LedReg = 0xFF;
*Led8Lock = 0xB7;*/
//
SendData(0xFF);
//
InitExRam(0);
//
RamRead(0x4000);
//
InitExRam1(0x0);
//
for(i=0x0;i<0x3;i++)
//
{
//
*(led_7seg++) = 0x0;
//
delay_ms(5);
//
led_7seg = (unsigned int *)0x02400;
for(;;)
{
for ( k=0;k<3;k++ )
{
led_7seg = 0x0;
delay_ms(40);
led_7seg = 0x0ff;
delay_ms(40);
}
for ( k=0;k<10;k++ )
{
led_7seg=uLED[k];
// 正向顺序送控制字
delay_ms(60);
// 延时
}
for ( k=10;k>0;k-- )
{
led_7seg=uLED[k-1];
// 正向顺序送控制字
delay_ms(60);
// 延时
}
}
//for(;;);
}
/*void
SendData(Uint16 data)
{
Uint16
i,Temp;
Temp = 0x80;
for
(i=0;i<8;i++)
{
if ((data & Temp)==0)
ClrData;
else
SetData;
Temp >>= 1;
ClrClk;
SetClk;
}
*Led8Lock = 0xB7;
*Led8Lock = 0xBF;
SetData;
}*/
//===========================================================================
// No more.
//=========================================================================== |
|