#ifndef	__main_h__
#define	__main_h__ 

#include <cms.h>
#include "TypeDef.h"


//变量定义
volatile unsigned char MainTime;	//主循环定时
volatile bit B_MainLoop;			//主循环周期到	
volatile unsigned char LcdTime;		//LCD刷新时间

volatile bit Flag_buz;				//蜂鸣器标志位
volatile unsigned int BuzTime;		//蜂鸣器鸣叫时间


//函数定义
void Init_System();		//系统初始化
void Refurbish_Sfr();	//刷新寄存器
void interrupt Isr_Timer();		//中断函数

void Kscan();	//按键扫描
void Key1_Deal();	//按键1处理
void Key2_Deal();	//按键2处理
void Key3_Deal();	//按键3处理
void Key4_Deal();	//按键4处理

void Set_Time();	//定时函数
void Test_AD();		//AD测试
void DealTemperature();	//将AD转换成温度

void Hex_To_Bcd(unsigned char data);//数据转换

					//用于定时
volatile unsigned char secl;
volatile unsigned char sech;
volatile unsigned char ds_sec;
volatile unsigned char ds_min;
volatile unsigned char ds_hour;

					//用于AD测试
volatile unsigned int 	adsum;
volatile unsigned char	admin;
volatile unsigned char  admax;
volatile unsigned char  adresult;
volatile unsigned char  adtimes;	
volatile unsigned char  adtemper;		//温度AD

volatile unsigned char C_TEMP_MAX = 100;
volatile unsigned char TemperatureBuf;
volatile unsigned char TemperatureTime;
volatile unsigned char Temperature;
		
volatile unsigned char BCD_L;		//BCD转换
volatile unsigned char BCD_H;

volatile bit Flag_Onoff;	//开关机
volatile bit Flag_Time;		//一次中断事件到	
volatile bit Flag_SS;		//0.5S闪烁
volatile bit Flag_AD;		//AD测完标志位
volatile unsigned char work_mode;	//工作模式

volatile unsigned char tt;	//工作模式

volatile bit Flag_Led;	//
volatile bit Flag_Pwm;	//
volatile bit Flag_Lcd;	//
volatile unsigned char dcount;	 


#endif