充電電池容量測試儀實(shí)現(xiàn)方案
#include “reg51.h”
char
code disp[]={40,235,50,162,225,164,36,234,32,160};
//字形碼
void delay(unsigned int dt)
{ unsigned int j=0;
for(;dt>0;dt--)
{ for(j=0;j125;j++)
{;}
}
}
void main()
{ int a,b,c,led1,led2,led3,led4;
P3=255;
a=0;
for(;;)
{b=a;
led1=b%10;
P2=239;
P0=disp[led1];
delay(6);
P2=255;
b=b/10;
led2=b%10;
P2=223;
P0=disp[led2];
delay(6);
P2=255;
b=b/10;
led3=b%10;
P2=191;
P0=disp[led3];
delay(6);
P2=255;
b=b/10;
led4=b%10;
P2=127;
P0=disp[led4];
delay(6);
P2=255;
for(c=44;c>0;c--)
{
P2=239;
P0=disp[led1];
delay(5);
P2=255;
P2=223;
P0=disp[led2];
delay(5);
P2=255;
P2=191;
P0=disp[led3];
delay(5);
P2=255;
P2=127;
P0=disp[led4];
delay(5);
P2=255;
}
if(P3==127)
delay(3);
if(P3==127)
a=a+1;
else a=a;
}
}
評論