📄 read.c
字号:
#include <AT89x051.H>
void be0();
void be1();
unsigned char a;
unsigned char i;
unsigned char senddata;
unsigned char recedata;
int m,n;
main()
{
SP=0x60;
ACC=0;
for(m=0;m<5;m++)
for(n=0;n<10000;n++)
{P3_1=0;
P3_1=1;
if(m==n)
{
m++;
}
}
senddata=0xf6;
for(i=0;i<8;i++)
{
be0();
if((senddata&0x80)==0x80)
P1_7=1;
else
P1_7=0;
be0();
be1();
senddata=senddata<<1;
}
senddata=0x5f;
for(i=0;i<8;i++)
{
be0();
if((senddata&0x80)==0x80)
P1_7=1;
else
P1_7=0;
be0();
be1();
senddata=senddata<<1;
}
be0();
for(m=0;m<5;m++)
for(n=0;n<10000;n++)
{P3_1=0;
P3_1=1;
}
senddata=0xf4;
for(i=0;i<7;i++)
{
be0();
if((senddata&0x80)==0x80)
P1_7=1;
else
P1_7=0;
be0();
be1();
senddata=senddata<<1;
}
be0();
be0();
P1_7=1;
recedata=0;
P3_1=0;
P3_1=1;
for(i=0;i<8;i++)
{
recedata=recedata<<1;
be1();
be0();
if(P1_7==1)
recedata++;
}
if((recedata&0x40)==0x40)
P3_3=0;
else
P3_3=1;
if((recedata&0x20)==0x20)
P3_4=0;
else
P3_4=1;
if((recedata&0x10)==0x10)
P3_5=0;
else
P3_5=1;
if((recedata&0x08)==0x08)
P1_0=0;
else
P1_0=1;
if((recedata&0x04)==0x04)
P1_1=0;
else
P1_1=1;
if((recedata&0x02)==0x02)
P1_2=0;
else
P1_2=1;
if((recedata&0x01)==0x01)
P1_3=0;
else
P1_3=1;
while(1)
{
P3_1=0;
P3_1=1;
}
}
void be0()
{
P1_6=0;
for(a=0;a<100;a++)
{
P3_1=0;
P3_1=1;
}
}
void be1()
{
P1_6=1;
for(a=0;a<100;a++)
{
P3_1=0;
P3_1=1;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -