315Mhz无线模块接收程序单片机解密
- 单片机解密# include<reg52.h>
- 单片机解密# define uint unsigned int
- 单片机解密# define uchar unsigned char
- sbit DATA=P3^2;
- sbit rs=P2^6; //1602引脚定义
- sbit rw=P2^5;
- sbit e=P2^7;
- uchar dat,num;
- uchar code table[]="0123456789ABCDEF";
- uchar code table1[]="Receive:"; //液晶固定部分显示
- uchar code table2[]="Re_data:0x";
- void write_data (uchar dat); //1602写数据
- void write_com (uchar com); //1602写命令
- unsigned char pow(unsigned char n,unsigned char m); //n的m次方函数
- uchar receive(void); //接收处理函数
- void gd(); //液晶固定部分显示
- void delay (uint xms) //1602延时
- {
- uint i,j;
- for (i = xms; i > 0; i--)
- for (j = 110; j > 0; j--);
- }
- void delay1(unsigned char t)//延时程序
- {
- unsigned char n;
- for(;t>0;t--)
- for(n=40;n>0;n--);
- }
- unsigned char pow(unsigned char n,unsigned char m)//n的m次方函数
- {
- unsigned char t,result=1;
- for(t=0;t<m;t++){result=n*result;}
- return result;
- }
- void init_1602()
- {
- e = 0; //1602初始化
- write_com (0x38);
- write_com (0x0c);
- write_com (0x06);
- write_com (0x01);
- gd();
- }
- /*1602液晶代码部分 ------------------------------ */
- void write_com (uchar com) //写命令
- {
- rs = 0;
- rw = 0;
- P0 = com;
- delay (5);
- e = 1;
- delay (5);
- e = 0;
- }
- void write_data (uchar dat) //写数据
- {
- rs = 1;
- rw = 0;
- P0 = dat;
- delay (5);
- e = 1;
- delay (5);
- e = 0;
- }

芯片解密