|
當(dāng)發(fā)送機(jī)按鍵按下后,接收機(jī)LED燈被點(diǎn)亮
51hei圖片_20210201164155.png (39.33 KB, 下載次數(shù): 77)
下載附件
2021-2-1 16:42 上傳
51hei圖片_20210201164147.png (38.98 KB, 下載次數(shù): 83)
下載附件
2021-2-1 16:42 上傳
單片機(jī)源程序如下:
- #include <reg52.h>
- #define uint unsigned int
- #define uchar unsigned char
- uchar state;
- void receive()
- {
- while(RI==0);
- state=SBUF;
- RI=0;
- }
- void SCON_Init()
- {
- TMOD=0x20;
- SCON=0x50;
- PCON=0x00;
- TH1=0xfd;
- TL1=0xfd;
- TR1=1;
- REN=1;
- }
- void main()
- {
- P1=0xff;
- SCON_Init();
-
- while(1)
- {
- receive();
- P1=state;
-
- }
- }
復(fù)制代碼
所有資料51hei提供下載:
串口通信 -3.rar
(93.07 KB, 下載次數(shù): 57)
2021-2-1 16:46 上傳
點(diǎn)擊文件名下載附件
按鍵串口通信點(diǎn)亮LED燈 下載積分: 黑幣 -5
|
|