找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1237|回复: 1
收起左侧

51单片机医院呼叫系统 求帮助

[复制链接]
ID:430450 发表于 2019-5-19 16:21 来自手机 | 显示全部楼层 |阅读模式
5黑币
为啥我lcd1602显示不了,或者有没有大佬帮我改一改程序,用的是2262和2272,315m无线发射接收模块#include<reg52.h>#include<intrins.h>sbit k0=P2^2;sbit k1=P2^3;sbit k2=P2^1;sbit k3=P2^0;sbit k4=P2^4;sbit k5=P2^5;sbit buzz=P1^3;bit key0=1;bit key1=1;bit key2=1;bit key3=1;bit key4=1;bit a1=0;bit a2=0;bit a3=0;extern void Initlcd1602();extern void Lcdshowstr(unsigned char x,unsigned char y,unsigned char*stc);extern unsigned char IntToString(unsigned char*str,int dat);extern void LcdFullClear();unsigned char T0RH=0,T0RL=0;void timer0(unsigned int ms);void ANJIAN();void YOUXIANJI();void delay1s(void){        unsigned char a,b,c;        for(c=167;c>0;c--)        for(b=171;b>0;b--) for(a=16;a>0;a--);        _nop_(); }void main(){        Initlcd1602();        Lcdshowstr(0,0,"Get Better Every Day!");        timer0(1);        EA=1;                while(1)        {                ANJIAN();                YOUXIANJI();        }}void YOUXIANJI(){        if(a1)        {                Lcdshowstr(3,1,"Calling!!!");                Lcdshowstr(7,0,"#1");        }        else if(a2)        {                Lcdshowstr(3,1,"Calling!!!");                Lcdshowstr(7,0,"#2");        }        else if(a3)        {                Lcdshowstr(3,1,"Calling!!!");                Lcdshowstr(7,0,"#3");        }}void CHULI(){        if(a1)        {                a1=0;                buzz=1;        }        else if(a2)        {                a2=0;                buzz=1;        }        else if(a3)        {                a3=0;                buzz=1;        }        if((a1==0)&&(a2==0)&&(a3==0))        {                LcdFullClear();                Lcdshowstr(4,1,"I Know!");                delay1s();                LcdFullClear();                Lcdshowstr(0,0,"Get Better Every Day!");        }}void FUWEI(){        buzz=1;        a1=0;        a2=0;        a3=0;        LcdFullClear();        Lcdshowstr(4,1,"I Know!");        delay1s();        LcdFullClear();        Lcdshowstr(0,0,"Get Better Every Day!");}void ANJIAN(){        static bit keya=1;        static bit keyf=1;        static bit keyy=1;        static bit keyk=1;        static bit keyn=1;                if(key0!=keya)        {                if(keya==0)                {                        LcdFullClear();                        a1=1;                        buzz=0;                }                keya=key0;        }        if(key1!=keyf)        {                if(keyf==0)                {                        LcdFullClear();                        a2=1;                        buzz=0;                }                keyf=key1;        }        if(key2!=keyy)        {                if(keyy==0)                {                        LcdFullClear();                        a3=1;                        buzz=0;                }                keyy=key2;        }        if(key3!=keyk)        {                if(keyk==0)                {                        FUWEI();                }                keyk=key3;        }        if(key4!=keyn)        {                if(keyn==0)                {                        CHULI();                }                keyn=key4;        }}void timer0(unsigned int ms){        unsigned long tmp;        TMOD&=0xF0;        TMOD|=0x01;        tmp=11095200/12;        tmp=(tmp*ms)/1000;        tmp=65536-tmp;        tmp=tmp+18;                T0RH=(unsigned char)(tmp>>8);        T0RL=(unsigned char)tmp;        TH0=T0RH;        TL0=T0RL;                ET0=1;        TR0=1;}void keycount(){        static unsigned char keybua=0xff;        static unsigned char keybuf=0xff;        static unsigned char keybuy=0xff;        static unsigned char keybuk=0xff;        static unsigned char keybun=0xff;  keybua=(keybua<<1)|k0;        keybuf=(keybuf<<1)|k1;        keybuy=(keybuy<<1)|k2;        keybuk=(keybuk<<1)|k3;        keybun=(keybun<<1)|k4;  if(keybua==0x00)        {                key0=0;        }        else if(keybua==0xff)        {                key0=1;        }        if(keybuf=0x00)        {                key1=0;        }        else if(keybuf==0xff)        {                key1=1;        }        if(keybuy==0x00)        {                key2=0;        }        else if(keybuy==0xff)        {                key2=1;        }        if(keybuk==0x00)        {                key3=0;        }        else if(keybuk=0xff)        {                key3=1;        }        if(keybun==0x00)        {                key4=0;        }        else if(keybun==0xff)        {                key4=1;        }}void interrupttimer0() interrupt 1{        TH0=T0RH;        TL0=T0RL;        keycount();}

Screenshot_2019-05-19-15-56-06-406_com.tencent.mm.png
Screenshot_2019-05-19-15-55-52-451_com.tencent.mm.png
回复

使用道具 举报

ID:549583 发表于 2020-4-2 12:07 | 显示全部楼层
楼主的原理图可以给我一份嘛
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表