欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
Proteus仿真 具有清零功能秒表相關(guān)
[打印本頁]
作者:
田所浩二單推人
時(shí)間:
2021-6-17 11:19
標(biāo)題:
Proteus仿真 具有清零功能秒表相關(guān)
仿真圖如下 不知道為什么沒法+1和清零
代碼如下
#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
sbit K9=P2^4;
sbit K10=P2^5;
sbit K11=P2^6;
uchar code segtab[]=
{0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,
0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0xff,0xbf};
uchar dbuf[4]={0,0,0,0x10};
void delay(void)
{ uchar i;
for(i=0;i<200;i++);
}
void disp(void)
{ uchar n,bsel;
bsel=0x01;
for(n=0;n<4;n++)
{ P0=segtab[dbuf[n]];
P2=bsel|0xf0;
bsel=_crol_(bsel,1);
delay();
P0=0xff;
}
}
void main(void)
{ uchar i;
int count=0;
unsigned int t;
while(1)
{disp();
if((P2&0x30)!=0x30)
{ for(i=0;i<10;i++)disp();
if((P2&0x30)!=0x30)
{ if(K9==0)
{ count++;
if(count>999)count=-999;
}
if(K10==0)
{ count--;
if(count<-999)count=999;
}
else
count=0;
if(count>=0)
{ dbuf[3]=0x10;
t=count;
}
else
{ dbuf[3]=0x11;
t=-count;
}
dbuf[2]=t/100;
dbuf[1]=(t%100)/10;
dbuf[0]=t%10;
while((P2&0x30)!=0x30)disp();
}
}
}
}
計(jì)數(shù)器.jpg
(92.3 KB, 下載次數(shù): 43)
下載附件
2021-6-17 11:19 上傳
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1