老師幫忙修改過的多機通信
部分代碼:
#include <reg51.h>
#include <math.h>
sbit switch1=P0^0;
sbit switch2=P0^1;
sbit switch3=P0^2;
void delay_ms(unsigned int i)
{
unsigned char j;
for(;i>0;i--)
for(j=0;j<125;j++);
}
void main()
{
EA=1;
TMOD=0x20;
TL1=0xfd;
TH1=0xfd;
PCON=0x00;
SCON=0xd0;
TR1=1;
ES=1;
SBUF=0xff;
while(TI==0);
TI=0;
while(1)
{
delay_ms(100);
if(switch1==0)
{
TB8=1;
SBUF=0x01;
while(TI==0);
TI=0;
TB8=0;
SBUF=0x00;
while(TI==0);
TI=0;
}
全部資料51hei下載地址:
zeg多機通信項目.rar
(133.68 KB, 下載次數: 61)
2018-5-27 13:55 上傳
點擊文件名下載附件
|