?? lcdm_day_time.lib
字號:
/*
****************************************************************************************
源程序文件名: LCDM_Day_Time.C
源程序名稱: 在液晶屏幕上顯示日期和時間信息的源程序文件
程序版本: 1.0
程序功能:
本程序是用于在在液晶屏幕上顯示日期和時間信息的源程序文件。
程序說明:
函數入口參數:
函數出口參數:
編譯工具軟件: CodeVision AVR C 版本:1.24.6 以上
鏈接子程序文件: 目標器件芯片的頭部文件
編作者: 磊元
編作者 E-Mail: PTZSW@163.COM
編制日期: 2005年5月26日
------------------------------------------------------------------------------
適用器件芯片類型: Atmel 公司生產的8位 RISC 單片機
器件芯片時鐘頻率:
存儲器模式: 小存儲器模式
外部擴展存儲器大小:0 【字節】
數據堆棧大小: 256 【字節】
------------------------------------------------------------------------------
源程序版本歷史:
2005年5月26日 -------- 版本 1.0 :發行版本
****************************************************************************************
*/
/*======================================================================================
本源程序包括的頭部文件
======================================================================================*/
#include "LCDM_HD61202_128D64.h" /* 包含128×64液晶模塊的頭部文件 */
#include "RTC_DS12887.h" /* 包含 DS12887 接口驅動的頭部文件 */
/*======================================================================================
程序指令代碼清單
======================================================================================*/
/*----------------------------------------------------------------------------
函數功能: 本函數用于在液晶屏幕上顯示16×16點陣字符日期和時間信息的操作。
運行完本函數將在液晶屏幕上顯示如下格式:
“□□□□年□□月”------ 第一屏
“□□日 星期□”------ 第二屏
“□□:□□:□□”------ 第三屏
“ ”------ 第四屏
函數入口參數:*time ------ 指向 time(系統時間結構變量)的指針。
備注: BCD_TIME 系統時間變量結構體類型在"RTC_DS12887.h"頭部文件中定義。
----------------------------------------------------------------------------*/
void LCDM_DayTime_Show_16_16(BCD_TIME *time)
{
register Uchar8 temp; /* 臨時寄存器變量 */
if ((time->BCD_Hour==0x00)&&(time->BCD_Minute==0x00)&&(time->BCD_Second==0x01))
{
LCDM_AllScreenData(0x00,64,64); /* 清屏 */
}
/* 顯示年前兩位時間數據 */
temp = time->BCD_Year_H;
temp = temp>>4;
LCDM_Display_Character(0,0,&China_Number_16_16[temp][0],16,16);
temp = time->BCD_Year_H;
temp &= 0x0F;
LCDM_Display_Character(16,0,&China_Number_16_16[temp][0],16,16);
/* 直接顯示年前兩位時間數據為“二○” */
/*
LCDM_Display_Character(0,0,&China_Number_16_16[2][0],16,16);
LCDM_Display_Character(16,0,&China_Number_16_16[0][0],16,16);
*/
/* 顯示年時間數據 */
temp = time->BCD_Year;
temp = temp>>4;
LCDM_Display_Character(32,0,&China_Number_16_16[temp][0],16,16);
temp = time->BCD_Year;
temp &= 0x0F;
LCDM_Display_Character(48,0,&China_Number_16_16[temp][0],16,16);
/* 顯示“年”字符 */
LCDM_Display_Character(64,0,&Day_Week_16_16[0][0],16,16);
/* 顯示月時間數據 */
temp = time->BCD_Month;
temp = temp>>4;
if (temp!=0)
{
temp = time->BCD_Month;
temp = temp>>4;
LCDM_Display_Character(80,0,&China_Number_16_16[temp][0],16,16);
temp = time->BCD_Month;
temp &= 0x0F;
LCDM_Display_Character(96,0,&China_Number_16_16[temp][0],16,16);
}
else
{
temp = time->BCD_Month;
temp &= 0x0F;
LCDM_Display_Character(88,0,&China_Number_16_16[temp][0],16,16);
}
/* 顯示“月”字符 */
LCDM_Display_Character(112,0,&Day_Week_16_16[1][0],16,16);
/* 顯示日時間數據 */
temp = time->BCD_Date;
temp = temp>>4;
if (temp!=0)
{
temp = time->BCD_Date;
temp = temp>>4;
LCDM_Display_Character(00,2,&Arabia_Number_16_16[temp][0],16,16);
temp = time->BCD_Date;
temp &= 0x0F;
LCDM_Display_Character(16,2,&Arabia_Number_16_16[temp][0],16,16);
}
else
{
temp = time->BCD_Date;
temp &= 0x0F;
LCDM_Display_Character(8,2,&Arabia_Number_16_16[temp][0],16,16);
}
/* 顯示“日”字符 */
LCDM_Display_Character(32,2,&Day_Week_16_16[2][0],16,16);
/* 顯示“星”字符 */
LCDM_Display_Character(80,2,&Day_Week_16_16[3][0],16,16);
/* 顯示“期”字符 */
LCDM_Display_Character(96,2,&Day_Week_16_16[4][0],16,16);
/* 顯示星期時間數據 */
temp = time->BCD_Week;
if (temp!=0x01)
{
LCDM_Display_Character(112,2,&China_Number_16_16[time->BCD_Week-1][0],16,16);
}
else
{
LCDM_Display_Character(112,2,&Day_Week_16_16[2][0],16,16);
}
/* 顯示小時時間數據 */
temp = time->BCD_Hour;
temp = temp>>4;
if (temp!=0)
{
temp = time->BCD_Hour;
temp = temp>>4;
LCDM_Display_Character(00,4,&Arabia_Number_16_16[temp][0],16,16);
temp = time->BCD_Hour;
temp &= 0x0F;
LCDM_Display_Character(16,4,&Arabia_Number_16_16[temp][0],16,16);
}
else
{
temp = time->BCD_Hour;
temp &= 0x0F;
LCDM_Display_Character(16,4,&Arabia_Number_16_16[temp][0],16,16);
}
/* 顯示“:”字符 */
LCDM_Display_Character(32,4,&Day_Week_16_16[5][0],16,16);
/* 顯示分鐘時間數據 */
temp = time->BCD_Minute;
temp = temp>>4;
LCDM_Display_Character(48,4,&Arabia_Number_16_16[temp][0],16,16);
temp = time->BCD_Minute;
temp &= 0x0F;
LCDM_Display_Character(64,4,&Arabia_Number_16_16[temp][0],16,16);
/* 顯示“:”字符 */
LCDM_Display_Character(80,4,&Day_Week_16_16[5][0],16,16);
/* 顯示秒時間數據 */
temp = time->BCD_Second;
temp = temp>>4;
LCDM_Display_Character(96,4,&Arabia_Number_16_16[temp][0],16,16);
temp = time->BCD_Second;
temp &= 0x0F;
LCDM_Display_Character(112,4,&Arabia_Number_16_16[temp][0],16,16);
}
/*----------------------------------------------------------------------------
函數功能: 本函數用于在液晶屏幕上顯示8×16點陣字符日期和時間信息的操作。
運行完本函數將在液晶屏幕上顯示如下格式:
“**.** **:**:**”------ 第一屏
“ ”------ 第二屏
“ ”------ 第三屏
“ ”------ 第四屏
函數入口參數:*time ------ 指向 time(系統時間結構變量)的指針。
備注: BCD_TIME 系統時間變量結構體類型在"RTC_DS12887.h"頭部文件中定義。
----------------------------------------------------------------------------*/
void LCDM_DayTime_Show_8_16(BCD_TIME *time)
{
register Uchar8 temp; /* 臨時寄存器變量 */
if ((time->BCD_Hour==0x00)&&(time->BCD_Minute==0x00)&&(time->BCD_Second==0x01))
{
LCDM_AllScreenData(0x00,64,64); /* 清屏 */
}
/* 顯示月時間數據 */
temp = time->BCD_Month;
temp = temp>>4;
if (temp!=0)
{
temp = time->BCD_Month;
temp = temp>>4;
LCDM_Display_Character(00,0,&Arabia_Number_8_16[temp][0],8,16);
temp = time->BCD_Month;
temp &= 0x0F;
LCDM_Display_Character(8,0,&Arabia_Number_8_16[temp][0],8,16);
}
else
{
temp = time->BCD_Month;
temp &= 0x0F;
LCDM_Display_Character(8,0,&Arabia_Number_8_16[temp][0],8,16);
}
/* 顯示“.”字符 */
LCDM_Display_Character(16,0,&Day_Week_8_16[0][0],8,16);
/* 顯示日時間數據 */
temp = time->BCD_Date;
temp = temp>>4;
if (temp!=0)
{
temp = time->BCD_Date;
temp = temp>>4;
LCDM_Display_Character(24,0,&Arabia_Number_8_16[temp][0],8,16);
temp = time->BCD_Date;
temp &= 0x0F;
LCDM_Display_Character(32,0,&Arabia_Number_8_16[temp][0],8,16);
}
else
{
temp = time->BCD_Date;
temp &= 0x0F;
LCDM_Display_Character(24,0,&Arabia_Number_8_16[temp][0],8,16);
}
/* 顯示小時時間數據 */
temp = time->BCD_Hour;
temp = temp>>4;
if (temp!=0)
{
temp = time->BCD_Hour;
temp = temp>>4;
LCDM_Display_Character(64,0,&Arabia_Number_8_16[temp][0],8,16);
temp = time->BCD_Hour;
temp &= 0x0F;
LCDM_Display_Character(72,0,&Arabia_Number_8_16[temp][0],8,16);
}
else
{
temp = time->BCD_Hour;
temp &= 0x0F;
LCDM_Display_Character(72,0,&Arabia_Number_8_16[temp][0],8,16);
}
/* 顯示“:”字符 */
LCDM_Display_Character(80,0,&Day_Week_8_16[1][0],8,16);
/* 顯示分鐘時間數據 */
temp = time->BCD_Minute;
temp = temp>>4;
LCDM_Display_Character(88,0,&Arabia_Number_8_16[temp][0],8,16);
temp = time->BCD_Minute;
temp &= 0x0F;
LCDM_Display_Character(96,0,&Arabia_Number_8_16[temp][0],8,16);
/* 顯示“:”字符 */
LCDM_Display_Character(104,0,&Day_Week_8_16[1][0],8,16);
/* 顯示秒時間數據 */
temp = time->BCD_Second;
temp = temp>>4;
LCDM_Display_Character(112,0,&Arabia_Number_8_16[temp][0],8,16);
temp = time->BCD_Second;
temp &= 0x0F;
LCDM_Display_Character(120,0,&Arabia_Number_8_16[temp][0],8,16);
}
/*
****************************************************************************************
本C語言源程序文件到此結束
****************************************************************************************
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -