电子万年历24节气c程序
发布时间:2024-11-18
发布时间:2024-11-18
电子万年历24节气的c程序
/***********************************************************************农历节
气******************************/
//原理:因为每一个公历月会有二个节气,所以分别用高/低4位来表示
//表格制作方法:比如:2010年1月5号是节气,1月20是第二个节气
//高4位写第一个节气,低4位即20-10=A写第二个节气,最终=0x5A;
//---------------------------------------------------------------------------------------------------
uchar code tab_jieqi[][12]=
{
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x5a,0x49,0x6b,0x5a,0x5b,0x6b,0x7d,0x7d,0x8d,0x8d,0x7c,0x7c},//2010年ok
{0x6a,0x49,0x6b,0x5a,0x6b,0x6c,0x7d,0x8d,0x8d,0x8e,0x8d,0x7c},//2011年ok
{0x6b,0x49,0x5a,0x4a,0x5a,0x5b,0x7c,0x7d,0x7c,0x8d,0x7c,0x7b},//2012年ok
{0x5a,0x48,0x5a,0x4a,0x5b,0x5b,0x7c,0x7d,0x7d,0x8d,0x7c,0x7c},//2013年
/////////////////////
{0x5a,0x49,0x6b,0x5a,0x5b,0x6b,0x7d,0x7d,0x8d,0x8d,0x7c,0x7c},//2014年OK
{0x6a,0x49,0x6b,0x5a,0x6b,0x6c,0x7d,0x8d,0x8d,0x8e,0x8c,0x7c},//2015年OK
{0x6a,0x49,0x5a,0x49,0x5a,0x5b,0x7c,0x7d,0x7c,0x8d,0x7c,0x7b},//2016年ok
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x5a,0x38,0x5a,0x4a,0x5b,0x5b,0x7c,0x7d,0x7d,0x8d,0x7c,0x7c},//2017年
//////////////////
{0x5a,0x49,0x5b,0x5a,0x5b,0x6b,0x7d,0x7d,0x8d,0x8d,0x7c,0x7c},//2018年ok
{0x5a,0x49,0x6b,0x5a,0x6b,0x6b,0x7d,0x8d,0x8d,0x8e,0x8c,0x7c},//2019年ok
{0x6A,0x49,0x5A,0x49,0x5A,0x5B,0x6C,0x7c,0x7C,0x8D,0x7C,0x7b},//2020年ok
{0x5A,0x38,0x5A,0x4A,0x5b,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7B},//2021年
///////////
{0x5A,0x49,0x5A,0x5A,0x5B,0x6B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7C},//2022年ok
{0x5A,0x49,0x6B,0x5A,0x6B,0x6b,0x7D,0x8D,0x8D,0x8E,0x8C,0x7C},//2023年ok
{0x6A,0x49,0x5A,0x49,0x5A,0x5B,0x6C,0x7c,0x7C,0x8D,0x7C,0x6B},//2024年ok
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7B},//2025年
////////////
{0x5A,0x48,0x5A,0x5A,0x5B,0x5B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7C},//2026年ok
{0x5A,0x49,0x6B,0x5A,0x6B,0x6B,0x7D,0x8D,0x8D,0x8D,0x7C,0x7C},//2027年ok
{0x6A,0x49,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x6B},//2028年ok
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7d,0x8D,0x7C,0x7B},//2029年
///////////////
{0x5A,0x48,0x5A,0x5A,0x5B,0x5B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7C},//2030年ok ok ok ok ok ok 闰年
电子万年历24节气的c程序
{0x5A,0x49,0x6B,0x5A,0x6B,0x6B,0x7D,0x8D,0x8D,0x8D,0x7C,0x7C},//2031年ok
{0x6A,0x49,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x6B},//2032年ok
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7B},//2033年 ////////////
{0x5A,0x48,0x5A,0x5A,0x5B,0x5B,0x7D,0x8D,0x7D,0x8D,0x7C,0x7C},//2034年ok
{0x5A,0x49,0x6B,0x5A,0x5B,0x6B,0x7D,0x7D,0x8D,0x8D,0x7C,0x7C},//2035年ok
{0x6A,0x49,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x6B},//2036年ok
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7d,0x8D,0x7C,0x7B},//2037年
///////////////
{0x5A,0x48,0x5A,0x5A,0x5B,0x5B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7C},//2038年ok
{0x5A,0x49,0x6B,0x5A,0x5B,0x6B,0x7D,0x7D,0x8D,0x8D,0x7C,0x7C},//2039年ok
{0x6A,0x49,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x6B},//2040年ok
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x5A,0x38,0x5A,0x4A,0x5A,0x5B,0x7C,0x7D,0x7C,0x8D,0x7C,0x7B},//2041
////////////
{0x5A,0x48,0x5A,0x4A,0x5B,0x5B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7C},//2042年ok
{0x5A,0x49,0x6B,0x5A,0x5B,0x6B,0x7D,0x7D,0x8D,0x8D,0x7C,0x7C},//2043年ok
{0x6A,0x49,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x7D,0x7C,0x6B},//2044年ok
{0x5A,0x38,0x5A,0x49,0x5A,0x5B,0x7C,0x7D,0x7C,0x8D,0x7C,0x7B},//2045年
///////////////
{0x5A,0x48,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7C},//2046年ok
{0x5A,0x49,0x6B,0x5A,0x5B,0x6B,0x7D,0x7D,0x8D,0x8D,0x7C,0x7C},//2047年ok
{0x6A,0x49,0x5A,0x49,0x5A,0x5A,0x6C,0x7C,0x7C,0x7D,0x7B,0x6B},//2048年ok
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x59,0x38,0x5A,0x5A,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x7B},//2049
////////////
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7C},//2050年ok
{0x5A,0x49,0x5A,0x5A,0x5B,0x6B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7C},//2051年ok
{0x5A,0x49,0x5A,0x49,0x5A,0x5A,0x6C,0x7C,0x7C,0x7D,0x7B,0x6B},//2052年ok
{0x59,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x7B},//2053年
///////////////
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7C},//2054年ok
{0x5A,0x49,0x5A,0x5A,0x5B,0x5B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7C},//2055年ok
{0x5A,0x49,0x5A,0x49,0x5A,0x5A,0x6C,0x7C,0x7C,0x7D,0x7B,0x6B},//2056年ok
ok 年 ok 年 ok
电子万年历24节气的c程序
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x59,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x6B},//2057年 ////////////
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7B},//2058年ok
{0x5A,0x49,0x5A,0x5A,0x5B,0x5B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7C},//2059年ok
{0x5A,0x49,0x5A,0x49,0x5A,0x5A,0x6C,0x7C,0x7C,0x7D,0x6B,0x6B},//2060年ok
{0x59,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x6B},//2061年
///////////////
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7B},//2062年ok
{0x5A,0x48,0x5A,0x5A,0x5B,0x5B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7C},//2063年ok
{0x5A,0x49,0x5A,0x49,0x5A,0x5A,0x6C,0x7C,0x7C,0x7C,0x6B,0x6B},//2064年ok
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x59,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x6B},//2065
////////////
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7B},//2066年ok
{0x5A,0x48,0x5A,0x5A,0x5B,0x5B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7C},//2067年ok
{0x5A,0x49,0x5A,0x49,0x4A,0x5A,0x6C,0x6C,0x7C,0x7C,0x6B,0x6B},//2068年ok
{0x59,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x6B},//2069年
///////////////
{0x5A,0x38,0x5A,0x4A,0x5A,0x5B,0x7C,0x7D,0x7C,0x8D,0x7C,0x7B},//2070年ok
{0x5A,0x48,0x5A,0x5A,0x5B,0x5B,0x7D,0x7D,0x7D,0x8D,0x7C,0x7C},//2071年ok
{0x5A,0x49,0x5A,0x49,0x4A,0x5A,0x6C,0x6C,0x7C,0x7C,0x6B,0x6B},//2072年ok
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x59,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x7D,0x7C,0x6B},//2073
////////////
{0x5A,0x38,0x5A,0x4A,0x5A,0x5B,0x7C,0x7D,0x7C,0x8D,0x7C,0x7B},//2074年ok
{0x5A,0x48,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7C},//2075年ok
{0x5A,0x49,0x5A,0x49,0x4A,0x5A,0x6C,0x6C,0x7C,0x7C,0x6B,0x6B},//2076年ok
{0x59,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x7D,0x7C,0x6B},//2077年
///////////////
{0x5A,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7D,0x7C,0x8D,0x7C,0x7B},//2078年ok
{0x5A,0x48,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7C},//2079年ok
{0x5A,0x49,0x5A,0x49,0x4A,0x5A,0x6C,0x6C,0x7C,0x7C,0x6B,0x6B},//2080年ok
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x59,0x38,0x5A,0x49,0x5A,0x5A,0x6C,0x7C,0x7C,0x7D,0x7B,0x6B},//2081ok 年 ok 年 ok 年
电子万年历24节气的c程序
////////////
{0x5A,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x7B},//2082年ok
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7C},//2083年ok
{0x5A,0x49,0x49,0x49,0x4A,0x5A,0x6C,0x6C,0x6C,0x7C,0x6B,0x6B},//2084年ok
{0x49,0x38,0x5A,0x49,0x5A,0x5A,0x6C,0x7C,0x7C,0x7D,0x7B,0x6B},//2085年ok ///////////////
{0x59,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7D,0x7C,0x8D,0x7C,0x7B},//2086年ok
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7C},//2087年ok
{0x5A,0x49,0x49,0x49,0x4A,0x4A,0x6C,0x6C,0x6C,0x7C,0x6B,0x6B},//2088年ok
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x49,0x38,0x5A,0x49,0x5A,0x5A,0x6C,0x7C,0x7C,0x7D,0x7B,0x6B},//2089年 ////////////
{0x59,0x38,0x5A,0x49,0x5B,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x6B},//2090年ok
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7B},//2091年ok
{0x5A,0x49,0x49,0x49,0x4A,0x4A,0x6C,0x6C,0x6C,0x7C,0x6B,0x6B},//2092年ok
{0x49,0x38,0x5A,0x49,0x5A,0x5A,0x6C,0x7C,0x7C,0x7C,0x6B,0x6B},//2093年ok ///////////////
{0x59,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x6B},//2094年ok
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7B},//2095年ok
{0x5A,0x48,0x49,0x49,0x4A,0x4A,0x6C,0x6C,0x6C,0x7C,0x6B,0x6B},//2096年ok
/* 1 2 3 4 5 6 7 8 9 10 11 12 单位:月*/
{0x49,0x38,0x5A,0x49,0x5A,0x5A,0x6C,0x6C,0x7C,0x7C,0x6B,0x6B},//2097年 ////////////
{0x59,0x38,0x5A,0x49,0x5A,0x5B,0x6C,0x7C,0x7C,0x8D,0x7C,0x6B},//2098年ok
{0x5A,0x38,0x5A,0x4A,0x5B,0x5B,0x7C,0x7D,0x7D,0x8D,0x7C,0x7B},//2099年ok
};
/*******************************************************************农历节气转
换******************************/
//输入年月日,如果当天是一个节气,就返回1 至 24,无节气就返回0
//如:输入2016年12月21日,则返回22= 冬至 ,
//前面的20不要:get_jieqi(16,12,21);
//1----24如下
//立春、雨水、惊蛰、春分、清明、谷雨、立夏、小满、芒种、夏至、小暑、大暑.
//立秋、处暑、白露、秋分、寒露、霜降、立冬、小雪、大雪、冬至、小寒、大寒.
uchar get_jieqi(uchar y_y,uchar m_o,uchar d_d)
{
uchar i,jie;
电子万年历24节气的c程序
if((y_y<100)&(y_y>9)) //只计算2010-2099年,其它不计算,以免产生误码 {
i=tab_jieqi[y_y-10][m_o-1];//查表得到本月的二个节气
if(d_d>9)i=(i&0x0f)+10;//如大于9号了,加多10天,
else i>>=4;
if(i==d_d) //二者相等,说明当天是一个农历节日 {
switch(m_o)
{
如果大于10号,就是第二个节气
}
}
else jie=0;
}
else jie=0;
return jie;
} case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: default : ; if(d_d>10)jie=24;else jie=23;break; //if(d_d>10)jie=2; else jie=1; break; if(d_d>10)jie=4; else jie=3; break; if(d_d>10)jie=6; else jie=5; break; if(d_d>10)jie=8; else jie=7; break; if(d_d>10)jie=10;else jie=9; break; if(d_d>10)jie=12;else jie=11;break; if(d_d>10)jie=14;else jie=13;break; if(d_d>10)jie=16;else jie=15;break; if(d_d>10)jie=18;else jie=17;break; if(d_d>10)jie=20;else jie=19;break; if(d_d>10)jie=22;else jie=21;break;