凇聆

    1. 接受-- #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); } } }
    2. 发射--- #include    static bit OP;       static unsigned int count;      static unsigned int endcount; static unsigned char Flag;      char iraddr1; char iraddr2; void SendIRdata(char p_irdata); void delay(); char getkey() {    P1=0xfe;P3_6=P3_7=1;P3_3=1; if(!P1_4)return 1;   if(!P1_5)return 2;    if(!P1_6)return 3;   if(!P1_7)return 4;   if(!P3_6)return 5; if(!P3_7)return 6;    P1=0xfd; if(!P1_4)return 11;   if(!P1_5)return 12;   if(!P1_6)return 13;   if(!P1_7)return 14;   if(!P3_6)return 15; if(!P3_7)return 16;    P1=0xfb;   if(!P1_4)return 21; if(!P1_5)return 22;    if(!P1_6)return 23;    if(!P1_7)return 24; if(!P3_6)return 25; if(!P3_7)return 26;    P1=0xf7; if(!P1_4)return 31; if(!P1_5)return 32;    if(!P1_6)return 33;    if(!P1_7)return 34; if(!P3_6)return 35; if(!P3_7)return 36;    P1=0xfF;P3_3=0; if(!P1_4)return 41; if(!P1_5)return 42;    if(!P1_6)return 43;    if(!P1_7)return 44; if(!P3_6)return 45; if(!P3_7)return 46;       return 0; } void main(void) { char key;   count = 0;   Flag = 0;   OP = 0;    P3_4 = 1; EA = 1;   TMOD = 0x11;     ET0 = 1;   P1=0xff;    TH0 = 0xFF;   TL0 = 0xE6; TR0 = 1; iraddr1=0xff;   iraddr2=0xff; do{   key=getkey();    if(key==1)SendIRdata(0x12);       if(key==11)SendIRdata(0x0b);       if(key==25||key==35)SendIRdata(0x1a);       if(key==15)SendIRdata(0x1e);       if(key==6)SendIRdata(0x0e);       if(key==16)SendIRdata(0x1d); if(key==26)SendIRdata(0x1f);   if(key==36)SendIRdata(0x1b);    if(key==32)SendIRdata(0x00);       if(key==22)SendIRdata(0x01);        if(key==23)SendIRdata(0x02); if(key==24)SendIRdata(0x03);        if(key==12)SendIRdata(0x04);      if(key==13)SendIRdata(0x05);      if(key==14)SendIRdata(0x06);      if(key==2)SendIRdata(0x07);       if(key==3)SendIRdata(0x08); if(key==4)SendIRdata(0x09);     if(key==21)SendIRdata(0x2A);      if(key==5)SendIRdata(0x2B);      if(key==33)SendIRdata(0x2C);        if(key==34)SendIRdata(0x2D);       if(key==31)SendIRdata(0x2E);                         if(key==41)SendIRdata(0x2F);     if(key==42)SendIRdata(0x30);      if(key==43)SendIRdata(0x31);      if(key==44)SendIRdata(0x32);        if(key==45)SendIRdata(0x33);       if(key==46)SendIRdata(0x34);    }while(1); } void timeint(void) interrupt 1 {   TH0=0xFF;   TL0=0xE6;   count++; }    void SendIRdata(char P_irdata) {          int i;          char irdata=P_irdata;          endcount=223;          Flag=1;          count=0;          P3_4=0;          do{}while(count
    3. wangfengyun123 发表于 2016-4-16 16:22 有没有 仿真软件  可以给一个安装包吗?
      留个邮箱我发给你
    4. bule 发表于 2016-4-16 12:42 楼主想要实现什么功能?要把具体问题说一下
      无线收发系统   这是接受模块

最近访客

< 1/1 >

统计信息

已有2人来访过

  • 芯积分:3
  • 好友:--
  • 主题:2
  • 回复:4

留言

你需要登录后才可以留言 登录 | 注册


现在还没有留言