智能家电ADS软件---下位机部分实现---菜单--定时--日期--时间--AD转换--开关等

main.c
/*******************************/

/*******************************************************************************
*File: UART.C
*功能: 串口驱动程序(中断方式接收)
*说明: 使用外部晶振,Fpclk=Fcclk/4
*波特率除数计算:UxDLM,UxDLL=Fpclk/16*波特率
*******************************************************************************/
#include "config.h"
#include "define.h"
#include "init.h"
#include    "lcd.h"

#define     KC0    0x00100000     	//P0.20 引脚控制列线KC0
#define     KC1    0x00200000     	//P0.21 引脚控制列线KC1
#define     KH0    0x00400000     	//P0.22 引脚控制行线KH0
#define     KH1    0x00800000     	//P0.23 引脚控制行线KH1

#define     BEEP   0x00000400     	//P0.10 引脚控制BEEP,高电平使能
#define     LED1   0x00000800     	//P0.11 引脚控制LED1,低电平使能

#define     LEDCON    0x00000800     //P0.11 引脚控制LED,低电平点亮
#define     LED1    0x00000800     //P0.11 引脚控制LED,低电平点亮
#define     LED2    0x00001000     //P0.12 引脚控制LED,低电平点亮
#define     LED3    0x00002000     //P0.13 引脚控制LED,低电平点亮
#define     LED4    0x00004000     //P0.14 引脚控制LED,低电平点亮

#define     LCDBK     0x00008000     //P0.15 引脚控制LCDBK,高电平使能

extern	 Delay(uint32 x);
extern  vLCDInit(void);
extern  vCleanAll(void);
extern  DisPicture(uint8 *pDisTable);
extern  vDisPicture(uint8 *pDisTable,uint8 sur );
extern  vCheckBusy(void)  ;
extern  Displaynum (uint8 ucPage,uint8 ucCol, uint8  *pDisTable );
extern  DispOneChinese(uint8 ucPage,uint8 ucCol,uint8 *pDisTable);
void DelayNS(uint32 nDly);
uint8 menuth=0;//几级菜单
uint8 optionth=0;//菜单选项
uint8 current=0;//当前选择项

uint8 val;
uint8 cnt;
uint8 num1;


uint8  tm[6];	 //获取时间存在数组中
uint8  year[6];	 //获取日期存在数组中
uint8  day;		 //获取星期号

uint8 dayoder;


/*---------------------------------------------------------------------------------------------*/



	
extern PLC_SendAllInfo(void);		//发送所有当前状态信息
extern void PLC_AppControl(void);		//家电开关控制
extern PLC_AppTime(void);			//家电定时控制
extern PLC_Timer(void);		//设置系统时间
extern PLC_SetCritical(void);		//设置临界值(温度、时间)
extern nvdPackagingData(void);	//将当前电器各个状态打包
extern uint8 Send[8];
//extern uint8 Date[6];
void PLC_Send(void);
void nvdTranslateCommand(void);	
//void translate(void);
uint8 Pack[8];
uint8  sCount=0;	   //用于接收时计数,为当前所赋值的结构体成员,结构体总共有八个成员

//数据结构体
struct receiveData
{
	uint8 cmd;			//命令标志
    uint8 cmd_info;		//命令信息
    uint8 option_first;		//可选择的信息1
    uint8 option_second;	//可选择的信息2
	uint8 option_third;		//可选择的信息1
    uint8 option_four;	//可选择的信息2
    uint8 check;			//校验
	uint8 end;			//结束标志  暂时定位  0A 表示回车	
}receData;

struct receiveData *stu=&receData;

void UART_SendByte(uint8 data,uint8 num);

void LPC_Send_Str(struct receiveData *str,uint8 num);
uint8 LPC_Check_Data(struct receiveData *str);

/*******************************************************************************
*名称:LPC_Open_Com()
*功能:下位机打开串口
*******************************************************************************/

void LPC_Open_Com()
{
	PINSEL0|=0x00050000;                         //设置IO连接到UART1
}

/*******************************************************************************
*名称:LPC_Close_Com()
*功能:下位机关闭串口
*******************************************************************************/

void LPC_Close_Com()
{
	PINSEL0&=0xFFF1FFFF;                         //设置IO连接到UART1
}




/*******************************************************************************
*名称: LPC_Receive_Str(void)
*功能: UART1接收中断
*******************************************************************************/

__irq void LPC_Receive_Str(void)
{
    //if((U1IIR & 0x0F)==0x04)        //接收数据可用
/*
    switch(sCount)
    {
    	case 0: (*stu).cmd=U1RBR;  Pack[sCount]=(*stu).cmd;UART_SendByte(66,1);while((U1LSR&0x20)==0);break; 
    	case 1:	(*stu).cmd_info=U1RBR;  Pack[sCount]=(*stu).cmd_info; UART_SendByte(4,1);while((U1LSR&0x20)==0);break;
		case 2:	(*stu).option_first=U1RBR;  Pack[sCount]=(*stu).option_first; UART_SendByte(16,1);while((U1LSR&0x20)==0);break;
		case 3:	(*stu).option_second=U1RBR;  Pack[sCount]=(*stu).option_second; UART_SendByte(Pack[sCount],1);while((U1LSR&0x20)==0);break;
		case 4:	(*stu).option_third=U1RBR;  Pack[sCount]=(*stu).option_third; UART_SendByte(Pack[sCount],1);while((U1LSR&0x20)==0);break;
		case 5:	(*stu).option_four=U1RBR;  Pack[sCount]=(*stu).option_four; UART_SendByte(Pack[sCount],1);while((U1LSR&0x20)==0);break;
		case 6:	(*stu).check=U1RBR; Pack[sCount]=(*stu).check; UART_SendByte(Pack[sCount],1);while((U1LSR&0x20)==0);break;
		case 7:	(*stu).end=U1RBR; Pack[sCount]=(*stu).end;nvdTranslateCommand(); UART_SendByte(Pack[sCount],1);while((U1LSR&0x20)==0);break;		  //最后一位接收完成后,将sCount清零
		default  :break;
    }
 */
 	switch(sCount)
    {
    	case 0: (*stu).cmd=U1RBR;  Pack[sCount]=(*stu).cmd;break; 
    	case 1:	(*stu).cmd_info=U1RBR;  Pack[sCount]=(*stu).cmd_info;break;
		case 2:	(*stu).option_first=U1RBR;  Pack[sCount]=(*stu).option_first;break;
		case 3:	(*stu).option_second=U1RBR;  Pack[sCount]=(*stu).option_second; break;
		case 4:	(*stu).option_third=U1RBR;  Pack[sCount]=(*stu).option_third;break;
		case 5:	(*stu).option_four=U1RBR;  Pack[sCount]=(*stu).option_four;break;
		case 6:	(*stu).check=U1RBR; Pack[sCount]=(*stu).check;break;
		case 7:	(*stu).end=U1RBR; Pack[sCount]=(*stu).end;nvdTranslateCommand();break;		  //最后一位接收完成后,将sCount清零
		default  :break;
    }
    sCount++;
    if(sCount==8)
    	sCount=0;
	
	
	//LPC_Check_Data(stu);
   
    VICVectAddr=0x00;
}

/*******************************************************************************
*名称: LPC_UART_Init()
*功能: 初始化串口0、1.设置为8位数据位,1位停止位,无奇偶校验,波特率为115200,
*      Fcclk=Fosc*4=11.0592*4MHz,Fpclk=Fcclk/4=11.0592MHz/4=11.0592MHz
*******************************************************************************/

void LPC_UART_Init(void)
{  
    U1LCR=0x83;                       //设置为8位数据位,1位停止位,偶校验
    U1DLL=6;                          //除数锁存寄存器低8位,波特率为115200
    U1DLM=0x00;                       //除数锁存寄存器高8位
    U1LCR=0x03;                       //禁止访问除数锁存寄存器

    U0LCR=0x83;                       
    U0DLL=6;
    U0DLM=0x00;
    U0LCR=0x03;
}


/*******************************************************************************
*名称: UART_SendByte()
*功能: 向串口发送字节数据,并等待发送完毕
*******************************************************************************/

void UART_SendByte(uint8 data,uint8 num)
{   
    if(num==0)
    {
        U0THR=data;                      //发送保持寄存器
        while((U0LSR&0x20)==0);          //等待数据发送完毕    
    }

    if(num==1)
    {
        U1THR=data;                      //发送保持寄存器
        while((U1LSR&0x20)==0);          //等待数据发送完毕    
    }    
}


/*******************************************************************************
*名称:LPC_Calculate_Parity()
*功能:偶校验函数  返回1表示stu中有奇数个1;返回0则表示stu中正好有偶数个1
*******************************************************************************/
char LPC_Calculate_Parity(struct receiveData *str)
{
	char i=0,j=0,sum=0,check[6]={0};
	for(i=0;i<6;i++)
	{
		
		switch(i)
		{
			case 0:for(j=0;j<8;j++){if(((*str).cmd&(1<<j))!=0)check[i]++;};break;
			case 1:for(j=0;j<8;j++){if(((*str).cmd_info&(1<<j))!=0)check[i]++;};break;
			case 2:for(j=0;j<8;j++){if(((*str).option_first&(1<<j))!=0)check[i]++;};break;
			case 3:for(j=0;j<8;j++){if(((*str).option_second&(1<<j))!=0)check[i]++;};break;
			case 4:for(j=0;j<8;j++){if(((*str).option_third&(1<<j))!=0)check[i]++;};break;
			case 5:for(j=0;j<8;j++){if(((*str).option_four&(1<<j))!=0)check[i]++;};break;
		}
		sum+=check[i];
	}
	
	if(sum%2==1)
		return 1;
	else
		return 0;
}

/*******************************************************************************
*名称:LPC_Check_Data()
*功能:偶校验验证函数  返回1表示数据str传送正确;返回0则表示数据str传送失败
*******************************************************************************/
uint8 LPC_Check_Data(struct receiveData *str)
{
	uint8 i=0,j=0,sum=0,check[6]={0};
	for(i=0;i<6;i++)
	{
		
		switch(i)
		{
			case 0:for(j=0;j<8;j++){if(((*str).cmd&(1<<j))!=0)check[i]++;};break;
			case 1:for(j=0;j<8;j++){if(((*str).cmd_info&(1<<j))!=0)check[i]++;};break;
			case 2:for(j=0;j<8;j++){if(((*str).option_first&(1<<j))!=0)check[i]++;};break;
			case 3:for(j=0;j<8;j++){if(((*str).option_second&(1<<j))!=0)check[i]++;};break;
			case 4:for(j=0;j<8;j++){if(((*str).option_third&(1<<j))!=0)check[i]++;};break;
			case 5:for(j=0;j<8;j++){if(((*str).option_four&(1<<j))!=0)check[i]++;};break;
		}
		sum+=check[i];
	}
	
	sum+=(*str).check;
	
	if(sum%2==0)
		return 1;
	else
		return 0;
}

/*******************************************************************************
*名称:UART_SendStu()
*功能:向串口发送一结构体
*******************************************************************************/

void LPC_Send_Str(struct receiveData *str,uint8 num)
{  
    		uint8 i=0;		   //用于循环计数的变量
        	for(i=0;i<8;i++)
			{
            	//UART_SendByte(*str++,1);           //发送数据
				switch(i)
				{
					case 0:UART_SendByte((*str).cmd,1);	break;
					case 1:UART_SendByte((*str).cmd_info,1);break;
					case 2:UART_SendByte((*str).option_first,1);break;
					case 3:UART_SendByte((*str).option_second,1);break;
					case 4:UART_SendByte((*str).option_third,1);break;
					case 5:UART_SendByte((*str).option_four,1);	break;
					case 6:UART_SendByte((*str).check,1);break;
					case 7:UART_SendByte((*str).end,1);	break;	//最后一位发送完成后,将sCount2清零
					default  :break;
				}
			}
}

/*******************************************************************************
*名称:nvdTranslateCommand(void)
*功能:解析上位机发送的信息
*******************************************************************************/

void nvdTranslateCommand()	   
{	
	uint8 state;
	
	state=Pack[0];
    switch(state)
	{
		case GET_ALL_INFO:
		{
			PLC_SendAllInfo();		//发送所有当前状态信息
			break;
		}
		case CONTROL:
		{
			PLC_AppControl();		//家电开关控制
			break;
		}
		case SET_TIMER:
		{
			PLC_AppTime();			//家电定时控制
			break;
		}
		case SET_CLOCK:
		{
			PLC_Timer();		//设置系统时间
			break;
		}
		case SET_CRITICAL:
		{
			PLC_SetCritical();		//设置临界值(温度、时间)
			break;
		}
		default :
		{
			break;
		}
	}
}

void PLC_Send(void)
{
	uint8 i=0;		   //用于循环计数的变量
	for(i=0;i<8;i++)
	{
    	
		switch(i)
		{
			case 0:(*stu).cmd=Send[i];	break;
			case 1:(*stu).cmd_info=Send[i];  break;
			case 2:(*stu).option_first=Send[i];  break;
			case 3:(*stu).option_second=Send[i];  break;
			case 4:(*stu).option_third=Send[i];  break;
			case 5:(*stu).option_four=Send[i];  break;
			case 6:(*stu).check=Send[i];  break;
			case 7:(*stu).end=Send[i];	break;	
			default  :break;
		}
	}	
	LPC_Send_Str(stu,1);
	//DelayNS(150);
}

/*******************************************************************************
*名称: main()
*功能: 使用串口UART1接收上位机发送的数据,当接收到8个连续数据后,取反LED,并将数据原封不动的发送回去
*******************************************************************************/





/****************************************************************************
*File: KEY.c
*功能: 矩阵键盘驱动程序
****************************************************************************/



/*****************************************************************************
*名称: DelayNS()
*功能: 软件延时
*****************************************************************************/

void  DelayNS(uint32 nDly)
{  
    uint32 nLoop;

    for(; nDly>0; nDly--) 
        for(nLoop=0; nLoop<50000; nLoop++);
}



void delay (void) 						     
{    
  	for (cnt = 0; cnt < val; cnt++)          
    {
        for (num1 = 0; num1 <0xFF; num1++); 
    }
} 
/*****************************************************************************
*名称: ADTransmit()
*功能: A/D转换
*****************************************************************************/
void ADTransmit (void) 						     
{ 
    ADCR |= 0x01000000;                      //Start A/D Conversion 
  	do{
    	val = ADDR3;                         //Read A/D Data Register
  	} while ((val & 0x80000000) == 0);       //Wait for end of A/D Conversion

  	ADCR &= ~0x01000000;                     //Stop A/D Conversion 
  	val = (val >> 6) & 0x03FF;               //Extract(取出) AIN3 Value 
}

 /****************************************************************************
* 函数名称:OpenLED()
* 功    能:打开LED灯
* AppSort:电器种类 1代表LED1表示电灯,2代表LED2表示热水器,3代表LED3表示空调,4代表LED4表示冰箱.5表示全部。灯亮代表开状态,灯灭表示关状态
****************************************************************************/

void OpenLED(uint8 AppSort)
{
 	if(AppSort==1)
	{
		IOCLR|=LED1;//打开电灯	
    //IOSET|=LED1;//关闭LED1	
	}
	else if(AppSort==2)
	{
		IOCLR|=LED2;//打开热水器																							   0
	}
	else if(AppSort==3)
	{
		IOCLR|=LED3;//打开空调
	}
	else if	(AppSort==4)
	{
		IOCLR|=LED4;//打开冰箱
	}
	else if	(AppSort==6)
	{
		//IRQEnable();//打开端口
		LPC_Open_Com();
	}
	else
	{
		IOCLR|=LED1;//打开电灯
		IOCLR|=LED2;//打开热水器
		IOCLR|=LED3;//打开空调
		IOCLR|=LED4;//打开冰箱
	}
}

  /****************************************************************************
* 函数名称:CloseLED()
* 功    能:关闭LED灯
* AppSort:电器种类 1代表LED1表示电灯,2代表LED2表示热水器,3代表LED3表示空调,4代表LED4表示冰箱,5表示全部。灯亮代表开状态,灯灭表示关状态
****************************************************************************/

void CloseLED(uint8 AppSort)
{
 	if(AppSort==1)
	{
     	IOSET|=LED1;//关闭电灯
	}
	else if(AppSort==2)
	{
		IOSET|=LED2;//关闭热水器
	}
	else if(AppSort==3)
	{
		IOSET|=LED3;//关闭空调
	}
	else if(AppSort==4)
	{
		IOSET|=LED4;//关闭冰箱
	}
	else if	(AppSort==6)
	{
		//IRQDisable();//关闭端口
		LPC_Close_Com();
	}
	else
	{
		IOSET|=LED1;//关闭电灯
		IOSET|=LED2;//关闭热水器
		IOSET|=LED3;//关闭空调
		IOSET|=LED4;//关闭冰箱
	}
}

