⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 report.c

📁 lpc2136芯片的硬件全部功能示例程序
💻 C
字号:
/*************************************************************
		WPD800 报表处理
		修改历史    2007-10-10  zaken create version 1.0


*************************************************************/
#include "main.h"
#include "string.h"
#include  "timer.h"
#include "sample.h"
#include "E2prom.h"
#include "mea.h"
#include "report.h"

typedef struct tagTRpt_Date
{
	BYTE day;
	BYTE month;
	BYTE year; 
}T_Rpt_Date;
T_DAY_REPORT report[2];
BYTE   rpt_valid;
T_Rpt_Date   rpt_date;
WORD  rpt_time;

void Get_Rpt_Date(WORD d)
{
	rpt_date.day= (BYTE)(d& 0x3f);
	rpt_date.month=(BYTE)((d & 0x0f)>>6);
	rpt_date.year=(BYTE)(d>>8);
	if(rpt_date.day>31 || rpt_date.month >12)
		rpt_valid=0;
	else
		rpt_valid=1;
}
void Report_Init()
{
	if(!Eeprom_Read((BYTE *)&report[1],EPROM_RPT_ZONE,EPROM_RPT_SIZE))
	{
			rpt_valid=0;
	}
	Get_Rpt_Date(report[1].Date);
	if(!rpt_valid)//该报表有效
	{
		report[1].Date=0xffff;
	}	
	
}
T_DAY_REPORT *Report_Get(BYTE index)
{
	if(!index)
	{
		return &report[0];
	}
	else
		return &report[1];
}
void Report_Process(void)
{
	int i;
	if(Time_Flag & TIME_HOUR)
	{
		for(i=0;i<REPORT_MAX_CNT;i++)
		{
			report[0].Value[i][g_tDate.hour]=MeaBuf[i];
		}
	}
	if(Time_Flag & TIME_DAY)
	{
		
		report[0].Date=rpt_time;
		Eeprom_Write((BYTE *)&report[0],EPROM_RPT_ZONE,EPROM_RPT_SIZE);//保存报表
		memset((BYTE *)&report[0],0,sizeof(report[0]));
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -