DSP2812控制单个数码管显示的程序解释
时间:10-02
整理:3721RD
点击:
小弟初学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 0;k-- )
{
led_7seg=uLED[k-1]; // 正向顺序送控制字
delay_ms(60); // 延时
}
}
//for(;;);
}
/*void SendData(Uint16 data)
{
Uint16 i,Temp;
Temp = 0x80;
for (i=0;i >= 1;
ClrClk;
SetClk;
}
*Led8Lock = 0xB7;
*Led8Lock = 0xBF;
SetData;
}*/
//===========================================================================
// No more.
//===========================================================================
#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 0;k-- )
{
led_7seg=uLED[k-1]; // 正向顺序送控制字
delay_ms(60); // 延时
}
}
//for(;;);
}
/*void SendData(Uint16 data)
{
Uint16 i,Temp;
Temp = 0x80;
for (i=0;i >= 1;
ClrClk;
SetClk;
}
*Led8Lock = 0xB7;
*Led8Lock = 0xBF;
SetData;
}*/
//===========================================================================
// No more.
//===========================================================================
不错,下载下来看看。
这个程序很简单。
1、
unsigned int uLED[10]={0x024,0x0af,0x94,0x8c,0x0f,0x4c,0x044,0x0ae,0x004,0x00c};定义一个数组,对于数码二极管来说是0-9;
2、
for ( k=0;k 0;k-- )
{
led_7seg=uLED[k-1]; // 正向顺序送控制字
delay_ms(60); // 延时
}
这段即为正向显示0-9,然后反向显示9-0
谢谢大家对我的帮助了,
请问这个程序下面还有一段该怎么理解呀
void SendData(Uint16 data)
{
Uint16 i,Temp;
Temp = 0x80;
for (i=0;i >= 1;
ClrClk;
SetClk;
}
*Led8Lock = 0xB7;
*Led8Lock = 0xBF;
SetData;
}