/*******************************************************************************
*名称: GetCurrent(uint8 option )
*功能: 获取当前选择项(选择的是什么东西)
*******************************************************************************/

void GetCurrent(uint8 option)
{
	if(menuth==1)
	{
		if(option==1)
		{
			current=6;
			 //current=远程端口控制开关
		}
		if(option==2)
		{
			current=5;
			//current=电器全关
		}
	}
	if(menuth==2)
	{
		if(option==0)
		{
			current=1;//current=电灯
		}
	    else if(option==1)
		{
			current=2;//current=热水器
		}
		else if(option==2)
		{
			current=3;//current=空调
		}
		else 
		{
			current=4;//current=冰箱
		}
	}
}

  /*******************************************************************************
*名称:IRQ_EINT2()
*功能:外部中断2处理函数
*******************************************************************************/
__irq void Eint2(void)	  
{    

   if(menuth==0) //待机页面
   { 
   	 
     VICIntEnClr |= (1 << 13);		// 禁止RTC中断 

	 
   	 menuth=1;
	 optionth=0;
	 
	 GetCurrent(optionth);
	 vCleanAll();
	 vDisPicture(menu2,12);
   }
   else if(menuth==1)   //一级菜单
   {   

   	    if(optionth==0)
		{
			menuth=2;
			optionth=0;
			GetCurrent(optionth);
			vCleanAll();
			vDisPicture(menu7,2);
			vCheckBusy();
			vDisPicture(menu7,2);
		}
		else if(optionth==3)
		{
			menuth=0;
			VICIntEnable |= (1 << 13);		// 使能RTC中断
			vCleanAll();
			DisPicture(menu1) ;	//显示待机页面
		}
		else 
		{
			menuth=3;
			optionth=0;
			vCleanAll();
			vDisPicture(menu4,12);
		}
	}
	else if(menuth==2)
	{
		if(optionth==4)
		{
			menuth=1;
			optionth=0;
			GetCurrent(optionth);
			vCleanAll();
			vDisPicture(menu2,12);
		}
		else 
		{
			menuth=3;
			optionth=0;
			vCleanAll();
			vDisPicture(menu4,12);
		}
	}
	else
	{
		   if(optionth==0)	 //开LED灯
		   {
		   		OpenLED(current);
				menuth=1;
				optionth=0;
				GetCurrent(optionth);
				vCleanAll();
				vDisPicture(menu2,12);		
		   }
		   else if(optionth==1)		//关LED灯
		   {
		   		CloseLED(current);
				menuth=1;
				optionth=0;
				GetCurrent(optionth);
				vCleanAll();
				vDisPicture(menu2,12);
		   }
		   else						 //返回
		   {
		   		menuth=1;
				optionth=0;
				GetCurrent(optionth);
				vCleanAll();
				vDisPicture(menu2,12);
		   }
	}
   while((EXTINT&0x04)!=0)          //等待外部中断信号恢复为高电平
   {  
     EXTINT=0x04;		    		//通过写入1清除标志
   }
   VICVectAddr=0x00;		    	//向量地址寄存器复位   
}


/****************************************************************************
* 函数名称:BeepCount()
* 功    能:蜂鸣器按指定次数缝鸣
****************************************************************************/

void BeepCount(uint8 count)
{
 	for(;count>0;count--)
    {
    	IOSET|=BEEP;                   		      //开蜂鸣器 
		DelayNS(10);
       	IOCLR|=BEEP;                   			  //关闭蜂鸣器
		DelayNS(10);
    }
}



/*****************************************************************************
* 函数名称:KeyDown()
* 功    能:检测键盘是否按下
* 入口参数:无
* 出口参数:返回1表示键盘按下,返回0表示键盘未按下
* 注    意:该函数有消抖功能
*****************************************************************************/

uint8 KeyDown(void)
{
    IOCLR |= KH0+KH1;             		     			// KH0=KH1=0,行线全部置低
    IODIR &= 0xFFCFFFFF; 					 			// 设置键盘列线控制口为输入
  	
  	if(((IOPIN & KC0)==0) || ((IOPIN & KC1)==0))
   	{
    	DelayNS(10);                               		// 延时消抖
     	if(((IOPIN & KC0)==0) || ((IOPIN & KC1)==0))	// 再次读列线状态,若有任一列线读回状态为低
       		{IODIR |= KC0+KC1; return 1;}  		    	// 返回1,表明有键盘按下,重置列线控制口为输出
     	else
       		{IODIR |= KC0+KC1; return 0;}  				// 返回0,表明无键盘按下,重置列线控制口为输出
 	} 
  	else 
    	{IODIR |= KC0+KC1; return 0;}     				// 返回0,表明无键盘按下,重置列线控制口为输出
}

 
/****************************************************************************
* 函数名称:KeyNum()
* 功    能:检测用户按下的键盘所对应的键盘号
* 入口参数:无
* 出口参数:返回0表示没有键盘被按动,返回1~16对应被按动的键盘
* 说    明:用户可根据自己的键盘编号修改该函数。
****************************************************************************/

uint8  KeyNum(void)
{
	uint8 KeyTemp;
    KeyTemp=0;

  	if(KeyDown()==1)                               		// 若键盘被按下
   	{
    	while(1)
		{
			IOSET|=KC0+KC1;             				// KC0=KC1=1,列线置高 
			IOCLR|=KH0;      		 					// 将行线1置低,其他行线置高
            IOSET|=KH1;
            
     		IODIR &= 0xFFCFFFFF; 						//设置键盘列线控制口为输入
     		if((IOPIN & KC0)==0) {KeyTemp=1; break;}	// 若列线1读回状态为低,则表明按键1被按下
     		if((IOPIN & KC1)==0) {KeyTemp=2; break;}	// 若列线2读回状态为低,则表明按键2被按下     		
     			
     		IOCLR|=KH1;      		 					// 将行线2置低,其他行线置高
            IOSET|=KH0;
            
     		if((IOPIN & KC0)==0) {KeyTemp=3; break;}	// 若列线1读回状态为低,则表明按键3被按下
     		if((IOPIN & KC1)==0) {KeyTemp=4; break;}	// 若列线2读回状态为低,则表明按键4被按下     		
      	}     	
	
	    IODIR |= KC0+KC1;								// 重置列线控制口为输出
		return KeyTemp;
    }
  	else
    	return 0x55;									// 返回0x55,表明无键盘按下
}


/*******************************************************************************
*名称: GetLCDPageNum(uint8 option )
*功能: 获取当前选择项对应的LCD页号对应的参数
*******************************************************************************/

uint8 GetLCDPageNum(uint8 option)
{
	if(menuth==1) //一级菜单
	{
		if(optionth==0)
		{
			return 12;
		}
		else if(optionth==1)
		{
			return 24;
		}
		else if(optionth==2)
		{
			return 36;
		}
		else
		{
			return 48;
		}
	}
	if(menuth==2)	//二级菜单
	{
		if(optionth==0)
		{
			return 2;
		}
		else if(optionth==1)
		{
			return 4;
		}					  
		else if(optionth==2)
		{
			return 3;
		}
		else if(optionth==3)
		{
			return 5;
		}
		else if(optionth==4)
		{
			return 48;
		}
		else
		{

		}
	}
	if(menuth==3)	//三级菜单
	{
		if(optionth==0)
		{
			return 12;
		}
		else if(optionth==1)
		{
			return 24;
		}					  
		else
		{
			 return 36;
		}
	}
}

 /*****************************************************************************************
	  名称 Dateupdated 
	  功能 在待机界面刷新日期
	  参数解释
	  		  numcode[] 要显示的数据组成的数组 长度为六 数字范围0-9
			 pDisTable[][16] 数字 和温度标示横线字符
*******************************************************************************************/
  void Dateupdated(uint8  numcode[])
{	  uint8 count=6;
	 uint8 ucPage=2;
	 uint8 ucCol=31;
	
	// uint8 arrnum;
	 //arrnum=sizeof(numcode)	;
	uint8 i=0;
	for(i= 0;i<count;i++)
	{ if( i==2||i==4)
		{
		Displaynum (ucPage,ucCol+8*i,*(snum+10));
		ucCol+=8;
		Displaynum (ucPage,ucCol+8*i,*(snum+numcode[i]));
		}
	   else
	   {
	   	 Displaynum (ucPage,ucCol+8*i,*(snum+numcode[i]));
	   }
	}
}

/*************************************************************************************************
  名称   Timeupdated 
  作用    在待机界面刷新时间
  参数解释
        numcode[] 要显示的数据组成数组
		pDisTable[][16]         
*************************************************************************************************/

		
   void  Timeupdated(uint8  numcode[])
{	
	uint8 ucPage=4;
	uint8 ucCol=31;
	uint8 count=6;
	// uint8 arrnum;
	 //arrnum=sizeof(numcode)	;
	uint8 i=0;
	for(i= 0;i<count;i++)
	{ if( i==2||i==4)
		{
		Displaynum (ucPage,ucCol+8*i,*(snum+12));
		ucCol+=8;
		Displaynum (ucPage,ucCol+8*i,*(snum+numcode[i]));
		}
	   else
	   {
	   	 Displaynum (ucPage,ucCol+8*i,*(snum+numcode[i]));
	   }
	}
}
/**************************************************************************************************
		  名称 	 Tempupdated
		  功能   刷新温度
		  参数解释  numcode 显示数据数组0-9
*************************************************************************************************/

   void  Tempupdated(uint8  numcode[])
{	
	uint8 ucPage=6;
	uint8 ucCol=24;
	uint8 count=2;
	// uint8 arrnum;
	 //arrnum=sizeof(numcode)	;
	uint8 i=0;
	for(i= 0;i<count;i++)
	{ 
	   	 Displaynum (ucPage,ucCol+8*i,*(snum+numcode[i]));		
	}

	DispOneChinese(6,40,degree);
}
/*************************************************************************************************
  名称 Weekupdated
  功能 更新星期
  参数解释
  			oder 周几  
**********************************************************************************************/

void  Weekupdated(uint8  oder)
{	
	DispOneChinese(6,96,*(week+oder));
}

  /*******************************************************************************
** 函数名称 :SendTimeRtc()
** 函数功能 :获取时间的各种数据
** 入口参数 :无
** 出口参数 :无
*******************************************************************************/

void SendTimeRtc (void)
{	uint8  dis_buf[22];
	
	uint32 datas;
	uint32 times;
	uint32 bak;
//	uint8  MESSAGE[]="--北京时间:--";
	
	times = CTIME0;								// 读取完整的时钟寄存器
	datas = CTIME1;
	
	//UART_SendStr(MESSAGE,1);
	
	
	bak = (datas >> 16) & 0xfff;				// 获取年
	dis_buf[0]=bak/1000+'0';
	bak = bak % 1000;
	dis_buf[1]=bak/100+'0';
	bak = bak % 100;
	dis_buf[2]=bak/10;
    dis_buf[3]=bak%10;
    dis_buf[4]='-';
    	
	bak = (datas >> 8) & 0x0f;					// 获取月
	dis_buf[5]=bak/10;
    dis_buf[6]=bak%10;
    dis_buf[7]='-';
    
	bak = datas & 0x1f;							// 获取日
	dis_buf[8]=bak/10;
    dis_buf[9]=bak%10;
    dis_buf[10]=' ';
    
	bak = (times >> 24) & 0x07;					// 获取星期
	dis_buf[11]=bak%10;
    dis_buf[12]=' ';
		
	bak = (times >> 16) & 0x1f;					// 获取小时
	dis_buf[13]=bak/10;
    dis_buf[14]=bak%10;
    dis_buf[15]=':';
    
	bak = (times >> 8) & 0x3f;					// 获取分钟
	dis_buf[16]=bak/10;
    dis_buf[17]=bak%10;
    dis_buf[18]=':';
    
	bak = times & 0x3f;							// 获取秒钟
	dis_buf[19]=bak/10;
    dis_buf[20]=bak%10; 
	tm[0]= dis_buf[13];
	tm[1]= dis_buf[14];
	tm[2]= dis_buf[16];
	tm[3]= dis_buf[17];
	tm[4]= dis_buf[19];
	tm[5]= dis_buf[20];
	year[0]= dis_buf[2];
	year[1]= dis_buf[3];
	year[2]= dis_buf[5];
	year[3]= dis_buf[6];
	year[4]= dis_buf[8];
	year[5]= dis_buf[9];
	day = dis_buf[11]; 
	 
	 dayoder = dis_buf[9]; 
	//UART_SendStr(dis_buf,1);
}							 

/*******************************************************************************
** 函数名称 :RTCInit()
** 函数功能 :初始化实时时钟
** 入口参数 :无
** 出口参数 :无
*******************************************************************************/

void RTCInit (void)
{
	PREINT = Fpclk / 32768 - 1;					// 设置基准时钟分频器
	PREFRAC = Fpclk - (Fpclk / 32768) * 32768;
	
	CCR   = 0x00;								// 禁止时间计数器
	
	YEAR  = 2000;
	MONTH = 1;
	DOM   = 1;
	DOW   = 0;
	HOUR  = 0;
	MIN   = 0;
	SEC   = 0;
	
	CIIR = 0x01;								// 设置秒值的增量产生1次中断
	CCR  = 0x01;								// 启动RTC
}

/*******************************************************************************
** 函数名称 :RTCSet()
** 函数功能 :设置实时时钟
** 入口参数 :无
** 出口参数 :无
*******************************************************************************/

void RTCSetDate(uint8 years,uint8 months,uint8 days,uint8 weeks)
{
	PREINT = Fpclk / 32768 - 1;					// 设置基准时钟分频器
	PREFRAC = Fpclk - (Fpclk / 32768) * 32768;
	
	CCR   = 0x00;								// 禁止时间计数器
	
	YEAR  = years+2000;
	MONTH = months;
	DOM   = days;
	DOW   = weeks;
	
	CIIR = 0x01;								// 设置秒值的增量产生1次中断
	CCR  = 0x01;								// 启动RTC
}
void RTCSetTim(uint8 hours,uint8 mins)
{
	PREINT = Fpclk / 32768 - 1;					// 设置基准时钟分频器
	PREFRAC = Fpclk - (Fpclk / 32768) * 32768;
	
	CCR   = 0x00;								// 禁止时间计数器
	
	HOUR  = hours;
	MIN   = mins;
	//SEC   = 10;
	
	CIIR = 0x01;								// 设置秒值的增量产生1次中断
	CCR  = 0x01;								// 启动RTC
}
/**************************************************************************************
			函数名称 fresh 	
			函数功能  刷新界面


***************************************************************************************/ 
  
		void fresh()
  {
  			SendTimeRtc ();
   			Timeupdated(tm);	 	    
			Dateupdated(year);
			Weekupdated(day); 
  }

/*******************************************************
  	    函数名称  rq RTC_Int
		功能       实现时间刷新 
		参数解释		     
*******************************************************/


  void __irq RTC_Int(void)
{	
	if(menuth==0)
	{
		fresh();
	}  
	else
	{
		 //VICIntEnClr |= (1 << 13);		//禁止RTC中断
	}  				
  // ILR = 0x01;						// 清除RTC增量中断标志
    VICVectAddr = 0;				   // 向量中断结束
}

/*******************************************************
  	    函数名称  LPC_SystemInit
		功能       系统初始化
		参数解释		     
*******************************************************/


