proteus教程——出租车行驶里程计数

1.电路图
proteus教程——出租车行驶里程计数
2.代码

#include<reg51.h>//
#include<absacc.h>//unsigned long s=0;
unsigned char code c[11]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x80};
void chag6(unsigned long x, unsigned char y[6]){
y[0]=x/100000;
x=x%100000;
y[1]=x/10000;
x=x%10000:
y[2]=x/1000;
x=x%1000;
y[3]=x/100;
y[4]=(x%100)/10;
y[5]=x%10;}
void disp(unsigned char x[6]){
unsigned char i;
unsigned int t;
for(i=0;i<6;i++)
P1=0xf8+i;
XBYTE[0x7fff]=c[x[i]];
for(t=0;t<350;t++);}}
void main(){
unsigned char a[6];
IE=0x81;
ITO=1;
IP=0x01;
while(1){
chag6(s,a);
disp(a);
}

void int0() interrupt 0(){
S+=2;}
上一篇:十进制整数转换n进制


下一篇:Photoshop 一枝漂亮的卡通梅花