接受--
#include
#include
#include
#include
#include"stdlib.h"
#include"string.h"
#define JINGZHEN 48
#define TIME0TH ((65536-100*JINGZHEN/12)&0Xff)>>8
#define TIME0TL ((65536-100*JINGZHEN/12)&0xff)
#define TIME1TH ((65536-5000*JINGZHEN/12)&0xff00)>>8
#define TIME1TL ((65536-5000*JINGZHEN/12)&0xff)
#define uchar unsigned char
#define uint unsigned int
#define BUSY 0x80
#define DATAPORT P0
sbit light=P1^3;
sbit LCM_RS=P2^0;
sbit LCM_RW=P2^1;
sbit LCM_EN=P2^2;
void delay_LCM(uint);
void lcd_wait(void);
void WriteCommandLCM(uchar WCLCM,uchar BusyC);
void WriteDataLCM(uchar WDLCM);
void DisplayOneChar(uchar X,uchar Y,uchar DData);
void initLCM(void);
void DisplayListChar(uchar X,uchar Y,unsigned char *DData);
void delay_LCM(uint k)
{
uint i,j;
for(i=0;i500) IrCount=0;
if(IrCount>300&&IrStart>0)
{IrStart=0;IrDatCount=0;IrDat[0]=IrDat[1]=IrDat[2]=IrDat[3]=0;IrCount=0;}
if(IrStart==2)
{
IrStart=3;
for(i=0;i114&&IrCount0)IrDatCount++;
}
IrCount=0;TH0 = TIME0TH;TL0 = TIME0TL;
EA=1;
} main()
{
uchar *a,n;
TMOD |= 0x011;
TH0 = TIME0TH;
TL0 = TIME0TL;
ET0=1;
TR0=1;
ET1=1;
TR1=1;
IT0 = 1;
EX0 = 1;
initLCM();
EA=1;
for(;;)
{
if(Show==1)
{
Show=0;
Cont=0;
DisplayListChar(0,1,"Please keys");
a="";
switch(IrDat[3])
{
case 0x12://ON/C
a="ON/C";
break;
case 0x0b://+/-
a="+/-";
break;
case 0x1a://+
a="+";
break;
case 0x1e://-
a="-";
break;
case 0x0e://+
a="/";
break;
case 0x1d://MRC
a="MRC";
break;
case 0x1f://M-
a="M-";
break;
case 0x1b://M+
a="M+";
break;
case 0x00://0
if(IrDat[2]==0xff)a="0";
break;
case 0x01://1
a="1";
break;
case 0x02://2
a="2";
break;
case 0x03://3
a="3";
break;
case 0x04://4
a="4";
break;
case 0x05://5
a="5";
break;
case 0x06://6
a="6";
break;
case 0x07://7
a="7";
break;
case 0x08://8
a="8";
break;
case 0x09://9
a="9";
break;
case 0x2A://%
a="%";
break;
case 0x2B://X
a="X";
break;
case 0x2C://.
a=".";
break;
case 0x2D://=
a="=";
break;
case 0x2E://
a=" ";
break;
}
n=strlen(a);
if(n>0) sprintf(s,"Key is [%s]",a);
else sprintf(s,"Not Key",a);
DisplayListChar(0,0,s);
}
}
}