void LPC_SystemInit(void)
{	




	PINSEL0=0x40000000;              //设置IO口工作模式,P0.15设置为EINT2
	PINSEL0|=0x00300000; 			 //设置IO口工作模式,P0.10设置为AIN3
	PINSEL0|=0x00050005;                         //设置IO连接到UART0、UART1
	PINSEL1=0x00000000;
	LPC_UART_Init();
    U0FCR=0x81;                                 //使能FIFO,并设置触发点为8字节
    U1FCR=0x81;                                 //使能FIFO,并设置触发点为8字节
    U1IER=0x01;                                 //允许UART1的RBR接收中断
	 
     IRQEnable();								//使能中断
	VICIntSelect=0x00000000;	    	//对应的中断请求为IRQ
	//IRQEnable();						//使能IRQ中断
   	EXTMODE=0x00;                    //EINT2电平触发
   	EXTPOLAR=0x00;                   //EINT2低电平有效
   	VICIntEnable=0x00010080;         //VIC通道号16	,分配通道0    UART1中断VIC通道为7
    VICVectCntl0=0x0030;
   	VICVectAddr0=(int)Eint2;
   	
    
    VICVectCntl1=0x27;                          //UART1分配到IRQ Slot0,即优先级最高
    VICVectAddr1=(int)LPC_Receive_Str;
    //VICIntEnable=0x00000080;                    //
   	EXTINT=0x07;                     //清除外部中断标志

	//ADCR   = 0x00200408;                     //Setup A/D: 10-bit AIN3 @ 3MHz 
   	
   	//IODIR |=BEEP;								 		// 设置BEEP控制口为输出 
	//BeepCount(1);  
   	IODIR |=KC0+KC1+KH0+KH1; 					 		// 设置键盘行列线控制口为输出

   	IODIR|=LCDBK;  
	IOCLR|=LCDBK; 
	IODIR|=LED1; 
	IODIR|=LED2;
	IODIR|=LED3;
	IODIR|=LED4; 	       
   	//IOCLR|=LED1;//打开LED1	
	//IOCLR|=LED2;//打开LED2	
	//IOCLR|=LED3;//打开LED3	
	//IOCLR|=LED4;//打开LED4	
   	//Delay(5000);
    IOSET|=LED1;//关闭LED1
	IOSET|=LED2;//关闭LED2
	IOSET|=LED3;//关闭LED3
	IOSET|=LED4;//关闭LED4
	
   		
   	
	vLCDInit(); 
    vCleanAll();
	DisPicture(menu0) ;	//显示欢迎界面
	Delay(25000);


	vCleanAll();
	
	vCheckBusy();
   	
    RTCInit();
    vCleanAll(); //清屏
	 

	DisPicture(menu1) ;				//显示待机页面
    VICIntSelect = 0x00;			// 设置所有中断连接IRQ中断
    VICVectCntl15 = 0x20 | 13;		// 分配通道0
    VICVectAddr15 = (int)RTC_Int;	// 设置中断服务程序地址
    
	
	SendTimeRtc ();
   	Timeupdated(tm);
	Dateupdated(year);
	Weekupdated(day);				   // 向量中断结束
}

 /*******************************************************
  	    函数名称  LPC_SystemInit
		功能       系统初始化
		参数解释		     
*******************************************************/


void LPC_PLC_KeyControl(void)
{	uint8 ReturnKey; 
	if(menuth!=0)
		{             		     		// KC0=KC1=1,列线预置高 
			ReturnKey=KeyNum(); 
			VICIntEnClr |= (1 << 13);		// 禁止RTC中断
		    if(ReturnKey!=0x55) 
			{
				if((ReturnKey==1)||(ReturnKey==2))	//上/左方向键实现下选功能
				{
					if(menuth==1)	//一级菜单
					{
						if(optionth-1>=0)
						{
							optionth=optionth-1;
							vCleanAll();
	 						vDisPicture(menu2,GetLCDPageNum(optionth));
							GetCurrent(optionth);//记录当前选择项
						}
					}
					if(menuth==2)	//二级菜单
					{
						if(optionth-1>=0)
						{
							optionth=optionth-1;
							vCleanAll();
	 						vDisPicture(menu7,GetLCDPageNum(optionth));
							GetCurrent(optionth);//记录当前选择项
						}
					}
					if(menuth==3)	//三级菜单
					{
						if(optionth-1>=0)
						{
							optionth=optionth-1;
							vCleanAll();
	 						vDisPicture(menu4,GetLCDPageNum(optionth));
						}
					}
				}
				if((ReturnKey==3)||(ReturnKey==4))	//下/右方向键实现下选功能
				{
					if((menuth==1)&&(optionth+1<=3))
					{
						optionth=optionth+1;
						vCleanAll();
						vDisPicture(menu2,GetLCDPageNum(optionth));
						GetCurrent(optionth);//记录当前选择项
					}
	    			else if((menuth==2)&&(optionth+1<=4))
					{
						optionth=optionth+1;
						vCleanAll();
						vDisPicture(menu7,GetLCDPageNum(optionth));
						GetCurrent(optionth);//记录当前选择项
					}
					else if((menuth==3)&&(optionth+1<=2))
					{
						optionth=optionth+1;
						vCleanAll();
						vDisPicture(menu4,GetLCDPageNum(optionth));
					}
					else
					{
					//不执行操作
					}
					
				}
			}
		}
		else
		{
			 VICIntEnable |= (1 << 13);		// 使能RTC中断
		}
}
/*******************************************/

int main(void)
{
	
	LPC_SystemInit();//系统初始化

	//RTCSet (30,12,25,5,23,50);
    while(1)
    {
   	 	IOSET|=KC0+KC1;
		//IOCLR=LEDCON;                     	 //Turn on LED1
        //ADTransmit();
      	//delay();                         	
      	//IOSET|=LEDCON;                 		 //Turn off LED1 
      	delay();
		LPC_PLC_KeyControl();					 //矩阵键盘控制逻辑
    }      
}          


LCD.c
/********************************/
											 //****************************************************************************************
//*																						  *
//*		 ***************************LCD12864驱动程序************************			  *
//*																						  *
//*****************************************************************************************
/*注意:CSA = 1 选中左屏,且硬件原理图中LCS2对应CSA
        CSB= 1 选中右屏,且硬件原理图中LCS1对应CSB
*/

#include    "config.h"


//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define LCD12864_WIDTH 128  		//宽度
#define LCD12864_HIGH  64   		//高度
#define LCD12864_PAGE  8    		//页数
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/*
#define LCD12864_CSA (1<<11)		//CSA
#define LCD12864_CSB (1<<12)		//CSB
#define LCD12864_RS	 (1<<13)   		//RS
#define LCD12864_RW	 (1<<14)		//RW
#define LCD12864_EN	 (1<<15)		//EN
*/

#define LCD12864_CSA (1<<19)		//CSA  
#define LCD12864_CSB (1<<24)		//CSB  
#define LCD12864_RS	 (1<<18)   		//RS
#define LCD12864_RW	 (1<<16)		//RW
#define LCD12864_EN	 (1<<17)		//EN


#define LCD12864_BUSY (1<<26)		//BUSY

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define LCD12864_CLR IOCLR			//数据清零
#define LCD12864_SET IOSET			//数据置一
#define LCD12864_DIR IODIR			//端口方向
#define LCD12864_PIN IOPIN			//端口状态

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define LCD12864_SEL0 PINSEL0
#define LCD12864_SEL1 PINSEL1		//端口功能

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define LCD_STARTROW 0xC0			//设置起始行指令
#define LCD_PAGE 	 0xB8			//设置页指令
#define LCD_LINE 	 0x40			//设置列指令

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>



/*******************************************************************************
*名称:Delay()
*功能:延时函数
*******************************************************************************/
void Delay(uint32 x)
{
 	unsigned int i1,j1;
 	for(j1=0;j1<100;j1++)
   	{
    	for(i1=0;i1<x;i1++);
    }
}

//****************************************************************************
//* 名称:vCheckBusy
//* 功能:检查LCD是否忙
//****************************************************************************
void vCheckBusy(void)     
{
	LCD12864_DIR &= 0xF9FFFF03;	    //数据线为输入
	
	while(1)
	{
		LCD12864_CLR=LCD12864_RS;
		LCD12864_SET=LCD12864_RW;
		//LCD12864_SET=0x00FF0000;
		
		LCD12864_SET=LCD12864_EN;
		
		LCD12864_CLR=LCD12864_EN;
		if(!(LCD12864_PIN & LCD12864_BUSY))
			break;
	} 

	LCD12864_DIR |= 0x060000FC;      	//数据线为输出*/ 	
	
}

//****************************************************************************
//* 名称:vWriteCMD
//* 功能:写命令
//****************************************************************************
void vWriteCMD(uint8 ucCMD)
{
	vCheckBusy();	             
	
	LCD12864_CLR=LCD12864_RS;
	LCD12864_CLR=LCD12864_RW;

	LCD12864_CLR=0x060000FC;
	LCD12864_SET=((ucCMD & 0x3F)<<2)+((ucCMD & 0xC0)<<19);
	
	LCD12864_SET=LCD12864_EN;
	LCD12864_CLR=LCD12864_EN;
}

//****************************************************************************
//* 名称:vWriteData
//* 功能:写数据
//****************************************************************************
void vWriteData(uint8 ucData)
{
	vCheckBusy();	              

	LCD12864_SET=LCD12864_RS;
	LCD12864_CLR=LCD12864_RW;

	LCD12864_CLR=0x060000FC;
	LCD12864_SET=((ucData & 0x3F)<<2)+((ucData & 0xC0)<<19);
	
	LCD12864_SET=LCD12864_EN;
	LCD12864_CLR=LCD12864_EN;
}  

//****************************************************************************
//* 名称:vCleanAll
//* 功能:清屏
//****************************************************************************
void vCleanAll(void)
{
	uint8 ucPage,ucLine,nLoop;
	
	LCD12864_SET=LCD12864_CSA;
	LCD12864_SET=LCD12864_CSB;

	    
   
    for(ucPage=0;ucPage<8;ucPage++)
    {
        for(ucLine=0;ucLine<16;ucLine++)
        {
            if(ucLine<8) 
    		{
         		LCD12864_SET=LCD12864_CSA;
         		LCD12864_CLR=LCD12864_CSB;
    		}
    		else 
    		{
         		LCD12864_CLR=LCD12864_CSA;
         		LCD12864_SET=LCD12864_CSB;         
    		}  
    		vWriteCMD(ucPage+0xb8);
    		vWriteCMD((ucLine<8?ucLine:ucLine-8)*8+0x40);    
    		for(nLoop=0;nLoop<8;nLoop++) 
        		vWriteData(0); 	           
        }
    } 
}

//****************************************************************************
//* 名称:vLCDInit
//* 功能:初始化
//****************************************************************************
void vLCDInit(void)
{    
	PINSEL0 &= 0xFFFF000F;		   	//P0.2~P0.7为GPIO
    PINSEL1 &= 0xFFC0FF00;		   	//P0.16~P0.19、P0.24~P0.26为GPIO
	IODIR   |= 0x070F00FC;         	//P0.2~P0.7、P0.24~P0.26、P0.16~P0.19输出
	IOCLR   |= 0x070F00FC;         	//输出初始化零         
		
	vWriteCMD(0x3F);                //开显示
	vWriteCMD(0xC0);                //设置起始地址
	
	vCleanAll();					//清屏  
}



/******************************************************************************************

	名称 DisplayByte
	功能 显示一个字符
	参数解释
			ucPage 显示的起始页数
			ucCol  显示的起始列数
			ucData  要显示的数据


*******************************************************************************************/
void DisplayByte(uint8 ucPage,uint8 ucCol,uint8 ucData)
{	
	
	if(ucCol/ LCD12864_HIGH==0)
	{
		LCD12864_SET=LCD12864_CSA;
		LCD12864_CLR=LCD12864_CSB;
	}
	else{
		LCD12864_CLR=LCD12864_CSA;
		LCD12864_SET=LCD12864_CSB;
	}

													//设置开始的页,列

	vWriteCMD(LCD_PAGE+ucPage);
	vWriteCMD(LCD_LINE+ucCol%LCD12864_HIGH);
	vWriteData(ucData);
	
}


/***************************************************************************************
  名称 	 vDisplayByte
  功能   反显一个字符
  	参数解释
			ucPage 显示的起始页数
			ucCol  显示的起始列数
			ucData  要显示的数据

***************************************************************************************/
void vDisplayByte(uint8 ucPage,uint8 ucCol,uint8 ucData)
{	
	
	if(ucCol/ LCD12864_HIGH==0)
	{
		LCD12864_SET=LCD12864_CSA;
		LCD12864_CLR=LCD12864_CSB;
	}
	else{
		LCD12864_CLR=LCD12864_CSA;
		LCD12864_SET=LCD12864_CSB;
	}

													//设置开始的页,列

	vWriteCMD(LCD_PAGE+ucPage);
	vWriteCMD(LCD_LINE+ucCol%LCD12864_HIGH);
	vWriteData(~ucData);
	
}

//

/*************************************************************************************
	  名称  Displaynum
	  功能  显示一个数字
	  参数解释
	  	ucPage 显示的起始页数
		ucCol  显示的起始列数
		*pDisTable  要显示的数据的指针
	  			 

*************************************************************************************/

void  Displaynum (uint8 ucPage,uint8 ucCol, uint8  *pDisTable )
{
	
			 uint8 i;
			for(i= 0;i<8;i++)	//数字上半部分
			{
			DisplayByte(ucPage,ucCol+i,*(pDisTable+i));
		
			}
			for(i= 0;i<8;i++)	 //数字下半部分
			{
			DisplayByte(ucPage+1,ucCol+i,*(pDisTable+8+i));
		
			}

			pDisTable++;

	  
}

//

//
/*********************************************************************************************
			 名称 Dispsomenum 
			 功能 显示几个数
			 参数解释  ucPage 显示的起始页数
			           ucCol  显示起始列数
					   numcode [] 要显示的数构成的数组
					   pDisTable[][]数字,横线,温度标示字符
					   count       数组里的数字数量


**********************************************************************************************/

   void Dispsomenum (uint8 ucPage,uint8 ucCol,uint8  numcode[], uint8 pDisTable[][16],uint8 count)
{	

	
	// uint8 arrnum;
	 //arrnum=sizeof(numcode)	;
	uint8 i=0;
	for(i= 0;i<count;i++)
	{ if( i==2||i==4)
		{
		Displaynum (ucPage,ucCol+8*i,*(pDisTable+4));
		ucCol+=8;
		Displaynum (ucPage,ucCol+8*i,*(pDisTable+numcode[i]));
		}
	   else
	   {
	   	 Displaynum (ucPage,ucCol+8*i,*(pDisTable+numcode[i]));
	   }
	
	
	}
}
/

//
//****************************************************************************
//* 名称:DispOneChinese
//* 功能:显示一个汉字
//一个汉字需要两页*16列
//*注意:页,列有改变   参数解释
//	           ucPage      显示的起始页
//		     	   ucCol	   显示的起始列
//				   *pDisTable  要显示的汉字的字模数指针
//****************************************************************************

void DispOneChinese(uint8 ucPage,uint8 ucCol,uint8 *pDisTable)
{
	uint8 i=0;
	for(i= 0;i<16;i++)	//汉字上半部分
	{
	DisplayByte(ucPage,ucCol+i,*(pDisTable+i));

	}
	for(i= 0;i<16;i++)	 //汉字下半部分
	{
	DisplayByte(ucPage+1,ucCol+i,*(pDisTable+16+i));

	}
}
//

/****************************************************************************

 	名称:DispChinese
 	功能:显示n个汉字一个汉字需要两页*16列
	注意:  按照这种写法要每个汉字单独取模
	参数解释
      ucPage				 显示的起始页数
      ucCol					 显示的起始列数
      pDisTable[][32]		 显示数据
      Num)					 显示的数字
	      

**********************************************************************************/
void DispChinese(uint8 ucPage,uint8 ucCol,uint8 pDisTable[][32],uint8 Num)
{
	uint8 i=0;
	for(i= 0;i<Num;i++)
		DispOneChinese (ucPage,ucCol+16*i,*(pDisTable+i));
}
  //****************************************************************************

 
/****************************************************************************************
  
 		名称:DispPicture
 		功能:显示一幅图
		注意:最大128*64点阵 ,要提供图形的高度和宽度
		参数解释 
		     *pDisTable  要显示的数据的指针

***********************************************************************************************/
void DisPicture(uint8 *pDisTable)
{	uint8 ucPage=0;
    uint8 ucCol=0;
	uint8 width=128;
	uint8 hight=64;
	uint8 i,j;
	for(i = ucPage;i<ucPage+hight/8;i++)
		for(j = ucCol;j<ucCol+ width;j++)
	
			
		
		  DisplayByte(i,j,*(pDisTable+i*128+j));
		

}
 
