標(biāo)題: 單片機(jī)脈搏計(jì)數(shù)器Proteus仿真程序 [打印本頁(yè)]

作者: 321586884    時(shí)間: 2020-2-8 13:49
標(biāo)題: 單片機(jī)脈搏計(jì)數(shù)器Proteus仿真程序

  1. #include <reg51.h>
  2. #define uchar unsigned char
  3. #define uint unsigned int
  4. uchar data dis_buf[3];
  5. uint i,mb,rmb;
  6. uchar code distable[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
  7. sbit warn=P3^0;
  8. void delay()  //延時(shí)函數(shù)
  9. {         uint b;
  10.         for(b=0;b<150;b++);
  11. }        
  12. void display()                                   //顯示函數(shù)
  13. {         uchar segcode,bitcode,i;                  
  14.                  bitcode=0x01;
  15.                 for(i=0;i<3;i++)
  16.                 {        segcode=dis_buf[i];
  17.                         P1=distable[segcode];
  18.                         P2=bitcode;
  19.                         delay();
  20.                         P2=0x00;                        //關(guān)閉顯示
  21.                         bitcode=bitcode<<1;           //調(diào)整位碼        
  22.                 }

  23. }                 
復(fù)制代碼
全部資料51hei下載地址:
脈搏計(jì)數(shù).7z (30.37 KB, 下載次數(shù): 32)







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