#include
#include
#include
#include"./uart/uart.h"
#include"./delay/delay.h"
#include"1602.h"
sbit IR_IN = P3^2;
sbit LED0 = P1^0;
sbit LED1 = P1^1;
sbit LED2 = P1^2;
sbit LED3 = P1^3;
sbit LED4 = P1^4;
sbit LED5 = P1^5;
sbit LED6 = P1^6;
sbit LED7 = P1^7;
unsigned int irtime;
bit irok = 0;
bit chang_ok = 0;
bit startflag = 0;
unsigned char irdata[33];
unsigned char sbuf[5];
unsigned char bitnum = 0;
unsigned char str[35];
unsigned char buf[4];
unsigned char handle_ok = 0;
void int0_init()
{
IT0 = 1; //设置外部中断的触发方式
EA = 1;
EX0 = 1;
}
void timer0_init()
{
EA = 1;
TMOD |= 0x02;
TH0 = 0;
ET0 = 1;
TR0 = 1;
}
void timer0_isr() interrupt 1
{
irtime++;//0.256ms 引导码 13.5/0.256 = 52 1.12/0.256 = 4 0.56+1.685/0.256 = 8
}
/*void chang_num()
{
unsigned char i;
str[0] = irdata[0] / 10 + '0';
str[1] = irdata[0] % 10 + '0';
for(i = 0; i < 32; i++)
{
str[i + 2] = irdata[i + 1] + '0';
if(str[i + 2] <= (6 +'0'))
{
str[i + 2] = 0 + '0';
}
else
{
str[i + 2] = 1 + '0';
}
}
str[34] = '