/**************************************************************************
    名称   vDisPicture
	功能   显示一个被选中一部分的界面
	参数解释 
	
	 *pDisTable  图像数据的指针
	
	 sur 值作用
	0 1 2 3 4 5 6 7  分别为选中八块中的一块
	12 24 36 48 分别为选中 0 1 页 2 3 页 4 5页 6 7 页



 *****************************************************************************/
 
 void vDisPicture(uint8 *pDisTable,uint8 sur )
{	uint8 ucPage=0;
    uint8 ucCol=0;
	uint8 width=128;
	uint8 hight=64;
	uint8 i,j;
	
	   if(sur>=0&sur<=7  )
	   {
		for(i = ucPage;i<ucPage+hight/8;i++)
		{
					for(j = ucCol;j<ucCol+ width;j++)
					{
							if( (i>=(sur/2)*2)&&(i<=(sur/2)*2+1))	
							   
								{	
								  if(j>=64*(sur%2)&&j<=64*(sur%2)+63)
								  {
								vDisplayByte(i,j,*(pDisTable+i*128+j));
								
								 }
								  else
								  {DisplayByte(i,j,*(pDisTable+i*128+j));}
								
								}
							 else
							 { DisplayByte(i,j,*(pDisTable+i*128+j));
							  }
					  }
		 }

		}
	else
	{
		for(i = ucPage;i<ucPage+hight/8;i++)
		{
					for(j = ucCol;j<ucCol+ width;j++)
					{
							if( i>=((sur-12)/12)*2&&i<=((sur-12)/12)*2+1)	
							   
								{	
								  
								vDisplayByte(i,j,*(pDisTable+i*128+j));
								
								 }
								 
								
							
							 else
							 { DisplayByte(i,j,*(pDisTable+i*128+j));
							  }
					  }
		 }
	
	}
	 }


 ///


LCD12864.c
/**************************/
 //****************************************************************************************
//*																						  *
//*		 ***************************LCD12864驱动程序************************			  *
//*																						  *
//*****************************************************************************************
/*注意:CSA = 1 选中左屏,且硬件原理图中LCS2对应CSA
        CSB= 1 选中右屏,且硬件原理图中LCS1对应CSB
*/
#include  "config.h"
#include "lcd12864.h"



//****************************************************************************
//* 名称:vCheckBusy
//* 功能:检查LCD是否忙
//****************************************************************************
void vCheckBusy(void)     
{
	LCD12864_DIR &= 0xF9FFFF03;	    //数据线为输入
	
	while(1)
	{
		LCD12864_CLR=LCD12864_RS;
		LCD12864_SET=LCD12864_RW;
		
		LCD12864_SET=LCD12864_EN;	
		LCD12864_CLR=LCD12864_EN;
		if(!(LCD12864_PIN & LCD12864_BUSY))
			break;
	} 

	LCD12864_DIR |= 0x060000FC;      	//数据线为输出*/ 	
	
}

//****************************************************************************
//* 名称:vWriteCMD
//* 功能:写命令
//****************************************************************************
void vWriteCMD(uint8 ucCMD)
{
	vCheckBusy();	             
	
	LCD12864_CLR=LCD12864_RS;
	LCD12864_CLR=LCD12864_RW;

	LCD12864_CLR=0x060000FC;
	LCD12864_SET=((ucCMD & 0x3F)<<2)+((ucCMD & 0xC0)<<19);
	
	LCD12864_SET=LCD12864_EN;
	LCD12864_CLR=LCD12864_EN;
}

//****************************************************************************
//* 名称:vWriteData
//* 功能:写数据
//****************************************************************************
void vWriteData(uint8 ucData)
{
	vCheckBusy();	              

	LCD12864_SET=LCD12864_RS;
	LCD12864_CLR=LCD12864_RW;

	LCD12864_CLR=0x060000FC;
	LCD12864_SET=((ucData & 0x3F)<<2)+((ucData & 0xC0)<<19);
	
	LCD12864_SET=LCD12864_EN;
	LCD12864_CLR=LCD12864_EN;
}  

//****************************************************************************
//* 名称:vCleanAll
//* 功能:清屏
//****************************************************************************
void vCleanAll(void)
{
	uint8 ucPage,ucLine,nLoop;
	
	LCD12864_SET=LCD12864_CSA;
	LCD12864_SET=LCD12864_CSB;

	    
   
    for(ucPage=0;ucPage<8;ucPage++)
    {
        for(ucLine=0;ucLine<16;ucLine++)
        {
            if(ucLine<8) 
    		{
         		LCD12864_SET=LCD12864_CSA;
         		LCD12864_CLR=LCD12864_CSB;
    		}
    		else 
    		{
         		LCD12864_CLR=LCD12864_CSA;
         		LCD12864_SET=LCD12864_CSB;         
    		}  
    		vWriteCMD(ucPage+0xb8);
    		vWriteCMD((ucLine<8?ucLine:ucLine-8)*8+0x40);    
    		for(nLoop=0;nLoop<8;nLoop++) 
        		vWriteData(0); 	           
        }
    } 
}

//****************************************************************************
//* 名称:vLCDInit
//* 功能:初始化
//****************************************************************************
void vLCDInit(void)
{    
	PINSEL0 &= 0xFFFF000F;		   	//P0.2~P0.7为GPIO
    PINSEL1 &= 0xFFC0FF00;		   	//P0.16~P0.19、P0.24~P0.26为GPIO
	IODIR   |= 0x070F00FC;         	//P0.2~P0.7、P0.24~P0.26、P0.16~P0.19输出
	IOCLR   |= 0x070F00FC;         	//输出初始化零         
		
	vWriteCMD(0x3F);                //开显示
	vWriteCMD(0xC0);                //设置起始地址
	vCleanAll();					//清屏  
}


//****************************************************************************
//* 名称:Show88
//* 功能:显示8*8点阵字符
//* 参数:x_add:行(0-7), y_add: 列(0-15),*po : 字模首址
//****************************************************************************
void Show88(uint8 x_add,uint8 y_add,const uint8 *po)
{ 
    uint8 nLoop,ucPage,ucLine;

    ucPage=x_add+0xb8;
    ucLine=(y_add<8?y_add:y_add-8)*8+0x40;

    if(y_add>16) 
        return;

    if(y_add<8) 
    {
         LCD12864_SET=LCD12864_CSA;
         LCD12864_CLR=LCD12864_CSB;
    }
    else 
    {
         LCD12864_CLR=LCD12864_CSA;
         LCD12864_SET=LCD12864_CSB;         
    }

    vWriteCMD(ucPage);
    vWriteCMD(ucLine); 
    
    
    for(nLoop=0;nLoop<8;nLoop++) 
        vWriteData(*po++); 	
        
    LCD12864_CLR=LCD12864_CSA;
    LCD12864_CLR=LCD12864_CSB;  
}

//****************************************************************************
//* 名称:ShowFullScreenBmp
//* 功能:显示128*64图片
//* 参数:*po : 字模首址
//****************************************************************************
void ShowFullScreenBmp(const uint8 *po)
{ 
    uint8 nChar,ucPage;      
  
    for(ucPage=0;ucPage<8;ucPage++)
    {
        for(nChar=0;nChar<16;nChar++)
        {
            Show88(ucPage,nChar,&po[nChar*8+ucPage*128]);             
        }
    }   
} 

//****************************************************************************
//* 名称:ShowPicture
//* 功能:在指定位置显示任意大小图片
//* 参数:PageAddr : 开始页地址
//*       YAddr    : 开始列地址
//*       pixelsX  : 像素点行
//*       pixelsY  : 像素点列
//*       *po      : 字模首址
//****************************************************************************
void ShowPicture(uint8 PageAddr,uint8 YAddr,uint8 pixelsX,uint8 pixelsY,const uint8 *po)
{ 
    uint8 nLoop1,nLoop2;
    uint8 ZScrFlag;
    
    //vWriteCMD(PageAddr/8+0xb8);         
 
    for(nLoop2=0;nLoop2<(pixelsY/8+1);nLoop2++)
    {  
        if(YAddr<64)
        {
            LCD12864_SET=LCD12864_CSA;
            LCD12864_CLR=LCD12864_CSB;            
            vWriteCMD(YAddr+0x40);                    
            ZScrFlag=1;
        } 
        else
        { 
            LCD12864_CLR=LCD12864_CSA;
            LCD12864_SET=LCD12864_CSB;            
            vWriteCMD(YAddr-64+0x40);           
            ZScrFlag=0;
        }       

        for(nLoop1=0;nLoop1<pixelsX;nLoop1++)
        { 
            if(ZScrFlag)
            {
                if((nLoop1+YAddr)>63)
                {
                    LCD12864_CLR=LCD12864_CSA;
                    LCD12864_SET=LCD12864_CSB;
                    vWriteCMD(0x40);                  
                    ZScrFlag=0;
                }
            }
            vWriteCMD(PageAddr+nLoop2+0xb8);            
            vWriteData(*po++);                      
        }         
    }

    LCD12864_CLR=LCD12864_CSA;
    LCD12864_CLR=LCD12864_CSB; 
}

//****************************************************************************
//* 名称:vShowNum
//* 功能:显示8*16字符或16*16汉字
//****************************************************************************
void DispChOrCi(uint8 Flag,uint8 x_add,uint8 y_add,const uint8 *po)
{
	uint8 nLoop,ucPage,ucLine;

	ucPage=x_add*2+0xb8;

    if(Flag==0)                                  // 16*16汉字
	{
    	ucLine=(y_add<4?y_add:y_add-4)*16+0x40;
       	
        if(y_add<4)
        {
            LCD12864_SET=LCD12864_CSA;
            LCD12864_CLR=LCD12864_CSB;
        }
        else
        {
            LCD12864_SET=LCD12864_CSB;
            LCD12864_CLR=LCD12864_CSA;
        }
     }

     if(Flag==1)                                  // 8*16字符
     {
        ucLine=(y_add<8?y_add:y_add-8)*8+0x40;
        
        if(y_add<8)
        {
            LCD12864_SET=LCD12864_CSA;
            LCD12864_CLR=LCD12864_CSB;
        }
        else
        {
            LCD12864_SET=LCD12864_CSB;
            LCD12864_CLR=LCD12864_CSA;
        }
     }
	 vWriteCMD(ucPage);
     vWriteCMD(ucLine);
     
     if(Flag==0)
     {
        for(nLoop=0;nLoop<32;nLoop++)
	    {
	        if(nLoop==16)
	        {
		        vWriteCMD(ucPage+1);
                vWriteCMD(ucLine);
	        }
            vWriteData(*po++); 	        
	    }
     }

     if(Flag==1)
     {
        for(nLoop=0;nLoop<16;nLoop++)
	    { 
            if(nLoop==8)
	        {
		        vWriteCMD(ucPage+1);
                vWriteCMD(ucLine);
	        }
            vWriteData(*po++);             
        }
     }
	 
     LCD12864_CLR=LCD12864_CSA;
     LCD12864_CLR=LCD12864_CSB;
}


uint8 readbyte(uint8 x,uint8 y)
{
	
	uint8 temp8;
	uint32 temp32;
	vCheckBusy();	
	 if(y/64 == 0)
		{
	 	LCD12864_SET=LCD12864_CSB;
        LCD12864_CLR=LCD12864_CSA;
      }
      else {
      
      	
        LCD12864_SET=LCD12864_CSA;
     	LCD12864_CLR=LCD12864_CSB;
      }
      
     vWriteCMD(x+0xb8);
     vWriteCMD(y+0x40);
                  
	IODIR &= 0xf9ffff03;P0.2~P0.7、P0.25~P0.26
	LCD12864_SET=LCD12864_RS;
	LCD12864_SET=LCD12864_RW;

	//LCD12864_CLR=0x060000FC;
	//LCD12864_SET=((ucCMD & 0x3F)<<2)+((ucCMD & 0xC0)<<19);
	
	LCD12864_SET=LCD12864_EN;
	temp32 = IOPIN ;
	temp8 = temp32>>2|temp32>>25<<6;
	LCD12864_CLR=LCD12864_EN;
	
	IODIR   |= 0x070F00FC;         	//P0.2~P0.7、P0.24~P0.26、P0.16~P0.19输出
      
	return temp8;


}

void writebyte(uint8 x,uint8 y,uint8 data)
{
 	 vWriteCMD(0xb8+x);
    
	 if(y/64 == 0)
		{
		
		 LCD12864_SET=LCD12864_CSA;
     	LCD12864_CLR=LCD12864_CSB;
	 	
      }
      else {
      LCD12864_SET=LCD12864_CSB;
        LCD12864_CLR=LCD12864_CSA;
      	
       
      }
     
       vWriteCMD(0x40+y%64); 
	 vWriteData(data);
	

}



end of file//

plccontrol.c
/**************************/
#include "config.h"
#include "define.h"
#include "init.h"

extern uint8 Pack[8];
extern PLC_Send(void);			//发送包信息给上位机
void nvdPackagingData(void);
extern void RTCSetDate(uint8 years,uint8 months,uint8 days,uint8 weeks);
extern void RTCSetTim(uint8 hours,uint8 mins);
uint8 Send[8];
uint8 Date[6];
enum app{Light=0x01,Ice=0x04,Warter=0x20,Air=0x40};
enum state{close=0x10,open=0x11};
enum time{date=0x40,tim=0x00};


void PLC_SendAllInfo(void)		//发送所有当前状态信息	电器开关状态、定时状态、光照、温度。
{
	nvdPackagingData();
}

void PLC_AppControl(void)		//家电开关控制
{
	uint8 Appinfo,State;
	Appinfo=Pack[1];
	State=Pack[2];
	switch(Appinfo)
	{
		case Light:			 		//电灯	LED1CON
		{
			if(State==open)
				IOCLR |= LED1;   //turn on led1
			else 
				IOSET |= LED1;	//turn off led1	
			break;
		}
		case Air:					//空调	LED2CON
		{
			if(State==open)
				IOCLR |= LED2;	//turn on led2
			else 
				IOSET |= LED2;	//turn off led2
			break;
		}
		case Warter:					//热水器  LED3CON		
		{
			if(State==open)
				IOCLR |= LED3;	 //turn on led3
			else 
				IOSET |= LED3;	 //turn off led3
			break;
		}
		case Ice:					//冰箱	LED4CON 	
		{
			if(State==open)
				IOCLR |= LED4;	//turn on led4
			else 
				IOSET |= LED4;	//turn off led4
			break;
		}
		default :
		{
			break;
		}		
	}
}

void AppTiming(uint8 app,uint8 state,uint8 start,uint8 end)	//定时函数
{
	
}
void PLC_AppTime(void)			//家电定时控制
{
	
}

void PLC_Timer(void)		//设置系统时间
{
	uint8 Timerinfo;
	Timerinfo=Pack[1];
	switch(Timerinfo)
	{
		case date:			 		//得到日期
		{
			Date[0]=Pack[2];
			Date[1]=Pack[3];
			Date[2]=Pack[4];
			Date[3]=Pack[5];
			Date[3]=Date[3]-1;
			RTCSetDate(Date[0],Date[1],Date[2],Date[3]);
			break;
		}
		case tim:					//得到实时间
		{
			Date[4]=Pack[2];
			Date[5]=Pack[3];
			RTCSetTim(Date[4],Date[5]);
			break;
		}

		default :
		{
			break;
		}			
	}
}

void PLC_SetCritical(void)		//设置临界值(温度、时间)
{

}



void CheckLed(uint32 led,uint8 app)	//判断家电开关,打包发送
{
	uint32 i;
	i=IOSET;
	Send[0]=66;
	Send[1]=app;
	if(i&led==0)
	{
		Send[2]=close;	
	}
	else
	{
		Send[2]=open;
	}
	PLC_Send();
}

void nvdPackagingData(void)
{
	CheckLed(LED1,Light);		//判断电灯是否开着,打包发送
	CheckLed(LED2,Air);		    //判断空调是否开着,打包发送
	CheckLed(LED3,Warter);	    //判断热水器是否开着,打包发送
	CheckLed(LED4,Ice);		    //判断冰箱是否开着,打包发送
}

target.c
/****************************/
/****************************************Copyright (c)**************************************************
**                               Guangzou ZLG-MCU Development Co.,LTD.
**                                      graduate school
**                                 http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name:			target.c
** Last modified Date:	2004-09-17
** Last Version:		1.0
** Descriptions:		header file of the specific codes for LPC2100 target boards
**						Every project should include a copy of this file, user may modify it as needed
**------------------------------------------------------------------------------------------------------
** Created by:			Chenmingji
** Created date:		2004-02-02
** Version:				1.0
** Descriptions:		The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by:			Chenmingji
** Modified date:		2004-09-17
** Version:				1.01
** Descriptions:		Renewed the template, added more compiler supports 
**
**------------------------------------------------------------------------------------------------------
** Modified by: 
** Modified date:
** Version:	
** Descriptions: 
**
********************************************************************************************************/

#define IN_TARGET
#include "config.h"

