基于51单片机病床呼叫系统
(仿真+程序+设计报告)
功能介绍
具体功能:
1.由3*8的矩阵键盘设置24个按键,代表8个房间,每个房间3位病床,共24位病床。
2.按下按键会进行呼叫,产生声光报警并且在数码管显示房间和病床号。
3.医护人员听到呼叫进行处理。
4.当有多人呼叫时,先呼叫的优先处理。
演示视频:
基于51单片机病床呼叫系统—数码管显示
#include <reg52.h>
#include "key.h"
#include "delay.h"
#define uint unsigned int
#define uchar unsigned char
sbit key1=P3^0;
uint code shu[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; //共阳极段码
uint code wei[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; //位选
uchar mm,ss,pp;
void Timer0Init(void) //定时器初始化
{
TMOD=0x01;
TH0=(65536-18000)/256;
TL0=(65536-18000)%256;
TR0=1;
ET0=1;
EA=1;
}
void main()
{
uchar tt,i,j,aa=1;
uchar num[30];
P0=0x00;
P2=0x00;
Timer0Init();
while(1)
{
tt = keynum();
if(tt!=num[i]&&tt!=0)
{
num[++i] = tt;
}
if(key1==0)
{
DelayMS(1);
if(key1==0)
{
while(!key1);
aa++;
ss=0;
mm=0;
beep=0;
led=0;
}
}
if(num[aa]!=0)
{
TR0=1;
P2 = wei[7];
P0 = shu[num[aa]/10];
DelayMS(1);
P2 = wei[5];
P0 = shu[num[aa]%10];
DelayMS(1);
P2 = wei[2];
P0 = shu[ss/10];
DelayMS(1);
P2 = wei[3];
P0 = shu[ss%10];
DelayMS(1);
P2 = wei[0];
P0 = shu[mm/10];
DelayMS(1);
P2 = wei[1];
P0 = shu[mm%10];
beep=1;
led=1;
if(ss==60)
{
ss=0;
mm++;
}
}
else
{
P2=0x00;
ss=0;
aa=1;
for(j=0;j<i+1;j++)
num[j]=0;
i=0;
TR0=0;
}
}
}
void T0_time() interrupt 1
{
TR0=0;
TH0=(65536-18000)/256;
TL0=(65536-18000)%256;
pp++;
if(pp==40) {ss++;pp=0;}
TR0=1;
}
硬件设计
使用元器件:
单片机:AT89C52;
(注意:单片机是通用的,无论51还是52、无论stc还是at都一样,引脚功能都一样。程序也是一样的。)
流程图:
设计资料
01 仿真图
本设计使用proteus8.9版本设计,没有软件在本公众号获取,无需担心!具体如图!
呼叫报警
医护人员处理
02 程序
本设计使用软件keil4和keil5两个版本编程设计,无需担心!具体如图!
03 设计报告
两千字设计报告,具体如下!
04 设计资料
资料获取请关注同名公众号,全部资料包括仿真源文件 、程序(含注释)、设计报告、流程图、演示视频等。具体内容如下,全网最全! !
资料获取请观看前面演示视频!
点赞分享一起学习成长。