欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標(biāo)題: 基于Proteus和Keil C的程序開發(fā) 計數(shù)顯示器和發(fā)光二極管的簡單應(yīng)用 [打印本頁]

作者: zhuhaiya    時間: 2019-12-14 20:42
標(biāo)題: 基于Proteus和Keil C的程序開發(fā) 計數(shù)顯示器和發(fā)光二極管的簡單應(yīng)用
基于ProteusKeilC的程序開發(fā)
驗證計數(shù)顯示器的如下功能:可統(tǒng)計按鈕BUT的按壓次數(shù),并將按壓結(jié)果以十進(jìn)制數(shù)形式顯示出來;當(dāng)顯示值達(dá)到99后可自動從1開始,無限循環(huán)。

驗證發(fā)光二極管的如下功能:仿真運行開始時,當(dāng)開關(guān)p3_2閉合時,按一下按鈕p3_4,流水燈全亮,再按一下按鈕,流水燈全滅,然后正式開始流水,從第一個二極管開始每當(dāng)按鈕BUT按壓一次,二極管就亮一次,且再次按壓按鈕時,下一個二極管亮一次,以此類推,循環(huán)往復(fù)。
簡單東西,入門學(xué)習(xí),不喜勿噴

單片機源程序如下:
  1. #include<reg51.h>
  2. #define uchar unsigned char
  3. sbit P3_4=P3^4;
  4. sbit P3_2=P3^2;
  5. bit ldelay=0;
  6. uchar t=0;

  7. unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66, 0x6d,0x7d,0x07,0x7f,0x6f};
  8. unsigned char count;
  9. void delay(unsigned int time){
  10.         unsigned int j=0;
  11.         for(;time>0;time--)
  12.                 for(j=0;j<125;j++);
  13.                 }

  14. void main(){
  15. uchar code ledp[10]={0x00,0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
  16. uchar ledi;
  17. TMOD=0x01;
  18. TH0=0x3c;
  19. TL0=0xb0;
  20. TR0=1;
  21. ET0=1;
  22. EA=1;
  23.   count=0;
  24.         P0=table[count/10];
  25.         P2=table[count%10];
  26.         while(1){
  27.                
  28.                 if(P3_4==0){
  29.                         delay(10);
  30.                         if(P3_4==0){
  31.                                 count++;
  32.                                 if(count==100)
  33.                                         count=0;
  34.                                 P0=table[count/10];
  35.                                 P2=table[count%10];
  36.                                 while(P3_4==0);}
  37.                         
  38.                         if(P3_2==0){
  39.                                                            
  40.                 if(ldelay) {
  41.                         ldelay=0;
  42.                         P1=ledp[ledi];
  43.                         delay(1000);
  44.                         ledi++;
  45.                         if(ledi==10) ledi=2;
  46.         }
  47.                         }
  48.         }
  49. }
  50. }

  51. timer0() interrupt 1{
  52.         t++;
  53. if(t==20) {t=0;ldelay=1;}
  54. TH0=0X3C;TL0=0xb0;
  55. }
復(fù)制代碼


2.png (71.59 KB, 下載次數(shù): 40)

2.png

1.png (69.77 KB, 下載次數(shù): 36)

1.png

51hei.png (6.86 KB, 下載次數(shù): 35)

51hei.png

計數(shù)顯示器與二極管.zip

132.1 KB, 下載次數(shù): 20, 下載積分: 黑幣 -5

簡單東西,不喜勿噴


作者: 可樂dior    時間: 2020-6-30 16:50
請問有proteus仿真文件嗎?我的顯示不全




歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1