0x04,0xB6,0x4A,0x69,0x57,0x3d,0x0A,0x4e,0x51, 2024-2026
0x0d,0x26,0x46,0x5e,0x93,0x3A,0x0d,0x53,0x4d, 2027-2029
0x05,0xAA,0x43,0x36,0xB5,0x37,0x09,0x6d,0x4B, 2030-2032
0xB4,0xAe,0xBf,0x04,0xAd,0x53,0x0A,0x4d,0x48, 2033-2035
0x6d,0x25,0xBC,0x0d,0x25,0x4f,0x0d,0x52,0x44, 2036-2038
0x5d,0xAA,0x38,0x0B,0x5A,0x4C,0x05,0x6d,0x41, 2039-2041
0x24,0xAd,0xB6,0x04,0x9B,0x4A,0x7A,0x4B,0xBe, 2042-2044
0x0A,0x4B,0x51,0x0A,0xA5,0x46,0x5B,0x52,0xBA, 2045-2047
0x06,0xd2,0x4e,0x0A,0xdA,0x42,0x35,0x5B,0x37, 2048-2050
0x09,0x37,0x4B,0x84,0x97,0xC1,0x04,0x97,0x53, 2051-2053
0x06,0x4B,0x48,0x66,0xA5,0x3C,0x0e,0xA5,0x4f, 2054-2056
//
//
//
//
//
//
//
//
//
//
//
0x06,0xB2,0x44,0x4A,0xB6,0x38,0x0A,0xAe,0x4C, 2057-2059
0x09,0x2e,0x42,0x3C,0x97,0x35,0x0C,0x96,0x49, 2060-2062
0x7d,0x4A,0xBd,0x0d,0x4A,0x51,0x0d,0xA5,0x45, 2063-2065
0x55,0xAA,0xBA,0x05,0x6A,0x4e,0x0A,0x6d,0x43, 2066-2068
0x45,0x2e,0xB7,0x05,0x2d,0x4B,0x8A,0x95,0xBf, 2069-2071
0x0A,0x95,0x53,0x0B,0x4A,0x47,0x6B,0x55,0x3B, 2072-2074
0x0A,0xd5,0x4f,0x05,0x5A,0x45,0x4A,0x5d,0x38, 2075-2077
0x0A,0x5B,0x4C,0x05,0x2B,0x42,0x3A,0x93,0xB6, 2078-2080
0x06,0x93,0x49,0x77,0x29,0xBd,0x06,0xAA,0x51, 2081-2083
0x0A,0xd5,0x46,0x54,0xdA,0xBA,0x04,0xB6,0x4e, 2084-2086
0x0A,0x57,0x43,0x45,0x27,0x38,0x0d,0x26,0x4A, 2087-2089
//
//
//
//
//
//
//
//
//
//
//
0x8e,0x93,0x3e,0x0d,0x52,0x52,0x0d,0xAA,0x47, 2090-2092
0x66,0xB5,0x3B,0x05,0x6d,0x4f,0x04,0xAe,0x45, 2093-2095
0x4A,0x4e,0xB9,0x0A,0x4d,0x4C,0x0d,0x15,0x41, 2096-2098
0x2d,0x92,0xB5, // 2099 };
//月份天数数据表 Byte
//
//
//
code
day_code1[9]={0x0,0x1f,0x3b,0x5a,0x78,0x97,0xb5,0xd4,0xf3};
Word code day_code2[3]={0x111,0x130,0x14e}; //月修正数据表
Byte code week_code[12]={0,3,3,6,1,4,6,2,5,0,3,5}; void Conver_week(void) /*=======
获
取
当
前
日
期
的
星
期
====================================*/ {
Byte temp1,temp2,year,month,day;
year =Tim[0]&0x7f; //加载年月日数据,如为BCD 则需转为十进制
month=Tim[1]; day =Tim[2];
if(Tim[0]>>7==0){year+=0x64;} //如果为21 世纪,年份数加100
temp1=year/0x4; //所过闰年数只算1900 年之后的 temp2=(year+temp1)%0x7; //为节省资源,先进行一次取余,避免数 大于0xff
temp2=temp2+day+week_code[month-1];
if(year%0x4==0&&month<3)temp2-=1; //如果是闰年但不到3 月则减一天
Tim[10]=temp2%0x7; //将星期数据写到指定星期变量Tim[9] }
bit get_moon_day(Byte month_p,Word code_addr) /*读取数据表中农历月的大月或小月,如果该月大返回1,小返回0*/ {
Byte temp,temp1; temp1=(month_p+3)/8; temp=0x80>>((month_p+3)%8);
temp=year_code[code_addr+temp1]&temp;
if(temp==0){return(0);}else{return(1);} }
void Conversion(void) /*==
转
换
当
前
农
历
信
息
====================================*/ {
Byte year,month,day;
Byte temp1,temp2,temp3,month_p; Word temp4,code_addr; bit flag2,flag_y;
year =Tim[0]&0x7f; //加载年月日数据,如为BCD 则需转为十进制 month=Tim[1]; day =Tim[2];
code_addr=year-1; //定位数据表地址 if(Tim[0]>>7==0)code_addr+=0x64; code_addr*=3;
temp1=year_code[code_addr+2]&0x60; //取当年春节所在的公历月 份
temp1=_cror_(temp1,5);
temp2=year_code[code_addr+2]&0x1f; //取当年春节所在