/*********************************************************************************************************
** Function name:			IRQ_Exception
**
** Descriptions:			interrupt exceptional handler , change it as needed
**
** input parameters:		None
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
        void __irq IRQ_Exception(void)
{
    while(1);                   //  change it to your code 这一句替换为自己的代码
}

/*********************************************************************************************************
** Function name:			FIQ_Exception
**
** Descriptions:			Fast interrupt exceptional handler , change it as needed
**
** input parameters:		None
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
        void FIQ_Exception(void)
{
    while(1);                   // change it to your code  这一句替换为自己的代码
}

/*********************************************************************************************************
** Function name:			TargetInit
**
** Descriptions:			Initialize the target board; it is called in a necessary place, change it as 
**							needed
**
** input parameters:		None
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
       void TargetInit(void)
{
    /* 添加自己的代码 */
    /* Add your codes here */
}

/*********************************************************************************************************
** Function name:			TargetResetInit
**
** Descriptions:			Initialize the target board before running the main() function; User may
**							change it as needed, but may not deleted it.
**
** input parameters:		None
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
        void TargetResetInit(void)
{
#ifdef __DEBUG_RAM    
    MEMMAP = 0x2;                   //remap
#endif

#ifdef __DEBUG_FLASH    
    MEMMAP = 0x1;                   //remap
#endif

#ifdef __IN_CHIP    
    MEMMAP = 0x1;                   //remap
#endif

/* 设置系统各部分时钟 */
/* Set system timers for each component */
    PLLCON = 1;
#if (Fpclk / (Fcclk / 4)) == 1
    VPBDIV = 0;
#endif
#if (Fpclk / (Fcclk / 4)) == 2
    VPBDIV = 2;
#endif
#if (Fpclk / (Fcclk / 4)) == 4
    VPBDIV = 1;
#endif

#if (Fcco / Fcclk) == 2
    PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5);
#endif
#if (Fcco / Fcclk) == 4
    PLLCFG = ((Fcclk / Fosc) - 1) | (1 << 5);
#endif
#if (Fcco / Fcclk) == 8
    PLLCFG = ((Fcclk / Fosc) - 1) | (2 << 5);
#endif
#if (Fcco / Fcclk) == 16
    PLLCFG = ((Fcclk / Fosc) - 1) | (3 << 5);
#endif

    PLLFEED = 0xaa;
    PLLFEED = 0x55;
    while((PLLSTAT & (1 << 10)) == 0);
    PLLCON = 3;
    PLLFEED = 0xaa;
    PLLFEED = 0x55;
    
    /* 设置存储器加速模块 */
    /* Set memory accelerater module*/
    MAMCR = 0;
#if Fcclk < 20000000
    MAMTIM = 1;
#else
#if Fcclk < 40000000
    MAMTIM = 2;
#else
    MAMTIM = 3;
#endif
#endif
    MAMCR = 2;
    
    /* 初始化VIC */
    /* initialize VIC*/
    VICIntEnClr = 0xffffffff;
    VICVectAddr = 0;
    VICIntSelect = 0;

    /* 添加自己的代码 */
    /* Add your codes here */

}

/*********************************************************************************************************
**                  以下为一些与系统相关的库函数的实现
**                  具体作用请ads的参考编译器与库函数手册
**                  用户可以根据自己的要求修改        
********************************************************************************************************/
/*********************************************************************************************************
**                  The implementations for some library functions
**                  For more details, please refer to the ADS compiler handbook and The library 
**					function manual
**                  User could change it as needed       
********************************************************************************************************/
#include <rt_sys.h>
#include <stdio.h>

#pragma import(__use_no_semihosting_swi)

        int __rt_div0(int a)
{
    a = a;
    return 0;
}

        int fputc(int ch,FILE *f)
{
    ch = ch;
    f = f;
    return 0;
}

    int fgetc(FILE *f)
{
    f = f;
    return 0;
}


        int _sys_close(FILEHANDLE fh)
{
    fh = fh;
    return 0;
}

        int _sys_write(FILEHANDLE fh, const unsigned char * buf,
                      unsigned len, int mode)
{
    fh = fh;
    buf = buf;
    len =len;
    mode = mode;
    return 0;
}
        int _sys_read(FILEHANDLE fh, unsigned char * buf,
                     unsigned len, int mode)
{
    fh = fh;
    buf = buf;
    len =len;
    mode = mode;
    
    return 0;
}

       void _ttywrch(int ch)
{
    ch = ch;
}

        int _sys_istty(FILEHANDLE fh)
{
    fh = fh;
    return 0;
}
        int _sys_seek(FILEHANDLE fh, long pos)
{
    fh = fh;
    return 0;
}
        int _sys_ensure(FILEHANDLE fh)
{
    fh = fh;
    return 0;
}

        long _sys_flen(FILEHANDLE fh)
{
    fh = fh;
    return 0;
}
       int _sys_tmpnam(char * name, int sig, unsigned maxlen)
{
    name = name;
    sig = sig;
    maxlen = maxlen;
    return 0;
}

        void _sys_exit(int returncode)
{
    returncode = returncode;
}

        char *_sys_command_string(char * cmd, int len)
{
    cmd = cmd;
    len = len;
    return 0;
}  


/*********************************************************************************************************
**                            End Of File
********************************************************************************************************/
config.h
/*****************************/
/****************************************Copyright (c)**************************************************
**                               Guangzou ZLG-MCU Development Co.,LTD.
**                                      graduate school
**                                 http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File Name: config.h
** Last modified Date:  2004-09-17
** Last Version: 1.0
** Descriptions: User Configurable File
**
**------------------------------------------------------------------------------------------------------
** Created By: Chenmingji
** Created date:   2004-09-17
** Version: 1.0
** Descriptions: First version
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
********************************************************************************************************/
#ifndef __CONFIG_H 
#define __CONFIG_H

//This segment should not be modified
#ifndef TRUE
#define TRUE  1
#endif

#ifndef FALSE
#define FALSE 0
#endif

typedef unsigned char  uint8;                   /* defined for unsigned 8-bits integer variable 	无符号8位整型变量  */
typedef signed   char  int8;                    /* defined for signed 8-bits integer variable		有符号8位整型变量  */
typedef unsigned short uint16;                  /* defined for unsigned 16-bits integer variable 	无符号16位整型变量 */
typedef signed   short int16;                   /* defined for signed 16-bits integer variable 		有符号16位整型变量 */
typedef unsigned int   uint32;                  /* defined for unsigned 32-bits integer variable 	无符号32位整型变量 */
typedef signed   int   int32;                   /* defined for signed 32-bits integer variable 		有符号32位整型变量 */
typedef float          fp32;                    /* single precision floating point variable (32bits) 单精度浮点数(32位长度) */
typedef double         fp64;                    /* double precision floating point variable (64bits) 双精度浮点数(64位长度) */

/********************************/
/*      ARM specital code      */
/*      ARM的特殊代码           */
/********************************/
//This segment should not be modify
//这一段无需改动

#include    "LPC2103.h"


/********************************/
/*Application Program Configurations*/
/*     应用程序配置             */
/********************************/
//This segment could be modified as needed.
//以下根据需要改动

/********************************/
/*Configuration of the example */
/*     本例子的配置             */
/********************************/
/* System configuration .Fosc、Fcclk、Fcco、Fpclk must be defined */
/* 系统设置, Fosc、Fcclk、Fcco、Fpclk必须定义*/
#define Fosc            11059200                   //Crystal frequence,10MHz~25MHz,should be the same as actual status. 
						    //应当与实际一至晶振频率,10MHz~25MHz,应当与实际一至
#define Fcclk           (Fosc * 4)                  //System frequence,should be (1~32)multiples of Fosc,and should be equal or less  than 60MHz. 
						    //系统频率,必须为Fosc的整数倍(1~32),且<=60MHZ
#define Fcco            (Fcclk * 4)                 //CCO frequence,should be 2、4、8、16 multiples of Fcclk, ranged from 156MHz to 320MHz. 
						    //CCO频率,必须为Fcclk的2、4、8、16倍,范围为156MHz~320MHz
#define Fpclk           (Fcclk / 4) * 1             //VPB clock frequence , must be 1、2、4 multiples of (Fcclk / 4).
						    //VPB时钟频率,只能为(Fcclk / 4)的1、2、4倍

#include    "target.h"              //This line may not be deleted 这一句不能删除

#endif
/*********************************************************************************************************
**                            End Of File
********************************************************************************************************/
define.h
/****************************/
#ifndef _DEFINE_H
#define _DEFINE_H

//基本原则:0-7的第七位不能出现1,除了结束位不能出现0A

/*******************************************
* 定义命令类型  0x00  为填充字节
*******************************************/
#define CONNECT_CMD                    0x10          //连接管理命令
#define REQUEST_CMD                    0x20          //上位机请求命令
#define RESPONSE_CMD                   0x40          //下位机响应命令
#define SURE_CMD                       0x60          //双方收到命令后,响应命令

/******************************************
*CONNECT
******************************************/
#define CONNECT                        0x11          //建立连接命令
#define UNCONNECT                      0x12          //断开连接命令

/******************************************
*REQUEST        //  上位机向下位机发送
******************************************/
#define GET_ALL_INFO					0x21          //获取所有信息
#define CONTROL							0x22          //控制开关
#define SET_TIMER						0x24          //设置定时
#define SET_CRITICAL					0x28         //设置临界度(包括温度、光度)
#define SET_CLOCK						0x26          //设置时钟

/******************************************
*RESPONSE       //  上位机收到下位机的发送
******************************************/
#define EVENT                          0x48          //突发事件响应
#define CMD_SUCCESS                    0x41          //命令执行成功
#define INFO                          0x42          //返回所有家电状态信息,包括开关
#define INFO_TIMER                    0x46          //返回某家电定时信息(1用来检测成功与否)
#define INFO_CRITICAL                 0x44          //返回光亮,温度临界点
#define INFO_TIME_OF_MACHINE           0x45          //返回机器的时间
/******************************************
*SURE_CMD
******************************************/
#define CMD_OK                         0x61          //命令收到
#define CMD_ERROR                      0x62          //命令有错,重传

/******************************************
*
*******************************************/
init.h
/***********************/
#ifndef __init_h
#define __init_h
/*
void PLC_SendAllInfo(void);		//发送所有当前状态信息
void PLC_AppControl(void);		//家电开关控制
void PLC_AppTime(void);			//家电定时控制
void PLC_Timer(void);		//设置系统时间
void PLC_SetCritical(void);		//设置临界值(温度、时间)
void nvdPackagingData(void);	//将当前电器各个状态打包
void PLC_send(void);			//发送包信息给上位机
*/
#define  LED1    0x00000800		  //P0.11引脚控制LED1,低电平点亮
#define  LED2    0x00001000		  //P0.12引脚控制LED2,低电平点亮
#define  LED3    0x00002000		  //P0.13引脚控制LED3,低电平点亮
#define  LED4    0x00004000		  //P0.14引脚控制LED4,低电平点亮
//数据结构体
typedef struct 
{
	uint8 cmd;			//命令标志
    uint8 cmd_info;		//命令信息
    uint8 option_first;		//可选择的信息1
    uint8 option_second;	//可选择的信息2
	uint8 option_third;		//可选择的信息1
    uint8 option_four;	//可选择的信息2
    uint8 check;			//校验
	uint8 end;			//结束标志  暂时定位  0A 表示回车	
}receiveData;

typedef struct
{
	uint8 cmd;		   			//命令标志
	uint8 cmd_info;				//命令信息
	uint8 option_first;			//可选择的信息1
	uint8 option_second;		//可选择的信息2
	uint8 option_third;			//可选择的信息3
	uint8 option_fourth;		//可选择的信息4
	uint8 check;				//校验
	uint8 end;					//结束标志  暂时定位  0A 表示回车
}Commond;

typedef struct 
{
	uint8 AppInfo;
	uint8 StartTime;
	uint8 EndTime;
}Timing;
#endif

#endif


LCD12864.h
/********************************/
//***************************************************************************
//*																	   		*
//*		**************************LCD12864驱动**************************  	*
//*																	   		*
//***************************************************************************
#ifndef __LCD12864_H__
#define __LCD12864_H__

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define LCD12864_WIDTH 128  //宽度
#define LCD12864_HIGH  64   //高度
#define LCD12864_PAGE  8    //页数

#define     LEDCON    0x00000800     //P0.11 引脚控制LED,低电平点亮
#define     LCDBK     0x00008000     //P0.15 引脚控制LCDBK,高电平使能

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define LCD12864_WIDTH 128  		//宽度
#define LCD12864_HIGH  64   		//高度
#define LCD12864_PAGE  8    		//页数
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


#define LCD12864_CSA (1<<19)		//CSA  
#define LCD12864_CSB (1<<24)		//CSB  
#define LCD12864_RS	 (1<<18)   		//RS
#define LCD12864_RW	 (1<<16)		//RW
#define LCD12864_EN	 (1<<17)		//EN


#define LCD12864_BUSY (1<<26)		//BUSY

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define LCD12864_CLR IOCLR			//数据清零
#define LCD12864_SET IOSET			//数据置一
#define LCD12864_DIR IODIR			//端口方向
#define LCD12864_PIN IOPIN			//端口状态

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define LCD12864_SEL0 PINSEL0
#define LCD12864_SEL1 PINSEL1		//端口功能

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define LCD_STARTROW 0xC0			//设置起始行指令
#define LCD_PAGE 	 0xB8			//设置页指令
#define LCD_LINE 	 0x40			//设置列指令

typedef unsigned char INT8U;                   /* defined for unsigned 8-bits integer variable 	无符号8位整型变量  */
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

typedef struct cursor
{
	INT8U ucXPos;
	INT8U ucPage;
}CURSOR;					//光标结构体

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
typedef struct LCD
{
	INT8U *pucaBuffer;
	CURSOR stCursor;		//液晶结构体
}LCD;
								  	
extern LCD st_LCD12864;		//12864结构

void vWriteCMD(uint8 ucCMD);
void vWriteData(uint8 ucData);
void vCleanAll(void);
void vLCDInit(void);
void vCheckBusy(void)  ;
void Show88(uint8 x_add,uint8 y_add,const uint8 *po);
void ShowFullScreenBmp(const uint8 *po); 
void ShowPicture(uint8 PageAddr,uint8 YAddr,uint8 pixelsX,uint8 pixelsY,const uint8 *po);
void DispChOrCi(uint8 Flag,uint8 x_add,uint8 y_add,const uint8 *po);
uint8 readbyte(uint8 x,uint8 y);
void writebyte(uint8 x,uint8 y,uint8 data);
#endif


lcd.h
/****************************/
 		//***************************************************************************
//*																	   		*
//*		**************************LCD12864驱动**************************  	*
//*																	   		*
//***************************************************************************

#ifndef __LCD12864_H__
#define __LCD12864_H__
#include    "LPC2103.h"

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
typedef unsigned char  uint8;                   /* defined for unsigned 8-bits integer variable 	无符号8位整型变量  */
typedef signed   char  int8;                    /* defined for signed 8-bits integer variable		有符号8位整型变量  */
typedef unsigned short uint16;                  /* defined for unsigned 16-bits integer variable 	无符号16位整型变量 */
typedef signed   short int16;                   /* defined for signed 16-bits integer variable 		有符号16位整型变量 */
typedef unsigned int   uint32;                  /* defined for unsigned 32-bits integer variable 	无符号32位整型变量 */
typedef signed   int   int32;                   /* defined for signed 32-bits integer variable 		有符号32位整型变量 */
typedef float          fp32;                    /* single precision floating point variable (32bits) 单精度浮点数(32位长度) */
typedef double         fp64;                    /* double precision floating point variable (64bits) 双精度浮点数(64位长度) */

typedef unsigned char  uint8	  ;
//欢迎同学,每个字分别取的字模,否则字模工具是按照单行来取的字节
//注意在工程中字模数据要放到c文件中!!!!!!!

  uint8 num[]=
{
/*------------------------------------------------------------------------------
  源文件 / 文字 : 2
  宽×高(像素): 8×16
------------------------------------------------------------------------------*/
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00

};
/***********************************************************************************
*******************************************************************************/
uint8 week[][32]=
{
	{  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
  },	  // 周一
	{  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
  },	  //  周二
	{ 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
   },	   //  周三
	{  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
   },   //	周四
	{   0x00,0x02,0x82,0x82,0x82,0x82,0xFE,0x82,0x82,0x82,0xC2,0x82,0x02,0x00,0x00,0x00,
0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x30,0x20,0x00
  },   //	周五
	{ 0x10,0x10,0x10,0x10,0x10,0x91,0x12,0x1E,0x94,0x10,0x10,0x10,0x10,0x10,0x10,0x00,
0x00,0x40,0x20,0x10,0x0C,0x03,0x01,0x00,0x00,0x01,0x02,0x0C,0x78,0x30,0x00,0x00
    },   //	 周六
	{  0x00,0x00,0x00,0xFE,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x00
   }	   //	  周日




}  ;






