|
date=0x1234
千位 z=4
百位 x=6
十位 c=6
個位 v=0
void Led(int date) //顯示函數(shù)
{
/*****************數(shù)據(jù)轉(zhuǎn)換*****************************/
uint z,x,c,v;
z=date/1000; //求千位
x=date%1000/100; //求百位
c=date%100/10; //求十位
v=date%10; //求個位
P2=0XFF;//位
P0=seg7code[z];//段
P2=wei[0];//位
delay(80);
P2=0XFF;
P0=seg7code[x];
P2=wei[1];
delay(80);
P2=0XFF;
P0=seg7code[c];
P2=wei[2];
delay(80);
P2=0XFF;
P0=seg7code[v];
P2=wei[3];
delay(80);
P2=0XFF;
} |
|