基于单片机数码管脉搏测量系统设计
1484下载地址 https://docs.qq.com/doc/DWEpnR2pOWU91b3p4?pub=1&dver=2.1.0
#include <reg52.h> #include <intrins.h> #define uchar unsigned char #define uint unsigned int //共阳极数码管段码 uchar code SEG7[]={/*0,1,2,3,4,5,6,7,8,9,*/0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,}; uchar sx=60; //显示时间 uint hz=0;//脉搏 uchar run;//开始 uchar bz;//报警标志 //计数变量 uchar num1; uchar num2; uchar num3; //数码管位码端口 sbit P20=P2^0; sbit P21=P2^1; sbit P22=P2^2; sbit P23=P2^3; sbit P24=P2^4; sbit P25=P2^5; //开始停止----------------------- sbit P26=P2^6; sbit P27=P2^7; //报警----------------------- sbit P10=P1^0; sbit P11=P1^1; //延时函数ms void delayms(uint t) { uint i,j; for(i=0;i<t;i++) for(j=0;j<120;j++); } //数码管显示