📄 copy of rf51.c
字号:
#include <reg51.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
uchar a _at_ 0x30;
uchar b _at_ 0x31;
uchar c _at_ 0x32;
uchar d _at_ 0x33;
uchar counth,countl,countt,temp,countfh,flaghe;
sbit rfin=P3^1;
sbit led=P1^1;
void init();
void getdata();
void main()
{
uchar m,n;
init();
while(1)
{
while(countt<33)
{
if(counth>=2 && counth<=3)
{
if(!flaghe && countl==0)
{
countfh=counth;
flaghe=1;
}
if(!flaghe && countl!=0)
{
break;
}
if(countfh==counth)
{
if(countl>=28 && countl<=30)
{
counth=0;
countl=0;
countt=0;
flaghe=0;
countfh=0;
getdata();
break;
}
}
else
{
break;
}
}
if(a==98)
{
led=0;
for(m=200;m>0;m--)
for(n=200;m>0;m--);
}
}
counth=0;
countl=0;
countt=0;
flaghe=0;
countfh=0;
}
}
void init()
{
P1=0xff;
P3=0xff;
flaghe=0;
countfh=0;
countfh=0;
countt=0;
temp=0;
TMOD=0x01;
TH0=(65536-100)/256;
TL0=(65536-100)%256;
IE=0x82;
TR0=1;
}
void getdata()
{
uchar countd,x;
countd=0;
x=0;
while(!rfin);
counth=0;
countl=0;
while(countd<32)
{
x++;
if(counth>=2 && counth<=3)
{
if(!flaghe && countl==0)
{
countfh=counth;
flaghe=1;
}
if(!flaghe && countl!=0)
{
break;
}
if(countfh==counth)
{
if(countl>7 && countl<=9)
{
temp=temp&0xfe;
counth=0;
countl=0;
countfh=0;
flaghe=0;
countd++;
while(!rfin);
}
}
else
{
break;
}
}
if(counth>7 && counth<=9)
{
if(!flaghe&& (countl==0))
{
countfh=counth;
flaghe=1;
}
if(countfh==counth)
{
if(countl>=2 && countl<=3)
{
temp=temp|0x01;
counth=0;
countl=0;
countfh=0;
flaghe=0;
countd++;
while(!rfin);
}
}
else
{
continue;
}
}
switch (countd)
{
case 7:a=temp;break;
case 15:b=temp;break;
case 23:c=temp;break;
case 31:d=temp;break;
}
temp<<=1;
if(x>9 && countl==0) continue;
}
}
void timer0() interrupt 1
{
TH0=(65536-100)/256;
TL0=(65536-100)%256;
countt++;
if(rfin)
counth++;
if(!rfin)
countl++;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -