#include <iom16v.h>
#include <macros.h>
//#include "hzk.h"
//#define jshui 0
//#define fshui 1
/* lcd port define: connect to PORTB of MEGA16L */
#define RS 0
#define RW 1
#define E 2
#define CSA 3
#define CSB 4
#define RST 5
/******************************************************************** */
#define SETBIT(x,y) (x|=(1<<y)) //set bit y in byte x
#define CLRBIT(x,y) (x&=(~(1<<y))) //clear bit y in byte x
#define CHKBIT(x,y) (x&(1<<y)) //check bit y in byte x
/******************************************************************** */
#define uchar unsigned char
#define uint unsigned int
#define key_PORT_PIND PIND
#define key_DEC 0x7F
#define key_INC 0xBF
#define key_SET 0xDF
#define key_MOD 0xEF
unsigned int Rec_flag=0;
unsigned char End_flag=0;
unsigned char data;
unsigned char databuf[6];
unsigned char count=0;
unsigned char int_flag=0;
unsigned char Water_valve=1;
unsigned char ajian=0;
unsigned char m_MOD=0;
unsigned char m_SET=0;
unsigned int w_lev=0;
unsigned int init_lev=0;
unsigned int mub=10000;
unsigned int mubs=0;
unsigned char mubgao=0;
unsigned char mubdi=0;
unsigned char jingg=0;
unsigned char kk=0;
unsigned char np;
unsigned int high=18900;
unsigned int bushu=0;
unsigned char sxian=180;
unsigned char xxian=30;
unsigned char jtiao=5;
unsigned char ctiao=3;
flash char motortb[]={0x03,0x07,0x06,0x0e,0x0c,0x0d,0x09,0x0b};
unsigned char Veri(void);
void Deal_Rdata(void);
void kongzhi(void);
void celiang(void);
void shezhi(void);
void main_windou(void);
void inf(void);
void shu_disp(unsigned int x,unsigned int t,unsigned int p);
void cl(void);
void keyboard(void);
flash char yi[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x48,0xA7,0xFF,0xFF,0xFF,0xFF,0xFF,0x18,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,0x07,0x07,0x0F,0x1F,0x1F,0x3F,
0x1F,0x1F,0x0F,0x0F,0x0F,0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x03,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x03,0x07,
0x07,0x07,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x3F,0x3F,0x3F,0x7F,0x7F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xDD,0x02,0xFF,0xEF,0xFF,0x7F,0x07,0x00,0x00,0x20,0xC0,0xC0,
0xE0,0xE0,0xF0,0xF4,0xF0,0xF0,0xF8,0xFC,0xF8,0xF8,0xFC,0xFC,0xFE,0xBC,0xFE,0xBE,
0x9E,0x9B,0x94,0x13,0x93,0x01,0x21,0x01,0x01,0x01,0x01,0x02,0x80,0x90,0x92,0x04,
0x9C,0x80,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x10,0x38,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,
0x03,0x07,0x0F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xD6,0x09,0x26,0xBB,0xFF,0xFE,0xF0,0x9E,0xFE,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0xF4,0xF1,0x04,0x61,0x80,0x01,0x01,0x01,
0x01,0x01,0x01,0x00,0x00,0x01,0x30,0x18,0x20,0x20,0x00,0x00,0x01,0x01,0x01,0x00,
0x00,0x00,0x83,0x7F,0xFF,0xFE,0x56,0xCA,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xA0,0xC0,0xD0,0xC0,0xE0,0xC0,0xC0,
0xE0,0xC0,0xC0,0xE0,0xC0,0x40,0x00,0x00,0x01,0x03,0x03,0x07,0x0F,0x1F,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xE0,0xF0,
0xF0,0xF0,0xF0,0xF8,0xFD,0xFC,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFD,0xFA,0xF0,0xE0,0xE0,
0xC0,0xC0,0x80,0xC6,0x86,0x8E,0x06,0x86,0x86,0x86,0x42,0x62,0x30,0x1A,0x0C,0x06,
0x06,0x00,0x00,0x00,0x00,0x61,0xFD,0xFE,0xC0,0x20,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x07,0x07,0x0F,0x07,0x0F,0x0F,0x0F,
0x0F,0x0F,0x07,0x01,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xAB,
};
flash char guang[]=
{
/*广 CB9E3 */
0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x05,
0x06,0x04,0x04,0x04,0x04,0x04,0x04,0x00,
0x40,0x30,0x0F,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
flash char xi[]=
{
/*西 CCEF7 */
0x02,0xF2,0x12,0x12,0x12,0xFE,0x12,0x12,
0x12,0xFE,0x12,0x12,0x12,0xF2,0x02,0x00,
0x00,0x7F,0x28,0x24,0x22,0x21,0x20,0x20,
0x20,0x21,0x22,0x22,0x22,0x7F,0x00,0x00,
};
flash char yi2[]=
{
/*一 CD2BB */
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x80,0xC0,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
flash char er[]=
{
/*二 CB6FE */
0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,
0x04,0x04,0x04,0x06,0x04,0x00,0x00,0x00,
0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x18,0x10,0x00,
};
flash char san[]=
{
/*三 CC8FD */
0x00,0x04,0x84,0x84,0x84,0x84,0x84,0x84,
0x84,0x84,0x84,0x84,0x84,0x04,0x00,0x00,
0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,
};
flash char qing[]=
{
/*请 CC7EB */
0x40,0x42,0x4C,0xC4,0x00,0x22,0xAA,0xAA,
0xAA,0xBF,0xAA,0xAA,0xAA,0x22,0x20,0x00,
0x00,0x00,0x00,0x7F,0x20,0x10,0xFF,0x0A,
0x0A,0x0A,0x4A,0x8A,0x7F,0x00,0x00,0x00
};
flash char kongg[]=
{
/*空格 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
flash char si[]=
{
/*四 CCBC4 */
0x00,0xFE,0x02,0x02,0x02,0xFE,0x02,0x02,
0xFE,0x02,0x02,0x02,0x02,0xFE,0x00,0x00,
0x00,0x7F,0x28,0x24,0x23,0x20,0x20,0x20,
0x21,0x22,0x22,0x22,0x22,0x7F,0x00,0x00
};
flash char jshui[]=
{
/*进水 CC5B6 */
0x00,0x00,0xF0,0x88,0xC9,0x2D,0x4F,0x4D,
0x29,0x28,0x28,0x28,0xC8,0x10,0xE0,0x00,
0xF8,0xA0,0xBE,0xBF,0xA0,0xA0,0xF8,0x00,
0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,
};
flash char fshui[]=
{
/*放水 CC1CB */
0x04,0x04,0x04,0x04,0xF4,0xAC,0xB4,0xF8,
0x48,0x58,0xF0,0x20,0x60,0x80,0x80,0x00,
0x04,0x04,0x04,0x04,0x05,0x06,0x05,0x03,
0xFF,0x0E,0x7B,0xDE,0x39,0xE3,0x4F,0xFA,
};
flash char jgao[]=
{
/*警告 CC5FA */
0x00,0x00,0x00,0xC0,0x20,0x18,0x04,0xE2,
0xF2,0xE4,0x08,0x30,0xC0,0x00,0x00,0x00,
0x30,0x4C,0x43,0x40,0x40,0x40,0x40,0x51,
0x7B,0x51,0x40,0x40,0x40,0x43,0x4C,0x30
};
flash char zchang[]=
{
/*正常 CC7EB */
0xF0,0x0C,0x02,0x72,0xE9,0xE9,0x71,0x01,
0x01,0x71,0xE9,0xE9,0x72,0x02,0x0C,0xF0,
0x0F,0x30,0x40,0x48,0x90,0xA0,0xA0,0xA0,
0xA0,0xA0,0xA0,0x90,0x48,0x40,0x30,0x0F,
};
flash char wxian[]=
{
/*危险CC8D5 */
0x38,0x04,0x3A,0x04,0xFA,0x04,0x02,0x01,
0xFF,0x50,0x50,0x50,0x50,0x50,0x50,0x70,
0xE0,0x90,0x88,0x94,0xDD,0xB3,0x93,0x83,
0x83,0x92,0xBA,0xD4,0x94,0x88,0x90,0xE0
};
flash char tshui[]=
{
/*停水CC5FA */
0x01,0x02,0xF4,0x88,0xD9,0x2D,0x4F,0xCD,
0xA9,0x68,0x28,0x38,0xC8,0x14,0xE2,0x01,
0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01,
0x01,0x02,0x04,0x88,0xFF,0x20,0xFF,0x80,
};
flash char she[]=
{
/*设 CCEF7 */
0x40,0x41,0xCE,0x04,0x00,0x80,0x40,0xBE,
0x82,0x82,0x82,0xBE,0xC0,0x40,0x40,0x00,
0x00,0x00,0x7F,0x20,0x90,0x80,0x40,0x43,
0x2C,0x10,0x10,0x2C,0x43,0xC0,0x40,0x00,
};
flash char shang[]=
{
/*上 CC9CF */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,
0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00,
0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,
0x40,0x40,0x40,0x40,0x40,0x60,0x40,0x00,
};
flash char xia[]=
{
/*下 CCFC2 */
0x00,0x02,0x02,0x02,0x02,0x02,0x0