/*********************************************************************************************




************************************************************************************************/

	uint8 degree[]=
{
/*------------------------------------------------------------------------------
  源文件 / 文字 : 度
  宽×高(像素): 16×16
------------------------------------------------------------------------------*/
0x00,0x00,0xFC,0x04,0x24,0x24,0xFC,0xA5,0xA6,0xA4,0xFC,0x24,0x24,0x24,0x04,0x00,
0x80,0x60,0x1F,0x80,0x80,0x42,0x46,0x2A,0x12,0x12,0x2A,0x26,0x42,0xC0,0x40,0x00
};



/**************************************************************************************************************
提供0—9 横线  温度标示的字模

****************************************************************************************************************/
 uint8 snum[][16]=
 {
  { 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00	},//0


   {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},//1

   {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00},//2
   {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00},//3
   {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00},//4
   {0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00},//5
   {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00},//6
   {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00},//7
   {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00},//8
   {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00},//9
   {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01},//-
   {0xC7,0x33,0x0B,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00}, //度
   {0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00 }//冒号
 
 
 
 };
 /**********************************************************************************************************
  电器全关界面字模


 *************************************************************************************************************/

 
	 uint8 dianqiguan[]=
{
/*------------------------------------------------------------------------------
  源文件 / 文字 : C:\Documents and Settings\new\My Documents\My Pictures\dianqiguan.bmp-
  宽×高(像素): 128×64
------------------------------------------------------------------------------*/
0x00,0x84,0xE4,0x5C,0x44,0xC4,0x10,0xF8,0x97,0x92,0xF2,0x9A,0x96,0xF2,0x00,0x00,
0x00,0x10,0x0C,0xA4,0x24,0x24,0x25,0xE6,0x24,0x24,0x24,0x24,0x14,0x0C,0x04,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,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,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,0x00,
0x01,0x00,0x3F,0x08,0x88,0x4F,0x30,0x0F,0x04,0x04,0x3F,0x44,0x84,0x7F,0x00,0x00,
0x40,0x20,0x18,0x07,0x08,0x10,0x20,0x7F,0x42,0x42,0x42,0x42,0x40,0x40,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,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,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,0x00,0x00,
0x40,0x42,0xDC,0x08,0x00,0x00,0xFE,0x52,0x92,0x12,0x12,0x92,0x73,0x02,0x00,0x00,
0x00,0xFE,0x02,0x02,0xF2,0x12,0x12,0x12,0x12,0x12,0xF2,0x02,0x02,0xFE,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,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,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,0x00,0x00,
0x40,0x20,0x1F,0x20,0x48,0x46,0x51,0x50,0x48,0x45,0x42,0x45,0x48,0x50,0x00,0x00,
0x00,0x7F,0x40,0x40,0x47,0x44,0x44,0x44,0x44,0x44,0x47,0x40,0x40,0x7F,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,0x00,0x00
};


 /***********************************************************************************

开机界面字模

************************************************************************************/
 uint8 menu0  []=
{
/*------------------------------------------------------------------------------
  源文件 / 文字 : C:\Documents and Settings\new\My Documents\My Pictures\kaiji.bmp-
  宽×高(像素): 128×64
------------------------------------------------------------------------------*/
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,
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,
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,
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,
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,
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,
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,
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,
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,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0xC0,0xE0,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,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,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x40,0xC0,0xC0,0xC0,0x40,0x00,0x40,0xC0,0xC0,0xC0,0x40,0x00,0x40,0x40,0xC0,0x40,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x40,0x40,0x40,
0x40,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x40,
0x40,0x40,0x40,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xC0,0xE0,0x80,0x40,
0x40,0x40,0xC0,0x80,0x80,0x40,0x40,0x40,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x07,0x7F,0xF8,0x80,0x80,0x7C,0x0F,0x7F,0xF8,0x80,0xC0,0x3C,0x03,0x00,
0x00,0x00,0x00,0x00,0xF8,0xFE,0x13,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x1F,
0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFE,0x07,0x01,0x00,0x00,0x00,0x00,
0x00,0x06,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFE,0x03,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x03,0xFE,0xF8,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,
0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0xF8,0xFE,
0x13,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x1F,0x07,0x00,0x00,0x00,0x07,0x1F,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x03,0x06,0x0C,0x18,0x10,0x10,0x10,0x10,0x10,0x08,0x04,
0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x1F,0x1F,0x10,0x10,
0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x0E,0x08,0x18,0x10,0x10,0x10,
0x10,0x10,0x08,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x06,0x0C,0x18,0x10,
0x10,0x10,0x10,0x18,0x08,0x06,0x03,0x00,0x00,0x00,0x00,0x10,0x1F,0x1F,0x10,0x00,
0x00,0x10,0x1F,0x1F,0x10,0x00,0x00,0x10,0x1F,0x1F,0x10,0x00,0x00,0x00,0x01,0x03,
0x06,0x0C,0x18,0x10,0x10,0x10,0x10,0x10,0x08,0x04,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,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,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,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,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,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,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,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,0x00,0x00,0x00,0x00,0x00,0x00
};


 /*********************************************************************************************


 待机界面字模



 ***********************************************************************************************/
uint8 menu1[]=
{
/*------------------------------------------------------------------------------
  源文件 / 文字 : C:\Documents and Settings\new\My Documents\My Pictures\menu2.bmp
  宽×高(像素): 128×64
------------------------------------------------------------------------------*/
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,
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,
0x00,0x80,0x80,0xE0,0x80,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,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,
0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,
0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
0x00,0x00,0x00,0x1F,0x20,0x20,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};




/***********************************************************************************
						  电器设定界面字模
***************************************************************************************/


uint8 menu2[]=
{
/*------------------------------------------------------------------------------
  源文件 / 文字 : C:\Documents and Settings\new\My Documents\My Pictures\menu12.bmp日
  宽×高(像素): 128×64
------------------------------------------------------------------------------*/
0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00,
0x40,0x40,0x4F,0x49,0x49,0xC9,0xCF,0x70,0xC0,0xCF,0x49,0x59,0x69,0x4F,0x00,0x00,
0x40,0x41,0xCE,0x04,0x00,0x80,0x40,0xBE,0x82,0x82,0x82,0xBE,0xC0,0x40,0x40,0x00,
0x00,0x10,0x0C,0xA4,0x24,0x24,0x25,0xE6,0x24,0x24,0x24,0x24,0x14,0x0C,0x04,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,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,0x00,
0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00,
0x02,0x02,0x7E,0x45,0x45,0x44,0x7C,0x00,0x7C,0x44,0x45,0x45,0x7E,0x06,0x02,0x00,
0x00,0x00,0x7F,0x20,0x90,0x80,0x40,0x43,0x2C,0x10,0x10,0x2C,0x43,0xC0,0x40,0x00,
0x40,0x20,0x18,0x07,0x08,0x10,0x20,0x7F,0x42,0x42,0x42,0x42,0x40,0x40,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,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,0x00,0x00,
0x40,0x42,0x4C,0xC4,0x20,0x22,0x22,0xE2,0x22,0x22,0xE2,0x22,0x22,0x20,0x20,0x00,
0x10,0x12,0xD2,0xFE,0x91,0x11,0x80,0xBF,0xA1,0xA1,0xA1,0xA1,0xBF,0x80,0x00,0x00,
0x50,0x91,0x16,0x10,0xF0,0x10,0x40,0x5E,0x50,0x50,0xDF,0x50,0x50,0x5E,0x40,0x00,
0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0xFC,0x00,0x00,0x00,
0x40,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0x00,
0x00,0x10,0x10,0x10,0x11,0x1E,0x14,0xF0,0x10,0x18,0x17,0x12,0x18,0x10,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,0x00,0x00,
0x00,0x40,0x20,0x1F,0x20,0x48,0x44,0x43,0x40,0x40,0x47,0x48,0x48,0x48,0x4E,0x00,
0x04,0x03,0x00,0xFF,0x00,0x41,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x40,0x00,
0x10,0x13,0x10,0x0F,0x08,0x08,0xFF,0x01,0x01,0x3F,0x01,0x3F,0x41,0x81,0x7F,0x00,
0x00,0x00,0x3F,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3F,0x00,0x00,0x00,
0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,
0x01,0x81,0x41,0x21,0x11,0x09,0x05,0x03,0x05,0x09,0x31,0x61,0xC1,0x41,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,0x00,0x00,0x00,
0x00,0x18,0x04,0x14,0x94,0x94,0xD5,0xB6,0x14,0x14,0x94,0x04,0x14,0x0C,0x04,0x00,
0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00,
0x00,0x80,0x40,0x60,0x50,0x48,0x44,0xC3,0x44,0x48,0x50,0x70,0x60,0x20,0x00,0x00,
0x40,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0x00,
0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x10,0x10,0x10,0x11,0x1E,0x14,0xF0,
0x10,0x18,0x17,0x12,0x18,0x10,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x29,0x29,0x15,0x14,0x4A,0x89,0x44,0x3F,0x06,0x09,0x09,0x10,0x30,0x10,0x00,
0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00,
0x00,0x40,0x40,0x44,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x46,0x44,0x60,0x40,0x00,
0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,
0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,0x01,0x81,0x41,0x21,0x11,0x09,0x05,0x03,
0x05,0x09,0x31,0x61,0xC1,0x41,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x40,0x42,0xDC,0x08,0x00,0x00,0xFE,0x52,0x92,0x12,0x12,0x92,0x73,0x02,0x00,0x00,
0x00,0xFE,0x02,0x02,0xF2,0x12,0x12,0x12,0x12,0x12,0xF2,0x02,0x02,0xFE,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,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,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,0x00,0x00,
0x40,0x20,0x1F,0x20,0x48,0x46,0x51,0x50,0x48,0x45,0x42,0x45,0x48,0x50,0x00,0x00,
0x00,0x7F,0x40,0x40,0x47,0x44,0x44,0x44,0x44,0x44,0x47,0x40,0x40,0x7F,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,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,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,0x00,0x00
};


/***************************************************************************************

 






		  操作选择界面







****************************************************************************************/
 uint8 menu7[]=
{
/*------------------------------------------------------------------------------
  源文件 / 文字 : C:\Documents and Settings\new\My Documents\My Pictures\电器设定.bmp
  宽×高(像素): 128×64
------------------------------------------------------------------------------*/
0x00,0x00,0xF8,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xFC,0x08,0x00,0x00,0x00,
0x40,0x5E,0x52,0xD2,0x5E,0x60,0x40,0x5E,0xD2,0x72,0x5F,0x42,0x40,0x00,0x20,0x20,
0x21,0xE6,0x40,0x20,0x5E,0xC2,0x42,0x42,0x4F,0xD2,0x10,0x10,0x00,0x00,0x10,0x2C,
0xA4,0x24,0x24,0x25,0xE6,0x24,0x24,0x24,0x24,0x14,0x0C,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,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,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x07,0x02,0x02,0x02,0x9F,0x22,0x22,0x22,0x22,0x23,0x20,0x38,0x00,0x02,
0x02,0x3E,0x93,0x12,0x3E,0x00,0x00,0x3E,0x12,0x13,0x3E,0x02,0x02,0x00,0x00,0x00,
0x00,0x0F,0x24,0x22,0x10,0x11,0x0A,0x04,0x0A,0x11,0x30,0x10,0x00,0x20,0x10,0x08,
0x07,0x08,0x10,0x10,0x3F,0x22,0x22,0x22,0x22,0x20,0x20,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xFC,0x24,0x24,0x24,0xFF,0x24,0x24,0x24,0x24,0xFE,0x04,0x00,0x00,0x20,
0x18,0x00,0xFF,0x08,0x04,0x02,0x02,0x02,0x02,0xFE,0x02,0x03,0x02,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,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x46,0x22,0x52,0x4A,0x42,0xC3,0x42,0x4A,
0x52,0x22,0x6A,0x06,0x00,0x10,0x10,0xF1,0x02,0x00,0x00,0xFF,0x15,0xD5,0x5F,0xD5,
0x15,0xFF,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,0x03,0xC1,0x01,0x01,0x0F,0x11,0xD1,0x11,0x11,0x11,0x10,0x1C,0x00,0x10,
0x08,0x06,0x01,0x02,0x04,0x00,0xC0,0x08,0x10,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0xC0,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,0x80,0x10,0x10,0x10,0x10,0x10,0x10,0xDF,0x10,0x10,
0x10,0x10,0x10,0x10,0x00,0x00,0x00,0xCF,0x04,0x12,0x0C,0x03,0x00,0xC3,0x02,0x0B,
0x90,0x0F,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,0x12,0x92,0xFF,0x0A,0x82,0x48,0x32,0x2F,0x42,0x02,0x7F,0x82,0xF0,0x00,0x00,
0x04,0x04,0xC4,0x3C,0x00,0x00,0xFF,0x30,0x48,0x84,0x02,0x00,0x00,0x00,0x80,0x90,
0x97,0xD4,0xB4,0x97,0x18,0x10,0x97,0xB4,0xDC,0x97,0x90,0x90,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,0x40,0xC0,0x33,0x0C,0x04,0xC4,0x3C,0x00,0xFF,0x10,0x68,
0x84,0x02,0x00,0x00,0x14,0x92,0x51,0xFD,0x53,0x95,0x01,0xFA,0x29,0x29,0x2B,0x2D,
0xF9,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,
0x00,0x08,0x06,0x00,0x02,0x0C,0x00,0x02,0x0C,0x00,0x00,0x02,0x0C,0x00,0x00,0x04,
0x02,0x01,0x00,0x00,0x04,0x08,0x07,0x00,0x00,0x00,0x01,0x02,0x02,0x00,0x00,0x00,
0x0F,0x04,0x04,0x0F,0x00,0x00,0x0F,0x04,0x04,0x0F,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,0x07,0x00,0x02,0x01,0x00,0x04,0x08,0x07,0x00,0x00,
0x00,0x01,0x02,0x00,0x01,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x05,0x05,0x05,0x05,
0x0F,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,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,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,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,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,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,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,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,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
};
/**************************************************************************************

开关选择界面
**************************************************************************************/
uint8  menu4[]=
{
/*------------------------------------------------------------------------------
  源文件 / 文字 : C:\Documents and Settings\new\My Documents\My Pictures\start.bmp
  宽×高(像素): 128×64
------------------------------------------------------------------------------*/
0x40,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,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,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,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,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x00,0x7F,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,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,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,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x10,0x10,0x10,0x11,0x1E,0x14,0xF0,0x10,0x18,0x17,0x12,0x18,0x10,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,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,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,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x81,0x41,0x21,0x11,0x09,0x05,0x03,0x05,0x09,0x31,0x61,0xC1,0x41,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,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,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,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x40,0x42,0xDC,0x08,0x00,0x00,0xFE,0x52,0x92,0x12,0x12,0x92,0x73,0x02,0x00,0x00,
0x00,0xFE,0x02,0x02,0xF2,0x12,0x12,0x12,0x12,0x12,0xF2,0x02,0x02,0xFE,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,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,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,0x00,0x00,
0x40,0x20,0x1F,0x20,0x48,0x46,0x51,0x50,0x48,0x45,0x42,0x45,0x48,0x50,0x00,0x00,
0x00,0x7F,0x40,0x40,0x47,0x44,0x44,0x44,0x44,0x44,0x47,0x40,0x40,0x7F,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,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,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,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,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,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,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,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,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,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,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,0x00,0x00
};





 

/****************************************************



******************************/
#define Fosc            11059200                   //Crystal frequence,10MHz~25MHz,should be the same as actual status. 
						    //应当与实际一至晶振频率,10MHz~25MHz,应当与实际一至
#define Fcclk           (Fosc * 4)                  //System frequence,should be (1~32)multiples of Fosc,and should be equal or less  than 60MHz. 
						    //系统频率,必须为Fosc的整数倍(1~32),且<=60MHZ
#define Fcco            (Fcclk * 4)                 //CCO frequence,should be 2、4、8、16 multiples of Fcclk, ranged from 156MHz to 320MHz. 
						    //CCO频率,必须为Fcclk的2、4、8、16倍,范围为156MHz~320MHz
#define Fpclk           (Fcclk / 4) * 1             //VPB clock frequence , must be 1、2、4 multiples of (Fcclk / 4).
						    //VPB时钟频率,只能为(Fcclk / 4)的1、2、4倍
//neusoft图形


