|
//LED.h
unsigned char DisNum;//要显示的数字,十进制两位
void NumToBuf(unsigned char num);//数值转换成码值
void init_LED();
void Dis_LED1();
void Dis_LED2();
void Dispaly();
unsigned char DisplayBuf[]={
0x00,//第一位数码管的码值
0x00//第二个数码管的码值
};
unsigned char leddata[]={ //7段LED编码
0x88, //"0"
0xFC, //"1"
0x92, //"2"
0xB0, //"3"
0xE4, //"4"
0xA1, //"5"
0x81, //"6"
0xBC, //"7"
0x80, //"8"
0xA0, //"9"
0xFF, //熄灭
0x00 //全亮
};
//EXT_FUC.h
#define uchar unsigned char
#define uint unsigned int
int Led_Shift=0;
void Delayus(uint US)
{
uint i;
US=US*5/4; //5/4是在8MHz晶振下,通过软件仿真反复实验得到的数值
for ( i=0;i<US;i++);
}
//精确定义毫秒
void Delayms(uint MS)
{
uint i,j;
for ( i=0;i<MS;i++)
for (j=0;j<1141;j++); //1141是在8MHz晶振下,通过软件仿真反复实验得到的数值
} |
|