標題:
分享單片機雙向通信時檢測用的最小程序
[打印本頁]
作者:
yuyue0476
時間:
2022-9-24 11:16
標題:
分享單片機雙向通信時檢測用的最小程序
#include<reg52.h>
sbit k1=P1^7;
sbit led1=P1^0;
void main()
{
SCON=0x50;
TMOD=0x20;
PCON=0x00;
TH1=0xfd;
TL1=0xfd;
TI=RI=0;
TR1=1;
IE=0x90;
while(1)
{
if(k1==0)
{
while(k1==0);
TI=0;
SBUF='A';
while(TI==0);
TI=0;
}
}
}
void ES_INT() interrupt 4
{
if(RI)
{
RI=0;
switch(SBUF)
case 'A': led1=~led1;
}
}
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1