//#define LCD12864_WIDTH 128  //宽度
//#define LCD12864_HIGH  64   //高度
//#define LCD12864_PAGE  8    //页数





#endif

lpc2103.h
/************************/
/***********************************************************************/
/*  This file is part of the uVision/ARM development tools             */
/*  Copyright KEIL ELEKTRONIK GmbH 2002-2005                           */
/***********************************************************************/
/*                                                                     */
/*  LPC2103.H:  Header file for Philips LPC2101 / LPC2102 / LPC2103    */
/*                                                                     */
/***********************************************************************/

#ifndef __LPC2103_H
#define __LPC2103_H

/* Vectored Interrupt Controller (VIC) */
#define VICIRQStatus   (*((volatile unsigned long *) 0xFFFFF000))
#define VICFIQStatus   (*((volatile unsigned long *) 0xFFFFF004))
#define VICRawIntr     (*((volatile unsigned long *) 0xFFFFF008))
#define VICIntSelect   (*((volatile unsigned long *) 0xFFFFF00C))
#define VICIntEnable   (*((volatile unsigned long *) 0xFFFFF010))
#define VICIntEnClr    (*((volatile unsigned long *) 0xFFFFF014))
#define VICSoftInt     (*((volatile unsigned long *) 0xFFFFF018))
#define VICSoftIntClr  (*((volatile unsigned long *) 0xFFFFF01C))
#define VICProtection  (*((volatile unsigned long *) 0xFFFFF020))
#define VICVectAddr    (*((volatile unsigned long *) 0xFFFFF030))
#define VICDefVectAddr (*((volatile unsigned long *) 0xFFFFF034))
#define VICVectAddr0   (*((volatile unsigned long *) 0xFFFFF100))
#define VICVectAddr1   (*((volatile unsigned long *) 0xFFFFF104))
#define VICVectAddr2   (*((volatile unsigned long *) 0xFFFFF108))
#define VICVectAddr3   (*((volatile unsigned long *) 0xFFFFF10C))
#define VICVectAddr4   (*((volatile unsigned long *) 0xFFFFF110))
#define VICVectAddr5   (*((volatile unsigned long *) 0xFFFFF114))
#define VICVectAddr6   (*((volatile unsigned long *) 0xFFFFF118))
#define VICVectAddr7   (*((volatile unsigned long *) 0xFFFFF11C))
#define VICVectAddr8   (*((volatile unsigned long *) 0xFFFFF120))
#define VICVectAddr9   (*((volatile unsigned long *) 0xFFFFF124))
#define VICVectAddr10  (*((volatile unsigned long *) 0xFFFFF128))
#define VICVectAddr11  (*((volatile unsigned long *) 0xFFFFF12C))
#define VICVectAddr12  (*((volatile unsigned long *) 0xFFFFF130))
#define VICVectAddr13  (*((volatile unsigned long *) 0xFFFFF134))
#define VICVectAddr14  (*((volatile unsigned long *) 0xFFFFF138))
#define VICVectAddr15  (*((volatile unsigned long *) 0xFFFFF13C))
#define VICVectCntl0   (*((volatile unsigned long *) 0xFFFFF200))
#define VICVectCntl1   (*((volatile unsigned long *) 0xFFFFF204))
#define VICVectCntl2   (*((volatile unsigned long *) 0xFFFFF208))
#define VICVectCntl3   (*((volatile unsigned long *) 0xFFFFF20C))
#define VICVectCntl4   (*((volatile unsigned long *) 0xFFFFF210))
#define VICVectCntl5   (*((volatile unsigned long *) 0xFFFFF214))
#define VICVectCntl6   (*((volatile unsigned long *) 0xFFFFF218))
#define VICVectCntl7   (*((volatile unsigned long *) 0xFFFFF21C))
#define VICVectCntl8   (*((volatile unsigned long *) 0xFFFFF220))
#define VICVectCntl9   (*((volatile unsigned long *) 0xFFFFF224))
#define VICVectCntl10  (*((volatile unsigned long *) 0xFFFFF228))
#define VICVectCntl11  (*((volatile unsigned long *) 0xFFFFF22C))
#define VICVectCntl12  (*((volatile unsigned long *) 0xFFFFF230))
#define VICVectCntl13  (*((volatile unsigned long *) 0xFFFFF234))
#define VICVectCntl14  (*((volatile unsigned long *) 0xFFFFF238))
#define VICVectCntl15  (*((volatile unsigned long *) 0xFFFFF23C))

/* Pin Connect Block */
#define PINSEL0        (*((volatile unsigned long *) 0xE002C000))
#define PINSEL1        (*((volatile unsigned long *) 0xE002C004))

/* General Purpose Input/Output (GPIO) */
#define IOPIN          (*((volatile unsigned long *) 0xE0028000))
#define IOSET          (*((volatile unsigned long *) 0xE0028004))
#define IODIR          (*((volatile unsigned long *) 0xE0028008))
#define IOCLR          (*((volatile unsigned long *) 0xE002800C))

/* Fast General Purpose Input/Output (GPIO) */
#define FIODIR         (*((volatile unsigned long *) 0x3FFFC000))
#define FIOMASK        (*((volatile unsigned long *) 0x3FFFC010))
#define FIOPIN         (*((volatile unsigned long *) 0x3FFFC014))
#define FIOSET         (*((volatile unsigned long *) 0x3FFFC018))
#define FIOCLR         (*((volatile unsigned long *) 0x3FFFC01C))

/* Memory Accelerator Module (MAM) */
#define MAMCR          (*((volatile unsigned char *) 0xE01FC000))
#define MAMTIM         (*((volatile unsigned char *) 0xE01FC004))
#define MEMMAP         (*((volatile unsigned char *) 0xE01FC040))

/* Phase Locked Loop (PLL) */
#define PLLCON         (*((volatile unsigned char *) 0xE01FC080))
#define PLLCFG         (*((volatile unsigned char *) 0xE01FC084))
#define PLLSTAT        (*((volatile unsigned short*) 0xE01FC088))
#define PLLFEED        (*((volatile unsigned char *) 0xE01FC08C))

/* APB Divider */
#define VPBDIV         (*((volatile unsigned char *) 0xE01FC100))

/* Power Control */
#define PCON           (*((volatile unsigned char *) 0xE01FC0C0))
#define PCONP          (*((volatile unsigned long *) 0xE01FC0C4))

/* External Interrupts */
#define EXTINT         (*((volatile unsigned char *) 0xE01FC140))
#define EXTWAKE        (*((volatile unsigned char *) 0xE01FC144))
#define EXTMODE        (*((volatile unsigned char *) 0xE01FC148))
#define EXTPOLAR       (*((volatile unsigned char *) 0xE01FC14C))

/* Timer 0 */
#define T0IR           (*((volatile unsigned char *) 0xE0004000))
#define T0TCR          (*((volatile unsigned char *) 0xE0004004))
#define T0TC           (*((volatile unsigned long *) 0xE0004008))
#define T0PR           (*((volatile unsigned long *) 0xE000400C))
#define T0PC           (*((volatile unsigned long *) 0xE0004010))
#define T0MCR          (*((volatile unsigned short*) 0xE0004014))
#define T0MR0          (*((volatile unsigned long *) 0xE0004018))
#define T0MR1          (*((volatile unsigned long *) 0xE000401C))
#define T0MR2          (*((volatile unsigned long *) 0xE0004020))
#define T0MR3          (*((volatile unsigned long *) 0xE0004024))
#define T0CCR          (*((volatile unsigned short*) 0xE0004028))
#define T0CR0          (*((volatile unsigned long *) 0xE000402C))
#define T0CR1          (*((volatile unsigned long *) 0xE0004030))
#define T0CR2          (*((volatile unsigned long *) 0xE0004034))
#define T0CR3          (*((volatile unsigned long *) 0xE0004038))
#define T0EMR          (*((volatile unsigned short*) 0xE000403C))
#define T0CTCR         (*((volatile unsigned char *) 0xE0004070))
#define T0PWMCON       (*((volatile unsigned long *) 0xE0004074))

/* Timer 1 */
#define T1IR           (*((volatile unsigned char *) 0xE0008000))
#define T1TCR          (*((volatile unsigned char *) 0xE0008004))
#define T1TC           (*((volatile unsigned long *) 0xE0008008))
#define T1PR           (*((volatile unsigned long *) 0xE000800C))
#define T1PC           (*((volatile unsigned long *) 0xE0008010))
#define T1MCR          (*((volatile unsigned short*) 0xE0008014))
#define T1MR0          (*((volatile unsigned long *) 0xE0008018))
#define T1MR1          (*((volatile unsigned long *) 0xE000801C))
#define T1MR2          (*((volatile unsigned long *) 0xE0008020))
#define T1MR3          (*((volatile unsigned long *) 0xE0008024))
#define T1CCR          (*((volatile unsigned short*) 0xE0008028))
#define T1CR0          (*((volatile unsigned long *) 0xE000802C))
#define T1CR1          (*((volatile unsigned long *) 0xE0008030))
#define T1CR2          (*((volatile unsigned long *) 0xE0008034))
#define T1CR3          (*((volatile unsigned long *) 0xE0008038))
#define T1EMR          (*((volatile unsigned short*) 0xE000803C))
#define T1CTCR         (*((volatile unsigned char *) 0xE0008070))
#define T1PWMCON       (*((volatile unsigned long *) 0xE0008074))

/* Universal Asynchronous Receiver Transmitter 0 (UART0) */
#define U0RBR          (*((volatile unsigned char *) 0xE000C000))
#define U0THR          (*((volatile unsigned char *) 0xE000C000))
#define U0IER          (*((volatile unsigned long *) 0xE000C004))
#define U0IIR          (*((volatile unsigned long *) 0xE000C008))
#define U0FCR          (*((volatile unsigned char *) 0xE000C008))
#define U0LCR          (*((volatile unsigned char *) 0xE000C00C))
#define U0LSR          (*((volatile unsigned char *) 0xE000C014))
#define U0SCR          (*((volatile unsigned char *) 0xE000C01C))
#define U0DLL          (*((volatile unsigned char *) 0xE000C000))
#define U0DLM          (*((volatile unsigned char *) 0xE000C004))
#define U0ACR          (*((volatile unsigned long *) 0xE000C020))
#define U0FDR          (*((volatile unsigned long *) 0xE000C028))
#define U0TER          (*((volatile unsigned char *) 0xE000C030))

/* Universal Asynchronous Receiver Transmitter 1 (UART1) */
#define U1RBR          (*((volatile unsigned char *) 0xE0010000))
#define U1THR          (*((volatile unsigned char *) 0xE0010000))
#define U1IER          (*((volatile unsigned long *) 0xE0010004))
#define U1IIR          (*((volatile unsigned long *) 0xE0010008))
#define U1FCR          (*((volatile unsigned char *) 0xE0010008))
#define U1LCR          (*((volatile unsigned char *) 0xE001000C))
#define U1MCR          (*((volatile unsigned char *) 0xE0010010))
#define U1LSR          (*((volatile unsigned char *) 0xE0010014))
#define U1MSR          (*((volatile unsigned char *) 0xE0010018))
#define U1SCR          (*((volatile unsigned char *) 0xE001001C))
#define U1DLL          (*((volatile unsigned char *) 0xE0010000))
#define U1DLM          (*((volatile unsigned char *) 0xE0010004))
#define U1ACR          (*((volatile unsigned long *) 0xE0010020))
#define U1FDR          (*((volatile unsigned long *) 0xE0010028))
#define U1TER          (*((volatile unsigned char *) 0xE0010030))

/* Inter-Integrated Circuit interface 0 (I2C0) */
#define I2C0CONSET     (*((volatile unsigned char *) 0xE001C000))
#define I2C0STAT       (*((volatile unsigned char *) 0xE001C004))
#define I2C0DAT        (*((volatile unsigned char *) 0xE001C008))
#define I2C0ADR        (*((volatile unsigned char *) 0xE001C00C))
#define I2C0SCLH       (*((volatile unsigned short*) 0xE001C010))
#define I2C0SCLL       (*((volatile unsigned short*) 0xE001C014))
#define I2C0CONCLR     (*((volatile unsigned char *) 0xE001C018))

/* Serial Peripheral Interface 0 (SPI0) */
#define S0SPCR         (*((volatile unsigned short*) 0xE0020000))
#define S0SPSR         (*((volatile unsigned char *) 0xE0020004))
#define S0SPDR         (*((volatile unsigned short*) 0xE0020008))
#define S0SPCCR        (*((volatile unsigned char *) 0xE002000C))
#define S0SPINT        (*((volatile unsigned char *) 0xE002001C))

/* Real Time Clock (RTC) */
#define ILR            (*((volatile unsigned char *) 0xE0024000))
#define CTC            (*((volatile unsigned short*) 0xE0024004))
#define CCR            (*((volatile unsigned char *) 0xE0024008))
#define CIIR           (*((volatile unsigned char *) 0xE002400C))
#define AMR            (*((volatile unsigned char *) 0xE0024010))
#define CTIME0         (*((volatile unsigned long *) 0xE0024014))
#define CTIME1         (*((volatile unsigned long *) 0xE0024018))
#define CTIME2         (*((volatile unsigned long *) 0xE002401C))
#define SEC            (*((volatile unsigned char *) 0xE0024020))
#define MIN            (*((volatile unsigned char *) 0xE0024024))
#define HOUR           (*((volatile unsigned char *) 0xE0024028))
#define DOM            (*((volatile unsigned char *) 0xE002402C))
#define DOW            (*((volatile unsigned char *) 0xE0024030))
#define DOY            (*((volatile unsigned short*) 0xE0024034))
#define MONTH          (*((volatile unsigned char *) 0xE0024038))
#define YEAR           (*((volatile unsigned short*) 0xE002403C))
#define ALSEC          (*((volatile unsigned char *) 0xE0024060))
#define ALMIN          (*((volatile unsigned char *) 0xE0024064))
#define ALHOUR         (*((volatile unsigned char *) 0xE0024068))
#define ALDOM          (*((volatile unsigned char *) 0xE002406C))
#define ALDOW          (*((volatile unsigned char *) 0xE0024070))
#define ALDOY          (*((volatile unsigned short*) 0xE0024074))
#define ALMON          (*((volatile unsigned char *) 0xE0024078))
#define ALYEAR         (*((volatile unsigned short*) 0xE002407C))
#define PREINT         (*((volatile unsigned short*) 0xE0024080))
#define PREFRAC        (*((volatile unsigned short*) 0xE0024084))

/* Analog/Digital Converter (ADC) */
#define ADCR           (*((volatile unsigned long *) 0xE0034000))
#define ADGDR          (*((volatile unsigned long *) 0xE0034004))
#define ADINTEN        (*((volatile unsigned long *) 0xE003400C))
#define ADDR0          (*((volatile unsigned long *) 0xE0034010))
#define ADDR1          (*((volatile unsigned long *) 0xE0034014))
#define ADDR2          (*((volatile unsigned long *) 0xE0034018))
#define ADDR3          (*((volatile unsigned long *) 0xE003401C))
#define ADDR4          (*((volatile unsigned long *) 0xE0034020))
#define ADDR5          (*((volatile unsigned long *) 0xE0034024))
#define ADDR6          (*((volatile unsigned long *) 0xE0034028))
#define ADDR7          (*((volatile unsigned long *) 0xE003402C))
#define ADSTAT         (*((volatile unsigned long *) 0xE0034030))

/* Inter-Integrated Circuit interface 1 (I2C1) */
#define I2C1CONSET     (*((volatile unsigned char *) 0xE005C000))
#define I2C1STAT       (*((volatile unsigned char *) 0xE005C004))
#define I2C1DAT        (*((volatile unsigned char *) 0xE005C008))
#define I2C1ADR        (*((volatile unsigned char *) 0xE005C00C))
#define I2C1SCLH       (*((volatile unsigned short*) 0xE005C010))
#define I2C1SCLL       (*((volatile unsigned short*) 0xE005C014))
#define I2C1CONCLR     (*((volatile unsigned char *) 0xE005C018))

/* Synchronous Serial Port interface (SSP) */
#define SSPCR0         (*((volatile unsigned short*) 0xE0068000))
#define SSPCR1         (*((volatile unsigned char *) 0xE0068004))
#define SSPDR          (*((volatile unsigned short*) 0xE0068008))
#define SSPSR          (*((volatile unsigned char *) 0xE006800C))
#define SSPCPSR        (*((volatile unsigned char *) 0xE0068010))
#define SSPIMSC        (*((volatile unsigned char *) 0xE0068014))
#define SSPRIS         (*((volatile unsigned char *) 0xE0068018))
#define SSPMIS         (*((volatile unsigned char *) 0xE006801C))
#define SSPICR         (*((volatile unsigned char *) 0xE0068020))

