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

標題: 結合keil制作proteus 8.9的999數碼管程序 [打印本頁]

作者: zhj_ni    時間: 2020-11-13 15:22
標題: 結合keil制作proteus 8.9的999數碼管程序
這是根據上課師傅講的結合keil制作proteus 8.9的999數碼管

  1. #include <reg51.h>
  2. #include <intrins.h>
  3. #define uint unsigned int
  4. #define uchar unsigned char
  5. #define out2 P2
  6. #define out1 P1
  7. #define out0 P0
  8. //延時函數
  9. void delay(uint xms)
  10. {
  11.         uint i,j,k;
  12.         for(i=xms;i>0;i--)
  13.         {
  14.                 for(j=50;j>0;j--);
  15.                 for(k=50;k>0;k--);
  16.         }

  17. }
  18. //定義P1,p2端口
  19. uchar code seg2[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
  20. uchar code seg1[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
  21. uchar code seg0[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
  22. //main函數
  23. void main(void)
  24. {
  25.         //讓秒的個位開始計數
  26.         uchar i,j,k;
  27.         i=0;
  28.         j=1;
  29.         k=0;
  30.         out1=seg1[0];                //讓秒的十位從0開始亮
  31.         out0=seg0[0];                //讓秒的百位從0開始亮

  32.         while(1)
  33.         {
  34.                
  35.                 out2=seg2[i];
  36.                 delay(500);
  37.                 i++;
  38.                 //讓秒的十位開始計數
  39.                 if(i%10==0&i>9)
  40.                 {
  41.                         out1=seg1[j];
  42.                         i=0;
  43.                         j++;
  44.                 }
  45.                 if(j%11==0&j>9)
  46.                 {
  47.                         k++;
  48.                         out0=seg0[k];
  49.                         j=1;
  50.                 }
  51.         
  52.         }
  53. }
復制代碼

制作的999數碼管
全部資料51hei下載地址:
999.zip (72.36 KB, 下載次數: 14)





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