12864红外遥控万年历单片机源代码IC解密
IC解密采用芯片:STC89C16RD+(只要大于22K以上的单片机都是可以的),红外接收采用了VS/HX1838,走时正常,改了下控制器的地址。单片机源程序如下:
- /*****************************************************************************************************************/
- //12864液晶万年历 时钟2010年最新 V8版本
- //增加了24C02接口,具有开机界面记忆功能、闹钟时间可以掉电保存功能
- //V8.0版本主要特点为三种风格界面显示,功能更强大
- /****************************************************************************************************************/
- //头文件
- #include <AT89X52.h>
- #include <string.h>
- #include <intrins.h> //包含_nop_()延时函数
- #ifndef uchar
- #define uchar unsigned char
- #endif
- #ifndef uint
- #define uint unsigned int
- #endif
- #include "SoundPlay.h"
- #include "ds1302.h"
- #include "ds18b20.h"
- #include "24c02.h"
- #include "lcd12864.h"
- #include "tl1838.h"
- /*****************************************************************************/
- //键盘引脚定义
- //sbit KEY_1 = P2^7; //左上,在音乐文件SoundPlay.h中已定义
- sbit KEY_2 = P2^6; //左下
- sbit KEY_3 = P2^5; //右上
- sbit KEY_4 = P2^4; //右下
- /****************************************************************************/
- //定义全局变量
- unsigned char yy,mo,dd,xq,hh,year,year1;//定义时间映射全局变量(专用寄存器)
- unsigned char shi,ge,sec_temp,min_temp,hour_temp,secl,selx,e=0,hh1,mm1,mm,ss,n,t;
- char xdata n1,n2;
- bit w = 0; //调时标志位
- uchar c_sun,year_sun,month_sun,day_sun; //农历
- /******************************************************************************/
- /*-- 一幅图像 KISS- 正向取模,字节正序*/
- /*-- 宽度x高度=128x64 --*/
- /******************************************************************************/
- uchar code powerOnPhoto []={
-
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xFF,0xFF,0xFF,0x9F,0x00,0x00,0x0F,0x0E,0x00,0x00,0x00,0x00,0x19,0xFF,0xFF,0xFF,
- …………限于本文篇幅 余下字库代码请从51黑下载附件…………
- uchar code powerOnPhoto1[]={ //此处为小东电子图片代码,可以更改为你喜欢的图片代码
- /*-- 调入了一幅图像:F:\小东电子.bmp --*/
- /*-- 宽度x高度=128x64 --*/
- //图片数字圆体
- //图片数字方体
- /******************************************************************************/
- {// 图片" "
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- };
- /******************************************************************************/
- //农历代码
- /*
- 公历年对应的农历数据,每年三字节,
- 格式第一字节BIT7-4 位表示闰月月份,值为0 为无闰月,BIT3-0 对应农历第1-4 月的大小
- 第二字节BIT7-0 对应农历第5-12 月大小,第三字节BIT7 表示农历第13 个月大小
- 月份对应的位为1 表示本农历月大(30 天),为0 表示小(29 天)
- 第三字节BIT6-5 表示春节的公历月份,BIT4-0 表示春节的公历日期
- */
- /******************************************************************************/
- code uchar year_code[] = {
- 0x0C,0x96,0x45, //2000
- …………限于本文篇幅 字库代码请从51黑下载附件…………
- 0x2d,0x92,0xB5, //2099
- };
- ///月份数据表
- code uchar day_code1[9]={0x0,0x1f,0x3b,0x5a,0x78,0x97,0xb5,0xd4,0xf3};
- code uint day_code2[3]={0x111,0x130,0x14e};
- /*
- 函数功能:输入BCD阳历数据,输出BCD阴历数据(只允许1901-2099年)
- 调用函数示例:Conversion(c_sun,year_sun,month_sun,day_sun)
- 如:计算2004年10月16日Conversion(0,0x4,0x10,0x16);
- c_sun,year_sun,month_sun,day_sun均为BCD数据,c_sun为世纪标志位,c_sun=0为21世
- 纪,c_sun=1为19世纪
- 调用函数后,原有数据不变,读c_moon,year_moon,month_moon,day_moon得出阴历BCD数据
- */
- bit c_moon;
- data uchar year_moon,month_moon,day_moon,week;
- /*子函数,用于读取数据表中农历月的大月或小月,如果该月为大返回1,为小返回0*/
- bit get_moon_day(uchar month_p,uint table_addr)
- {
- uchar temp;
- switch (month_p)
- {
- case 1:{temp=year_code[table_addr]&0x08;
- if (temp==0)return(0);else return(1);}
- case 2:{temp=year_code[table_addr]&0x04;
- if (temp==0)return(0);else return(1);}
- case 3:{temp=year_code[table_addr]&0x02;
- if (temp==0)return(0);else return(1);}
- case 4:{temp=year_code[table_addr]&0x01;
- if (temp==0)return(0);else return(1);}
- case 5:{temp=year_code[table_addr+1]&0x80;
- if (temp==0) return(0);else return(1);}
- case 6:{temp=year_code[table_addr+1]&0x40;
- if (temp==0)return(0);else return(1);}
- case 7:{temp=year_code[table_addr+1]&0x20;
- if (temp==0)return(0);else return(1);}
- case 8:{temp=year_code[table_addr+1]&0x10;
- if (temp==0)return(0);else return(1);}
- case 9:{temp=year_code[table_addr+1]&0x08;
- if (temp==0)return(0);else return(1);}
- case 10:{temp=year_code[table_addr+1]&0x04;
- if (temp==0)return(0);else return(1);}
- case 11:{temp=year_code[table_addr+1]&0x02;
- if (temp==0)return(0);else return(1);}
- case 12:{temp=year_code[table_addr+1]&0x01;
- if (temp==0)return(0);else return(1);}
- case 13:{temp=year_code[table_addr+2]&0x80;
- if (temp==0)return(0);else return(1);}
- }
- }
- /*
- 函数功能:输入BCD阳历数据,输出BCD阴历数据(只允许1901-2099年)
- 调用函数示例:Conversion(c_sun,year_sun,month_sun,day_sun)
- 如:计算2004年10月16日Conversion(0,0x4,0x10,0x16);
- c_sun,year_sun,month_sun,day_sun均为BCD数据,c_sun为世纪标志位,c_sun=0为21世
- 纪,c_sun=1为19世纪
- 调用函数后,原有数据不变,读c_moon,year_moon,month_moon,day_moon得出阴历BCD数据
- */
- void Conversion(bit c,uchar year,uchar month,uchar day)
- { //c=0 为21世纪,c=1 为19世纪 输入输出数据均为BCD数据
- uchar temp1,temp2,temp3,month_p;
- uint temp4,table_addr;
- bit flag2,flag_y;
- temp1=year/16; //BCD->hex 先把数据转换为十六进制
- temp2=year%16;
- year=temp1*10+temp2;
- temp1=month/16;
- temp2=month%16;
- month=temp1*10+temp2;
- temp1=day/16;
- temp2=day%16;
- day=temp1*10+temp2;
- //定位数据表地址
- if(c==0)
- {
- table_addr=(year)*0x3;
- }

芯片解密