- #include <reg51.h>
- #define uchar unsigned char
- #define uint unsigned int
- uchar data dis_buf[3];
- uint i,mb,rmb;
- uchar code distable[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
- sbit warn=P3^0;
- void delay() //延时函数
- { uint b;
- for(b=0;b<150;b++);
- }
- void display() //显示函数
- { uchar segcode,bitcode,i;
- bitcode=0x01;
- for(i=0;i<3;i++)
- { segcode=dis_buf[i];
- P1=distable[segcode];
- P2=bitcode;
- delay();
- P2=0x00; //关闭显示
- bitcode=bitcode<<1; //调整位码
- }
- }
复制代码 全部资料51hei下载地址:
脉搏计数.7z
(30.37 KB, 下载次数: 32)
|