小弟初学DSP2812,希望哪位大侠帮助小弟解释一下下面这个主程序的意思,谢谢了。
#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.
//===========================================================================
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>