91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

簡單的485總線通信,1個主機和3個從機(我認為不要主機也可以)通信,帶正確Proteus仿真。實現三個房間的照明燈三聯控功能

資源截圖

代碼片段和文件信息

#include?
unsigned?char?data1=0xffaddressflag;
sbit?key1=P0^0;
sbit?key2=P0^1;
sbit?key3=P0^2;
sbit?led1=P1^0;
sbit?led2=P1^1;
sbit?led3=P1^2;
sbit?rd=P2^0;
sbit?zhishi1=P2^6;
sbit?zhishi2=P2^7;
void?delay(unsigned?int?i)
{
while(i--);
}
void?chuankou_init()
{
TMOD=0x20;//定時器1工作在方式2,8位自動重裝定時器作串口波特率發生器
PCON=0x70;//設置SMOD為0
TH1=TL1=0xF9;//裝初值,波特率為4800
TR1=1; //啟動定時器
SCON=0Xd0;//設置串口工作在方式3,REN=1,允許接收
IE=0X90;//允許串口中斷,不允許定時器溢出
SM2=1; //使能多機通信

}
void?main()
{
chuankou_init();
rd=0;//接收模式
while(1)
{

if(P0!=0xff)
{ delay(500);
if(P0!=0xff)
{ rd=1;//發送模式
delay(1000);
if(!key1)
{led1=!led1;data1=0x11;}
else?if(!key2)
{led2=!led2;data1=0x12;}
else?if(!key3)
{led3=!led3;data1=0x13;}
ES=0;
TB8=1;
SBUF=0x01;
while(!TI);
TI=0;
TB8=0;
SBUF=data1;
while(!TI);
TI=0;
ES=1;
rd=0;//還原為接收模式
}
while(P0!=0xff);

}

if(flag)
{
if(data1==0x11)
led1=!led1;
else?if(data1==0x12)
led2=!led2;
if(data1==0x13)
led3=!led3;
flag=0;
}


}
}

void?chuankou_zhongduan()?interrupt?4
{
if(RI)
{
if(SM2)
{
address=SBUF;
switch(address)
{
case?0x01:zhishi1=0;zhishi2=1;SM2=0;break;
case?0x02:zhishi1=1;zhishi2=0;break;
case?0x03:zhishi1=1;zhishi2=1;break;
default:break;
}
}
else
{
data1=SBUF;
flag=1;
SM2=1;
}
RI=0;
}
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????49152??2010-05-21?21:16??機機485總線通信\程序代碼.doc

?????文件???????1893??2010-06-05?16:04??機機485總線通信\單片機通信.PWI

?????文件?????102827??2010-05-22?20:06??機機485總線通信\Last?Loaded?單片機通信.DBK

?????文件?????102827??2010-05-22?20:06??機機485總線通信\單片機通信.DSN

?????文件?????119776??2010-05-22?23:00??機機485總線通信\Last?Loaded?單片機485總線通信.DBK

?????文件?????119776??2010-05-22?23:00??機機485總線通信\單片機485總線通信.DSN

?????文件???????1893??2010-05-22?23:00??機機485總線通信\單片機485總線通信.PWI

?????文件????????194??2010-05-22?15:45??機機485總線通信\雙向通信_收發程序一致\fasong.plg

?????文件???????1580??2010-05-22?15:24??機機485總線通信\雙向通信_收發程序一致\fasong.c

?????文件???????7215??2010-05-22?15:39??機機485總線通信\雙向通信_收發程序一致\fasong.M51

?????文件???????1105??2010-05-22?15:39??機機485總線通信\雙向通信_收發程序一致\fasong.hex

?????文件???????5722??2010-05-22?15:39??機機485總線通信\雙向通信_收發程序一致\fasong.LST

?????文件???????5156??2010-05-22?15:39??機機485總線通信\雙向通信_收發程序一致\fasong.OBJ

?????文件???????4690??2010-05-22?15:39??機機485總線通信\雙向通信_收發程序一致\fasong

?????文件???????1958??2010-05-22?14:18??機機485總線通信\雙向通信_收發程序一致\fasong_Uv2.Bak

?????文件???????1996??2010-05-22?15:44??機機485總線通信\雙向通信_收發程序一致\fasong.Uv2

?????文件???????1229??2010-05-22?15:44??機機485總線通信\雙向通信_收發程序一致\fasong_Opt.Bak

?????文件???????1236??2010-05-22?15:45??機機485總線通信\雙向通信_收發程序一致\fasong.Opt

?????文件???????5022??2010-05-22?23:00??機機485總線通信\congji3\congji3.plg

?????文件???????1717??2010-05-22?22:59??機機485總線通信\congji3\congji3.c

?????文件???????7489??2010-05-22?22:59??機機485總線通信\congji3\congji3.M51

?????文件???????1111??2010-05-22?22:59??機機485總線通信\congji3\congji3.hex

?????文件??????????0??2010-05-22?16:39??機機485總線通信\congji3\congji3_Uv2.Bak

?????文件???????1999??2010-05-22?16:47??機機485總線通信\congji3\congji3.Uv2

?????文件???????6207??2010-05-22?22:59??機機485總線通信\congji3\congji3.LST

?????文件???????5067??2010-05-22?22:59??機機485總線通信\congji3\congji3.OBJ

?????文件???????4686??2010-05-22?22:59??機機485總線通信\congji3\congji3

?????文件???????1021??2010-05-22?20:09??機機485總線通信\congji3\congji3_Opt.Bak

?????文件???????1023??2010-05-22?23:00??機機485總線通信\congji3\congji3.Opt

?????文件???????4291??2010-05-22?23:00??機機485總線通信\congji1\congji1.plg

............此處省略68個文件信息

評論

共有 條評論