/* Timer 2 */
#define T2IR           (*((volatile unsigned char *) 0xE0070000))
#define T2TCR          (*((volatile unsigned char *) 0xE0070004))
#define T2TC           (*((volatile unsigned long *) 0xE0070008))
#define T2PR           (*((volatile unsigned long *) 0xE007000C))
#define T2PC           (*((volatile unsigned long *) 0xE0070010))
#define T2MCR          (*((volatile unsigned short*) 0xE0070014))
#define T2MR0          (*((volatile unsigned long *) 0xE0070018))
#define T2MR1          (*((volatile unsigned long *) 0xE007001C))
#define T2MR2          (*((volatile unsigned long *) 0xE0070020))
#define T2MR3          (*((volatile unsigned long *) 0xE0070024))
#define T2CCR          (*((volatile unsigned short*) 0xE0070028))
#define T2CR0          (*((volatile unsigned long *) 0xE007002C))
#define T2CR1          (*((volatile unsigned long *) 0xE0070030))
#define T2CR2          (*((volatile unsigned long *) 0xE0070034))
#define T2EMR          (*((volatile unsigned short*) 0xE007003C))
#define T2CTCR         (*((volatile unsigned char *) 0xE0070070))
#define T2PWMCON       (*((volatile unsigned long *) 0xE0070074))

/* Timer 3 */
#define T3IR           (*((volatile unsigned char *) 0xE0074000))
#define T3TCR          (*((volatile unsigned char *) 0xE0074004))
#define T3TC           (*((volatile unsigned long *) 0xE0074008))
#define T3PR           (*((volatile unsigned long *) 0xE007400C))
#define T3PC           (*((volatile unsigned long *) 0xE0074010))
#define T3MCR          (*((volatile unsigned short*) 0xE0074014))
#define T3MR0          (*((volatile unsigned long *) 0xE0074018))
#define T3MR4          (*((volatile unsigned long *) 0xE007401C))
#define T3MR2          (*((volatile unsigned long *) 0xE0074020))
#define T3MR3          (*((volatile unsigned long *) 0xE0074024))
#define T3CCR          (*((volatile unsigned short*) 0xE0074028))
#define T3CR0          (*((volatile unsigned long *) 0xE007402C))
#define T3CR1          (*((volatile unsigned long *) 0xE0074030))
#define T3CR2          (*((volatile unsigned long *) 0xE0074034))
#define T3EMR          (*((volatile unsigned short*) 0xE007403C))
#define T3CTCR         (*((volatile unsigned char *) 0xE0074070))
#define T3PWMCON       (*((volatile unsigned long *) 0xE0074074))

/* Reset Source Identification */
#define RSIR           (*((volatile unsigned char *) 0xE01FC180))

/* Code Security Protection */
#define CPSR           (*((volatile unsigned long *) 0xE01FC184))

/* Syscon Miscellaneous */
#define SCS            (*((volatile unsigned long *) 0xE01FC1A0))

/* Watchdog timer */
#define WDMOD          (*((volatile unsigned char *) 0xE0000000))
#define WDTC           (*((volatile unsigned long *) 0xE0000004))
#define WDFEED         (*((volatile unsigned char *) 0xE0000008))
#define WDTV           (*((volatile unsigned long *) 0xE000000C))

#endif  // __LPC2103_H


target.h
/*******************************/
/****************************************Copyright (c)**************************************************
**                               Guangzou ZLG-MCU Development Co.,LTD.
**                                      graduate school
**                                 http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name: 			target.h
** Last modified Date:  2004-09-17
** Last Version: 		1.0
** Descriptions: 		header file of the specific codes for LPC2100 target boards
**						Every project should include a copy of this file, user may modify it as needed
**------------------------------------------------------------------------------------------------------
** Created by: 			Chenmingji
** Created date:   		2004-02-02
** Version:				1.0
** Descriptions: 		The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by: 		Chenmingji
** Modified date:		2004-09-17
** Version:				1.01
** Descriptions: 		Renewed the template, added codes to surport more compilers 
**
**------------------------------------------------------------------------------------------------------
** Modified by: 
** Modified date:
** Version:	
** Descriptions: 
**
********************************************************************************************************/
#ifndef __TARGET_H 
#define __TARGET_H

    #ifdef __cplusplus
    extern "C" {
    #endif


    #ifndef IN_TARGET 

extern void Reset(void);
/*********************************************************************************************************
** Function name:			Reset
** Descriptions:			resets the target board.
** input parameters:		None
**
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/

extern void TargetInit(void);
/*********************************************************************************************************
** Function name:			TargetInit
**
** Descriptions:			Initialize the target board; it is called in a necessary place, change it as 
**							needed
**
** input parameters:		None
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:				Chenxibing
** Modified date:			2004-12-09
** Notice:					Add IntDisable() and IntEnable() Functions 
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
    #endif

    #ifdef __cplusplus
    }
    #endif
 
#endif

// Add IntDisable() and IntEnable() Functions
// changed by Chenxibing
// 2004-12-09
__swi(0x00) void SwiHandle1(int Handle);

#define IRQDisable() SwiHandle1(0)
#define IRQEnable() SwiHandle1(1)
#define FIQDisable() SwiHandle1(2)
#define FIQEnable() SwiHandle1(3)
//---end

/*********************************************************************************************************
**                            End Of File
********************************************************************************************************/

Startup.s
/************************/
;/****************************************Copyright (c)**************************************************
;**                               Guangzou ZLG-MCU Development Co.,LTD.
;**                                      graduate school
;**                                 http://www.zlgmcu.com
;**
;**--------------File Info-------------------------------------------------------------------------------
;** File name: 			Startup.s
;** Last modified Date:  2004-09-17
;** Last Version: 		1.0
;** Descriptions: 		The start up codes for LPC2100, including the initializing codes for the entry point of exceptions and the stacks of user tasks.
;**				Every project should have a independent copy of this file for related modifications
;**------------------------------------------------------------------------------------------------------
;** Created by: 			Chenmingji
;** Created date:   		2004-02-02
;** Version:				1.0
;** Descriptions: 		The original version
;**
;**------------------------------------------------------------------------------------------------------
;** Modified by: 		Chenmingji
;** Modified date:		2004-09-17
;** Version:				1.01
;** Descriptions: 		Modified the bus setting to adapt for many common situations 
;**
;**------------------------------------------------------------------------------------------------------
;** Modified by: 		Chenmingji
;** Modified date:		2004-09-17
;** Version:				1.02
;** Descriptions: 		Added codes to support the enciphering of the chip
;**
;**------------------------------------------------------------------------------------------------------
;** Modified by: 		Chenmingji
;** Modified date:		2004-09-17
;** Version:				1.04
;** Descriptions: 		Renewed the template, added codes to support more compilers 
;**
;**------------------------------------------------------------------------------------------------------
;** Modified by: 		Chenxibing	
;** Modified date:		2004-12-09
;** Version:			1.05
;** Descriptions: 
;**
;********************************************************************************************************/

;define the stack size
;定义堆栈的大小
SVC_STACK_LEGTH         EQU         0
FIQ_STACK_LEGTH         EQU         0
IRQ_STACK_LEGTH         EQU         256
ABT_STACK_LEGTH         EQU         0
UND_STACK_LEGTH         EQU         0

NoInt       EQU 0x80
NoFIQ		EQU	0x40

USR32Mode   EQU 0x10
SVC32Mode   EQU 0x13
SYS32Mode   EQU 0x1f
IRQ32Mode   EQU 0x12
FIQ32Mode   EQU 0x11

    IMPORT __use_no_semihosting_swi

;The imported labels
;引入的外部标号在这声明
    IMPORT  FIQ_Exception                   ;Fast interrupt exceptions handler 快速中断异常处理程序
    IMPORT  __main                          ;The entry point to the main function C语言主程序入口 
    IMPORT  TargetResetInit                 ;initialize the target board 目标板基本初始化
	
;The emported labels
;给外部使用的标号在这声明
    EXPORT  bottom_of_heap
    EXPORT  StackUsr
    
    EXPORT  Reset
    EXPORT __user_initial_stackheap

    CODE32

    AREA    vectors,CODE,READONLY
        ENTRY

;interrupt vectors
;中断向量表
Reset
        LDR     PC, ResetAddr
        LDR     PC, UndefinedAddr
        LDR     PC, SWI_Addr
        LDR     PC, PrefetchAddr
        LDR     PC, DataAbortAddr
        DCD     0xb9205f80
        LDR     PC, [PC, #-0xff0]
        LDR     PC, FIQ_Addr

ResetAddr           DCD     ResetInit
UndefinedAddr       DCD     Undefined
SWI_Addr            DCD     SoftwareInterrupt
PrefetchAddr        DCD     PrefetchAbort
DataAbortAddr       DCD     DataAbort
Nouse               DCD     0
IRQ_Addr            DCD     0
FIQ_Addr            DCD     FIQ_Handler


;未定义指令
Undefined
        B       Undefined

;软中断
SoftwareInterrupt			
;        B       SoftwareInterrupt
;//增加开/关中断处理 Chenxibing-2004-02-09                                 
        CMP     R0, #4
        LDRLO   PC, [PC, R0, LSL #2]
        MOVS    PC, LR

SwiFunction
        DCD     IRQDisable       ;0
        DCD     IRQEnable        ;1
        DCD		FIQDisable		 ;2
        DCD		FIQEnable		 ;3

IRQDisable
        ;关IRQ中断
        MRS     R0, SPSR
        ORR     R0, R0, #NoInt
        MSR     SPSR_c, R0
        MOVS    PC, LR

IRQEnable
        ;开IRQ中断
        MRS   R0, SPSR
        BIC   R0, R0, #NoInt
        MSR   SPSR_c, R0
        MOVS    PC, LR
        
FIQDisable
        ;关FIQ中断
        MRS     R0, SPSR
        ORR     R0, R0, #NoFIQ
        MSR     SPSR_c, R0
        MOVS    PC, LR

FIQEnable
        ;开FIQ中断
        MRS   R0, SPSR
        BIC   R0, R0, #NoFIQ
        MSR   SPSR_c, R0
        MOVS    PC, LR
;// Changed 2004-12-09
      
;取指令中止
PrefetchAbort
        B       PrefetchAbort

;取数据中止
DataAbort
        B       DataAbort

;快速中断
FIQ_Handler
        STMFD   SP!, {R0-R3, LR}
        BL      FIQ_Exception
        LDMFD   SP!, {R0-R3, LR}
        SUBS    PC,  LR,  #4

            
;/*********************************************************************************************************
;** unction name 	函数名称: 	InitStack
;** Descriptions 	功能描述: 	Initialize the stacks  初始化堆栈
;** input parameters 	输 入:   	None 无
;** Returned value   	输 出 :  	None 无
;** Used global variables 全局变量: 	None 无
;** Calling modules 	调用模块: 	None 无
;** 
;** Created by 		作 者: 	Chenmingji 陈明计
;** Created Date 	日 期: 	2004/02/02 2004年2月2日
;**-------------------------------------------------------------------------------------------------------
;** Modified by 	修 改: 
;** Modified date 	日 期: 
;**-------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
InitStack    
        MOV     R0, LR
;Build the SVC stack
;设置管理模式堆栈
        MSR     CPSR_c, #0xd3		
        LDR     SP, StackSvc	
;Build the IRQ stack	
;设置中断模式堆栈
        MSR     CPSR_c, #0xd2
        LDR     SP, StackIrq
;Build the FIQ stack
;设置快速中断模式堆栈
        MSR     CPSR_c, #0xd1
        LDR     SP, StackFiq
;Build the DATAABORT stack
;设置中止模式堆栈
        MSR     CPSR_c, #0xd7
        LDR     SP, StackAbt
;Build the UDF stack
;设置未定义模式堆栈
        MSR     CPSR_c, #0xdb
        LDR     SP, StackUnd
;Build the SYS stack
;设置系统模式堆栈
        MSR     CPSR_c, #0xdf
        LDR     SP, =StackUsr

        MOV     PC, R0

;/*********************************************************************************************************
;** unction name 	函数名称: 	ResetInit
;** Descriptions 	功能描述: 	RESET  复位入口
;** input parameters 	输 入:   	None 无
;** Returned value   	输 出 :  	None 无
;** Used global variables 全局变量: 	None 无
;** Calling modules 	调用模块: 	None 无
;** 
;** Created by 		作 者: 	Chenmingji 陈明计
;** Created Date 	日 期: 	2004/02/02 2004年2月2日
;**-------------------------------------------------------------------------------------------------------
;** Modified by 	修 改: Chenmingji 陈明计
;** Modified date 	日 期: 2004/02/02 2004年3月3日
;**-------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
ResetInit
        
        BL      InitStack               ;初始化堆栈 Initialize the stack
        BL      TargetResetInit         ;目标板基本初始化 Initialize the target board
                                        ;跳转到c语言入口 Jump to the entry point of C program
        B       __main

;/*********************************************************************************************************
;** unction name 	函数名称: 	__user_initial_stackheap
;** Descriptions 	功能描述: 	Initial the function library stacks and heaps, can not deleted!   库函数初始化堆和栈,不能删除
;** input parameters 	输 入:   	reference by function library 参考库函数手册
;** Returned value   	输 出 :  	reference by function library 参考库函数手册
;** Used global variables 全局变量: 	None 无
;** Calling modules 	调用模块: 	None 无
;** 
;** Created by 		作 者: 	Chenmingji 陈明计
;** Created Date 	日 期: 	2004/02/02 2004年2月2日
;**-------------------------------------------------------------------------------------------------------
;** Modified by 	
;** Modified date 	
;**-------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
__user_initial_stackheap    
    LDR   r0,=bottom_of_heap
;    LDR   r1,=StackUsr
    MOV   pc,lr


StackSvc           DCD     SvcStackSpace + (SVC_STACK_LEGTH - 1)* 4
StackIrq           DCD     IrqStackSpace + (IRQ_STACK_LEGTH - 1)* 4
StackFiq           DCD     FiqStackSpace + (FIQ_STACK_LEGTH - 1)* 4
StackAbt           DCD     AbtStackSpace + (ABT_STACK_LEGTH - 1)* 4
StackUnd           DCD     UndtStackSpace + (UND_STACK_LEGTH - 1)* 4

;/*********************************************************************************************************
;** unction name 	函数名称: 	CrpData
;** Descriptions 	功能描述: 	encrypt the chip
;** input parameters 	输 入:   	None 无
;** Returned value   	输 出 :  	None 无
;** Used global variables 全局变量: 	None 无
;** Calling modules 	调用模块: 	None 无
;** 
;** Created by 		作 者: 	Chenmingji 陈明计
;** Created Date 	日 期: 	2004/03/27 2004年3月27日
;**-------------------------------------------------------------------------------------------------------
;** Modified by 	修 改: 
;** Modified date 	日 期: 
;**-------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
    IF :DEF: EN_CRP
        IF  . >= 0x1fc
        INFO    1,"\nThe data at 0x000001fc must be 0x87654321.\nPlease delete some source before this line."
        ENDIF
CrpData
    WHILE . < 0x1fc
    NOP
    WEND
CrpData1
    DCD     0x87654321          ;/*When the Data is 为0x87654321,user code be protected. 当此数为0x87654321时,用户程序被保护 */
    ENDIF
    
;/* 分配堆栈空间 */
        AREA    MyStacks, DATA, NOINIT, ALIGN=2
SvcStackSpace      SPACE   SVC_STACK_LEGTH * 4  ;Stack spaces for Administration Mode 管理模式堆栈空间
IrqStackSpace      SPACE   IRQ_STACK_LEGTH * 4  ;Stack spaces for Interrupt ReQuest Mode 中断模式堆栈空间
FiqStackSpace      SPACE   FIQ_STACK_LEGTH * 4  ;Stack spaces for Fast Interrupt reQuest Mode 快速中断模式堆栈空间
AbtStackSpace      SPACE   ABT_STACK_LEGTH * 4  ;Stack spaces for Suspend Mode 中止义模式堆栈空间
UndtStackSpace     SPACE   UND_STACK_LEGTH * 4  ;Stack spaces for Undefined Mode 未定义模式堆栈


        AREA    Heap, DATA, NOINIT
bottom_of_heap    SPACE   1

        AREA    Stacks, DATA, NOINIT
StackUsr

    END
;/*********************************************************************************************************
;**                            End Of File
;********************************************************************************************************/



已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页