?? ershi.h
字號:
/*************************************************************************/
#define uchar unsigned char
#define uint unsigned int
code uchar ershi1_code[24]={
0x05,0x14,0x03,0x18,
0x05,0x14,0x04,0x13,
0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,
0x07,0x16,0x08,0x17,
0x07,0x16,0x06,0x15,};
uchar code ershi2_code[]={};
/**************************************************************************
* 名稱: void ershi( uchar * clock_time )
* 功能: 輸入BCD的陽歷數據, 輸出BCD陰歷數據( 1901 - 2099 )
* 入口參數: c_flag:陽歷的世紀標志 clock_time: 時鐘地址
* 出口參數: 無
* 說明: c_flag = 0 :21世紀 c_flag = 1 :19世紀
*****************************************************************************/
void Ershi( uchar * clock_time )
{
// bit flag_month, flag_year;
uchar year, month, day, month_point; //定義 年 月 天
uchar temp1, temp2, temp3;
// uint calendar_address; //定義農歷地址
// uint day_number;
// uchar clock_moon[3]; //定義陰歷
clock_time += 3; //指向日
day = ( * clock_time >> 4 ) * 10 + ( *clock_time & 0x0f ); //BCD轉換十進制
clock_time ++; //指向月
month = ( * clock_time >> 4 ) * 10 + ( * clock_time & 0x0f ); //BCD轉換十進制
clock_time ++; //指向年
year = ( * clock_time >> 4 ) * 10 + ( * clock_time & 0x0f ); //BCD轉換十進制
temp1=ershi1_code[(month-1)*2+1]; //找出本月第二個節氣的最小日
//temp2=(month-1)/4;
temp2=ershi2_code[year*3+(month-1)/4]; //找出本月的節氣對應的字節
temp3=(month-1)%4;
temp2=temp2<<(temp3*2+1)&0x80;
temp1=temp1+temp2>>7; // 計算出本月第二個節氣的日期
if(day>=temp1)
{temp1=month*2-1;}
else
{
temp1=ershi1_code[(month-1)*2]; //找出本月第一個節氣的最小日
temp2=ershi2_code[year*3+(month-1)/4]; //找出本月的節氣對應的字節
temp3=(month-1)%4;
temp2=temp2<<(temp3*2)&0x80;
temp1=temp1+temp2>>7;
if(day>=temp1)
temp1=month*2-2;
temp1=month*2-3;
}
LCD_ERSHI(temp1);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -