void hzkdisnum(unsigned int d)
{
write_data(d/10000);
delay(50);
d=d%10000;
write_data(d/1000);
delay(50);
d=d%1000;
write_data(d/100);
delay(50);
d=d%100;
write_data(d/10);
delay(50);
d=d%10;
write_data(d);
delay(50);
}
自己根据需要可以改写成字节数字或其他数字量。
/******************************************************/
void xianshi_bianliang(int bianliang , uint8 load)
{char p[10] = {0};
int length=0;
unsigned char n=0;
int i=10000000;
if(bianliang<0)
{
p[n]='-';
n++;
bianliang = 0-bianliang;
}
while(1)
{ i=i/10;
length=bianliang/i;
if((length>0)||(i==0)) break;
}
switch(i)
{
case 1000000: length=7; break;
case 100000: length=6; break;
case 10000: length=5; break;
case 1000: length=4; break;
case 100: length=3; break;
case 10: length=2; break;
case 1: length=1; break;
case 0: length=1; break;
default: break;
}
for(; n<length;)
{
p[n]=bianliang/i+48;
if(p[n]>57) p[n]-=10;
bianliang=bianliang%i;
i=i/10;
n++;
}
DisplayStr(load,p,length);
}