📄 send2.c
字号:
#include <AT89x051.H>
unsigned char htx;
unsigned char curtxd;
unsigned char modebuf[2];
unsigned char count;
int i;
int j;
main()
{
P3_4=0;
P3_4=1; //喂狗
P3_1=1;
P3_3=1;
for(j=0;j<=20;j++)
{
for( i=0;i<10000;i++)
{
P3_4=0;
P3_4=1;
}
}
//数据线空闲
EA=1;
EX0=1;
IT0=1;
count=0;
while(1)
{
for(j=0;j<=25;j++)
{
for( i=0;i<10000;i++)
{
P3_4=0;
P3_4=1;
}
}
modebuf[0]=0;
modebuf[1]=0xee;
count=2;
for(j=0;j<=25;j++)
{
for( i=0;i<10000;i++)
{
P3_4=0;
P3_4=1;
}
}
modebuf[0]=0;
modebuf[1]=0xdd;
count=2;
for(j=0;j<=25;j++)
{
for( i=0;i<10000;i++)
{
P3_4=0;
P3_4=1;
}
}
modebuf[0]=0;
modebuf[1]=0xbb;
count=2;
for(j=0;j<=25;j++)
{
for( i=0;i<10000;i++)
{
P3_4=0;
P3_4=1;
}
}
modebuf[0]=0;
modebuf[1]=0x77;
count=2;
}
//数据线空闲
while(1)
{
P3_4=0;
P3_4=1;
}
}
initexint4() interrupt 0
{
if(htx==0)
{
if(count==0)
{
P3_1=1;
return;
}
else
{
P3_1=0;
htx++;
curtxd=modebuf[2-count];
}
}
else
{
if(htx==9)
{
P3_1=1;
htx=0;
count--;
return;
}
if((curtxd&0x80)==0x80) P3_1=1;
else
P3_1=0;
curtxd=curtxd<<1;
htx++;
}
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -