基于单片机双机通信仿真系统设计

1494下载地址 https://docs.qq.com/doc/DWEpnR2pOWU91b3p4?pub=1&dver=2.1.0

 

#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar tab[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0X88,0x83,0xC6,0xA1,0x86,0x8E};
uchar a,b;
sbit P20=P2^0;
void delayms(uint ms)
{
uint i;
while(ms--)
{
for(i=0;i<120;i++);
}
}
void int1() interrupt 2
{
delayms(10);
if(INT1==0)
{
a++;
if(a==9)
{a=0;}
}
}
void disp(void)
{
P2=0X01;
P0=tab[b/10];
delayms(1);
P2=0x02;
P0=tab[b%10];
delayms(1);
}
void send(uchar state)
{
SBUF=state;

 

 

  

 

posted @ 2021-03-15 17:27  roadroad  阅读(128)  评论(0编辑  收藏  举报
电设屋
上千套电子毕设课设方案