📄 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 + -