main.c /**********************/ //**************************************************************************************** //* * //* ***************************LCD12864驱动程序************************ * //* * //***************************************************************************************** /*注意:CSA = 1 选中左屏,且硬件原理图中LCS2对应CSA CSB= 1 选中右屏,且硬件原理图中LCS1对应CSB */ #include "config.h" #include"LCD12864.h" #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<<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 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 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 //设置列指令 //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #define LCD_STARTROW 0xC0 //设置起始行指令。 #define LCD_PAGE 0xB8 //设置页指令。10111000 #define LCD_COL 0x40 //设置列指令。 #define SINGLE_SCREEN_COL 64 //左右屏,每屏64列 #define LCD_DispOn 0x3F uint8 dis_buf[22]; //数据缓冲区 void MainMenu(void); void F1Menu(void); void F2Menu(void) ; void Rtc_time (void) ; void RTCInit (void); void StartMenu(void); void Dispchars(uint8 ucPage,uint8 ucCol,uint8 pDisTable[][16],uint8 Num); #define LED1 1<<11 #define LED2 1<<12 #define LED3 1<<13 #define LED4 1<<14 uint8 year; uint8 month; uint8 day; uint8 hour; uint8 min; /******************************************************************************* *名称:Delay() *功能:延时函数 *******************************************************************************/ void Delay(uint32 x) { unsigned int i1,j1; for(j1=0;j1<x;j1++) { for(i1=0;i1<900;i1++); for(i1=0;i1<900;i1++); } } void DelayNS(uint32 nDly) { uint32 nLoop; for(; nDly>0; nDly--) for(nLoop=0; nLoop<50000; nLoop++); } //**************************************************************************** //* 名称: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; //数据线为输出*/ } uint8 KeyDown(void) { IOCLR |= KH0+KH1; // KH0=KH1=0,行线全部置低 IODIR &= 0xFFCFFFFF; // 设置键盘列线控制口为输入 if(((IOPIN & KC0)==0) || ((IOPIN & KC1)==0)) { DelayNS(20); // 延时消抖 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,表明无键盘按下 } //**************************************************************************** //* 名称: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(); //清屏 } ////////////////////////////////////////////////////////////////////////////// /// 名称:main /// 功能:主函数 ////////////////////////////////////////////////////////////////////////////// /* ************************************************************************************************* * Function Name : DisplayByte * * Description : 显示一个字节,即纵向8个像素 * * Date : * * Parameter : ucPage 显示的页 (屏幕一共8页) * * ucCol 要显示的列 (屏幕一共128列) * * ucData 要显示的数据 * * Return Code : 无 * * Author : * ************************************************************************************************* */ void DisplayByte(uint8 ucPage,uint8 ucCol,uint8 ucData) { if(ucCol/SINGLE_SCREEN_COL==0) { LCD12864_SET=LCD12864_CSA; LCD12864_CLR=LCD12864_CSB; } else{ LCD12864_CLR=LCD12864_CSA; LCD12864_SET=LCD12864_CSB; } //设置开始的页,列 vWriteCMD(LCD_PAGE+ucPage); vWriteCMD(LCD_COL+ucCol%SINGLE_SCREEN_COL); vWriteData(ucData); } //**************************************************************************** //* 名称:DispOnechar //* 功能:显示1个字符 //一个字符需要两页*8列 //*注意: 按照这种写法要每个字符单独取模 //*************************************************** void DispOnechar(uint8 ucPage,uint8 ucCol,uint8 *pDisTable) { uint8 i=0; 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)); } } //**************************************************************************** //* 名称:DispOneChinese //* 功能:显示一个汉字 //一个汉字需要两页*16列 //*注意:页,列有改变 //**************************************************************************** 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列 //*注意: 按照这种写法要每个汉字单独取模 //************************************************** 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)); } //**************************************************************************** //* 名称:取反 //* 功能:将选中的项变黑 //************************************************** void Selected(uint8 ucPage,uint8 ucCol,uint8 pDisTable[][32],uint8 num) { uint8 i,j; uint32 temp; for(i=0;i<num;i++) { j=0 ; while(j<32) { temp=pDisTable[i][j]; temp=~temp; if(j<16) DisplayByte(ucPage,ucCol+i*16+j,temp); else DisplayByte(ucPage+1,ucCol+i*16+j-16,temp); j++; } } } //字符取反 void Selchar(uint8 ucPage,uint8 ucCol,uint8 pDisTable[][16],uint8 num) { uint8 i,j; uint32 temp; for(i=0;i<num;i++) { j=0 ; while(j<16) { temp=pDisTable[i][j]; temp=~temp; if(j<8) DisplayByte(ucPage,ucCol+i*8+j,temp); else DisplayByte(ucPage+1,ucCol+i*8+j-8,temp); j++; } } } //**************************************************************************** //* 名称:DispPicture //* 功能:显示一幅图 // //*注意:最大128*64点阵 ,要提供图形的高度和宽度 //************************************************** void DisPicture(uint8 ucPage,uint8 ucCol,uint8 *pDisTable,uint8 width,uint8 hight) { 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)); } ///******************************************************************************** void addhour() { hour=hour++; if(hour==0) Selchar(0,0,num00,2); if(hour==1) Selchar(0,0,num01,2); if(hour==2) Selchar(0,0,num02,2); if(hour==3) Selchar(0,0,num03,2); if(hour==4) Selchar(0,0,num04,2); if(hour==5) Selchar(0,0,num05,2); if(hour==6) Selchar(0,0,num06,2); if(hour==7) Selchar(0,0,num07,2); if(hour==8) Selchar(0,0,num08,2); if(hour==9) Selchar(0,0,num09,2); if(hour==10) Selchar(0,0,num10,2); if(hour==11) Selchar(0,0,num11,2); if(hour==12) Selchar(0,0,num12,2); if(hour==13) Selchar(0,0,num13,2); if(hour==14) Selchar(0,0,num14,2); if(hour==15) Selchar(0,0,num15,2); if(hour==16) Selchar(0,0,num16,2); if(hour==17) Selchar(0,0,num17,2); if(hour==18) Selchar(0,0,num18,2); if(hour==19) Selchar(0,0,num19,2); if(hour==20) Selchar(0,0,num20,2); if(hour==21) Selchar(0,0,num21,2); if(hour==22) Selchar(0,0,num22,2); if(hour==23) Selchar(0,0,num23,2); if(hour>23) hour=hour-24; } void minhour() { hour=hour--; if(hour==0) Selchar(0,0,num00,2); if(hour==1) Selchar(0,0,num01,2); if(hour==2) Selchar(0,0,num02,2); if(hour==3) Selchar(0,0,num03,2); if(hour==4) Selchar(0,0,num04,2); if(hour==5) Selchar(0,0,num05,2); if(hour==6) Selchar(0,0,num06,2); if(hour==7) Selchar(0,0,num07,2); if(hour==8) Selchar(0,0,num08,2); if(hour==9) Selchar(0,0,num09,2); if(hour==10) Selchar(0,0,num10,2); if(hour==11) Selchar(0,0,num11,2); if(hour==12) Selchar(0,0,num12,2); if(hour==13) Selchar(0,0,num13,2); if(hour==14) Selchar(0,0,num14,2); if(hour==15) Selchar(0,0,num15,2); if(hour==16) Selchar(0,0,num16,2); if(hour==17) Selchar(0,0,num17,2); if(hour==18) Selchar(0,0,num18,2); if(hour==19) Selchar(0,0,num19,2); if(hour==20) Selchar(0,0,num20,2); if(hour==21) Selchar(0,0,num21,2); if(hour==22) Selchar(0,0,num22,2); if(hour==23) Selchar(0,0,num23,2); } void addmin() { min=min++; if(min==0) Selchar(0,24,num00,2); if(min==1) Selchar(0,24,num01,2); if(min==2) Selchar(0,24,num02,2); if(min==3) Selchar(0,24,num03,2); if(min==4) Selchar(0,24,num04,2); if(min==5) Selchar(0,24,num05,2); if(min==6) Selchar(0,24,num06,2); if(min==7) Selchar(0,24,num07,2); if(min==8) Selchar(0,24,num08,2); if(min==9) Selchar(0,24,num09,2); if(min==10) Selchar(0,24,num10,2); if(min==11) Selchar(0,24,num11,2); if(min==12) Selchar(0,24,num12,2); if(min==13) Selchar(0,24,num13,2); if(min==14) Selchar(0,24,num14,2); if(min==15) Selchar(0,24,num15,2); if(min==16) Selchar(0,24,num16,2); if(min==17) Selchar(0,24,num17,2); if(min==18) Selchar(0,24,num18,2); if(min==19) Selchar(0,24,num19,2); if(min==20) Selchar(0,24,num20,2); if(min==21) Selchar(0,24,num21,2); if(min==22) Selchar(0,24,num22,2); if(min==23) Selchar(0,24,num23,2); if(min==24) Selchar(0,24,num24,2); if(min==25) Selchar(0,24,num25,2); if(min==26) Selchar(0,24,num26,2); if(min==27) Selchar(0,24,num27,2); if(min==28) Selchar(0,24,num28,2); if(min==29) Selchar(0,24,num29,2); if(min==30) Selchar(0,24,num30,2); if(min==31) Selchar(0,24,num31,2); if(min==32) Selchar(0,24,num32,2); if(min==33) Selchar(0,24,num33,2); if(min==34) Selchar(0,24,num34,2); if(min==35) Selchar(0,24,num35,2); if(min==36) Selchar(0,24,num36,2); if(min==37) Selchar(0,24,num37,2); if(min==38) Selchar(0,24,num38,2); if(min==39) Selchar(0,24,num39,2); if(min==40) Selchar(0,24,num40,2); if(min==41) Selchar(0,24,num41,2); if(min==42) Selchar(0,24,num42,2); if(min==43) Selchar(0,24,num43,2); if(min==44) Selchar(0,24,num44,2); if(min==45) Selchar(0,24,num45,2); if(min==46) Selchar(0,24,num46,2); if(min==47) Selchar(0,24,num47,2); if(min==48) Selchar(0,24,num48,2); if(min==49) Selchar(0,24,num49,2); if(min==50) Selchar(0,24,num50,2); if(min==51) Selchar(0,24,num51,2); if(min==52) Selchar(0,24,num52,2); if(min==53) Selchar(0,24,num53,2); if(min==54) Selchar(0,24,num54,2); if(min==55) Selchar(0,24,num55,2); if(min==56) Selchar(0,24,num56,2); if(min==57) Selchar(0,24,num57,2); if(min==58) Selchar(0,24,num58,2); if(min==59) Selchar(0,24,num59,2); if(min>59) min=min-60; } void minmin() { min=min--; if(min==0) Selchar(0,24,num00,2); if(min==1) Selchar(0,24,num01,2); if(min==2) Selchar(0,24,num02,2); if(min==3) Selchar(0,24,num03,2); if(min==4) Selchar(0,24,num04,2); if(min==5) Selchar(0,24,num05,2); if(min==6) Selchar(0,24,num06,2); if(min==7) Selchar(0,24,num07,2); if(min==8) Selchar(0,24,num08,2); if(min==9) Selchar(0,24,num09,2); if(min==10) Selchar(0,24,num10,2); if(min==11) Selchar(0,24,num11,2); if(min==12) Selchar(0,24,num12,2); if(min==13) Selchar(0,24,num13,2); if(min==14) Selchar(0,24,num14,2); if(min==15) Selchar(0,24,num15,2); if(min==16) Selchar(0,24,num16,2); if(min==17) Selchar(0,24,num17,2); if(min==18) Selchar(0,24,num18,2); if(min==19) Selchar(0,24,num19,2); if(min==20) Selchar(0,24,num20,2); if(min==21) Selchar(0,24,num21,2); if(min==22) Selchar(0,24,num22,2); if(min==23) Selchar(0,24,num23,2); if(min==24) Selchar(0,24,num24,2); if(min==25) Selchar(0,24,num25,2); if(min==26) Selchar(0,24,num26,2); if(min==27) Selchar(0,24,num27,2); if(min==28) Selchar(0,24,num28,2); if(min==29) Selchar(0,24,num29,2); if(min==30) Selchar(0,24,num30,2); if(min==31) Selchar(0,24,num31,2); if(min==32) Selchar(0,24,num32,2); if(min==33) Selchar(0,24,num33,2); if(min==34) Selchar(0,24,num34,2); if(min==35) Selchar(0,24,num35,2); if(min==36) Selchar(0,24,num36,2); if(min==37) Selchar(0,24,num37,2); if(min==38) Selchar(0,24,num38,2); if(min==39) Selchar(0,24,num39,2); if(min==40) Selchar(0,24,num40,2); if(min==41) Selchar(0,24,num41,2); if(min==42) Selchar(0,24,num42,2); if(min==43) Selchar(0,24,num43,2); if(min==44) Selchar(0,24,num44,2); if(min==45) Selchar(0,24,num45,2); if(min==46) Selchar(0,24,num46,2); if(min==47) Selchar(0,24,num47,2); if(min==48) Selchar(0,24,num48,2); if(min==49) Selchar(0,24,num49,2); if(min==50) Selchar(0,24,num50,2); if(min==51) Selchar(0,24,num51,2); if(min==52) Selchar(0,24,num52,2); if(min==53) Selchar(0,24,num53,2); if(min==54) Selchar(0,24,num54,2); if(min==55) Selchar(0,24,num55,2); if(min==56) Selchar(0,24,num56,2); if(min==57) Selchar(0,24,num57,2); if(min==58) Selchar(0,24,num58,2); if(min==59) Selchar(0,24,num59,2); } void makenmin() { if(min==0) Dispchars(0,24,num00,2); if(min==1) Dispchars(0,24,num01,2); if(min==2) Dispchars(0,24,num02,2); if(min==3) Dispchars(0,24,num03,2); if(min==4) Dispchars(0,24,num04,2); if(min==5) Dispchars(0,24,num05,2); if(min==6) Dispchars(0,24,num06,2); if(min==7) Dispchars(0,24,num07,2); if(min==8) Dispchars(0,24,num08,2); if(min==9) Dispchars(0,24,num09,2); if(min==10) Dispchars(0,24,num10,2); if(min==11) Dispchars(0,24,num11,2); if(min==12) Dispchars(0,24,num12,2); if(min==13) Dispchars(0,24,num13,2); if(min==14) Dispchars(0,24,num14,2); if(min==15) Dispchars(0,24,num15,2); if(min==16) Dispchars(0,24,num16,2); if(min==17) Dispchars(0,24,num17,2); if(min==18) Dispchars(0,24,num18,2); if(min==19) Dispchars(0,24,num19,2); if(min==20) Dispchars(0,24,num20,2); if(min==21) Dispchars(0,24,num21,2); if(min==22) Dispchars(0,24,num22,2); if(min==23) Dispchars(0,24,num23,2); if(min==24) Dispchars(0,24,num24,2); if(min==25) Dispchars(0,24,num25,2); if(min==26) Dispchars(0,24,num26,2); if(min==27) Dispchars(0,24,num27,2); if(min==28) Dispchars(0,24,num28,2); if(min==29) Dispchars(0,24,num29,2); if(min==30) Dispchars(0,24,num30,2); if(min==31) Dispchars(0,24,num31,2); if(min==32) Dispchars(0,24,num32,2); if(min==33) Dispchars(0,24,num33,2); if(min==34) Dispchars(0,24,num34,2); if(min==35) Dispchars(0,24,num35,2); if(min==36) Dispchars(0,24,num36,2); if(min==37) Dispchars(0,24,num37,2); if(min==38) Dispchars(0,24,num38,2); if(min==39) Dispchars(0,24,num39,2); if(min==40) Dispchars(0,24,num40,2); if(min==41) Dispchars(0,24,num41,2); if(min==42) Dispchars(0,24,num42,2); if(min==43) Dispchars(0,24,num43,2); if(min==44) Dispchars(0,24,num44,2); if(min==45) Dispchars(0,24,num45,2); if(min==46) Dispchars(0,24,num46,2); if(min==47) Dispchars(0,24,num47,2); if(min==48) Dispchars(0,24,num48,2); if(min==49) Dispchars(0,24,num49,2); if(min==50) Dispchars(0,24,num50,2); if(min==51) Dispchars(0,24,num51,2); if(min==52) Dispchars(0,24,num52,2); if(min==53) Dispchars(0,24,num53,2); if(min==54) Dispchars(0,24,num54,2); if(min==55) Dispchars(0,24,num55,2); if(min==56) Dispchars(0,24,num56,2); if(min==57) Dispchars(0,24,num57,2); if(min==58) Dispchars(0,24,num58,2); if(min==59) Dispchars(0,24,num59,2); } void makenhour() { if(hour==0) Dispchars(0,0,num00,2); if(hour==1) Dispchars(0,0,num01,2); if(hour==2) Dispchars(0,0,num02,2); if(hour==3) Dispchars(0,0,num03,2); if(hour==4) Dispchars(0,0,num04,2); if(hour==5) Dispchars(0,0,num05,2); if(hour==6) Dispchars(0,0,num06,2); if(hour==7) Dispchars(0,0,num07,2); if(hour==8) Dispchars(0,0,num08,2); if(hour==9) Dispchars(0,0,num19,2); if(hour==10) Dispchars(0,0,num10,2); if(hour==11) Dispchars(0,0,num11,2); if(hour==12) Dispchars(0,0,num12,2); if(hour==13) Dispchars(0,0,num13,2); if(hour==14) Dispchars(0,0,num14,2); if(hour==15) Dispchars(0,0,num15,2); if(hour==16) Dispchars(0,0,num16,2); if(hour==17) Dispchars(0,0,num17,2); if(hour==18) Dispchars(0,0,num18,2); if(hour==19) Dispchars(0,0,num19,2); if(hour==20) Dispchars(0,0,num20,2); if(hour==21) Dispchars(0,0,num21,2); if(hour==22) Dispchars(0,0,num22,2); if(hour==23) Dispchars(0,0,num23,2); } ///****************************************************************** ////////////////////////////////////////////////////////////////////////////// /// 名称:main /// 功能:主函数 ////////////////////////////////////////////////////////////////////////////// void show_First_Menu_1() { vCleanAll(); Selected(1,32,F1,4); DispChinese(3,32,F2,4); DispChinese(5,32,F3,4); } void show_First_Menu_2() { vCleanAll(); DispChinese(1,32,F1,4); Selected(3,32,F2,4); DispChinese(5,32,F3,4); } void show_First_Menu_3() { vCleanAll(); DispChinese(1,32,F1,4); DispChinese(3,32,F2,4); Selected(5,32,F3,4); } void show_Second_Menu_1() { vCleanAll(); Selected(0,8,S1,3); DispChinese(2,8,S2,3); DispChinese(4,8,S3,3); DispChinese(6,8,S4,3); DispChinese(0,72,S5,3); DispChinese(2,72,S6,3); } void show_Second_Menu_2() { vCleanAll(); DispChinese(0,8,S1,3); Selected(2,8,S2,3); DispChinese(4,8,S3,3); DispChinese(6,8,S4,3); DispChinese(0,72,S5,3); DispChinese(2,72,S6,3); } void show_Second_Menu_3() { vCleanAll(); DispChinese(0,8,S1,3); DispChinese(2,8,S2,3); Selected(4,8,S3,3); DispChinese(6,8,S4,3); DispChinese(0,72,S5,3); DispChinese(2,72,S6,3); } void show_Second_Menu_4() { vCleanAll(); DispChinese(0,8,S1,3); DispChinese(2,8,S2,3); DispChinese(4,8,S3,3); Selected(6,8,S4,3); DispChinese(0,72,S5,3); DispChinese(2,72,S6,3); } void show_Second_Menu_5() { vCleanAll(); DispChinese(0,8,S1,3); DispChinese(2,8,S2,3); DispChinese(4,8,S3,3); DispChinese(6,8,S4,3); Selected(0,72,S5,3); DispChinese(2,72,S6,3); } void show_Second_Menu_6() { vCleanAll(); DispChinese(0,8,S1,3); DispChinese(2,8,S2,3); DispChinese(4,8,S3,3); DispChinese(6,8,S4,3); DispChinese(0,72,S5,3); Selected(2,72,S6,3); } void show_on() { vCleanAll(); Selected(2,44,on,1); DispOnechar(2,60,G); DispChinese(2,68,off,1); } void show_off() { vCleanAll(); DispChinese(2,44,on,1); DispOnechar(2,60,G); Selected(2,68,off,1); } void show_Th_Menu_1() { vCleanAll(); DispChinese(0,0,date,2); DispOnechar(0,32,colon); Dispchars(2,0,num20,2); Selchar(2,16,num00,2); DispOnechar(2,32,gang); Dispchars(2,40,num00,2); DispOnechar(2,56,gang); Dispchars(2,64,num00,2); DispChinese(4,0,time,2); DispOnechar(4,32,colon); Dispchars(6,0,num00,2); DispOnechar(6,16,colon); Dispchars(6,24,num00,2); } void show_Th_Menu_2() { vCleanAll(); DispChinese(0,0,date,2); DispOnechar(0,32,colon); Dispchars(2,0,num20,2); Dispchars(2,16,num00,2); DispOnechar(2,32,gang); Selchar(2,40,num00,2); DispOnechar(2,56,gang); Dispchars(2,64,num00,2); DispChinese(4,0,time,2); DispOnechar(4,32,colon); Dispchars(6,0,num00,2); DispOnechar(6,16,colon); Dispchars(6,24,num00,2); } void show_Th_Menu_3() { vCleanAll(); DispChinese(0,0,date,2); DispOnechar(0,32,colon); Dispchars(2,0,num20,2); Dispchars(2,16,num00,2); DispOnechar(2,32,gang); Dispchars(2,40,num00,2); DispOnechar(2,56,gang); Selchar(2,64,num00,2); DispChinese(4,0,time,2); DispOnechar(4,32,colon); Dispchars(6,0,num00,2); DispOnechar(6,16,colon); Dispchars(6,24,num00,2); } void show_Th_Menu_4() { vCleanAll(); DispChinese(0,0,date,2); DispOnechar(0,32,colon); Dispchars(2,0,num20,2); Dispchars(2,16,num00,2); DispOnechar(2,32,gang); Dispchars(2,40,num00,2); DispOnechar(2,56,gang); Dispchars(2,64,num00,2); DispChinese(4,0,time,2); DispOnechar(4,32,colon); Selchar(6,0,num00,2); DispOnechar(6,16,colon); Dispchars(6,24,num00,2); } void show_Th_Menu_5() { vCleanAll(); DispChinese(0,0,date,2); DispOnechar(0,32,colon); Dispchars(2,0,num20,2); Dispchars(2,16,num00,2); DispOnechar(2,32,gang); Dispchars(2,40,num00,2); DispOnechar(2,56,gang); Dispchars(2,64,num00,2); DispChinese(4,0,time,2); DispOnechar(4,32,colon); Dispchars(6,0,num00,2); DispOnechar(6,16,colon); Selchar(6,24,num00,2); } void On_Off_1() { int8 SecMenu=0,SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); show_on(); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==3) { SecMenu=(SecMenu+1)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==1) { SecMenu=(SecMenu-1+2)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==2) { F1Menu(); } else if(SecKey==4) { switch(SecMenu) { case 0:{ show_on(); IODIR |= LED1; IOCLR |= LED1; break;} case 1:{ show_off(); IODIR |= LED1; IOSET |= LED1; break;} } } } } void On_Off_2() { int8 SecMenu=0,SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); show_on(); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==3) { SecMenu=(SecMenu+1)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==1) { SecMenu=(SecMenu-1+2)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==2) { F1Menu(); } else if(SecKey==4) { switch(SecMenu) { case 0:{ show_on(); IODIR |= LED2; IOCLR |= LED2; break;} case 1:{ show_off(); IODIR |= LED2; IOSET |= LED2; break;} } } } } void On_Off_3() { int8 SecMenu=0,SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); show_on(); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==3) { SecMenu=(SecMenu+1)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==1) { SecMenu=(SecMenu-1+2)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==2) { F1Menu(); } else if(SecKey==4) { switch(SecMenu) { case 0:{ show_on(); IODIR |= LED3; IOCLR |= LED3; break;} case 1:{ show_off(); IODIR |= LED3; IOSET |= LED3; break;} } } } } void On_Off_4() { int8 SecMenu=0,SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); show_on(); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==3) { SecMenu=(SecMenu+1)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==1) { SecMenu=(SecMenu-1+2)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==2) { F1Menu(); } else if(SecKey==4) { switch(SecMenu) { case 0:{ show_on(); IODIR |= LED4; IOCLR |= LED4; break;} case 1:{ show_off(); IODIR |= LED4; IOSET |= LED4; break;} } } } } void On_Off_5() { int8 SecMenu=0,SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); show_on(); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==3) { SecMenu=(SecMenu+1)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==1) { SecMenu=(SecMenu-1+2)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==2) { F1Menu(); } else if(SecKey==4) { F1Menu(); } } } void On_Off_6() { int8 SecMenu=0,SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); show_on(); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==3) { SecMenu=(SecMenu+1)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==1) { SecMenu=(SecMenu-1+2)%2; switch(SecMenu) { case 1: { show_off(); break; } case 0: { show_on(); break; } } } else if(SecKey==2) { F1Menu(); } else if(SecKey==4) { F1Menu(); } } } void Revise1() { int8 SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); Selchar(0,0,num00,2); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==1) { minhour(); } else if(SecKey==3 ) { addhour(); } else if(SecKey==2) { F2Menu(); } else if(SecKey==4) { makenhour(); } } } void Revise2() { int8 SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); Selchar(0,0,num00,2); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==1) { minhour(); } else if(SecKey==3 ) { addhour(); } else if(SecKey==2) { F2Menu(); } else if(SecKey==4) { makenhour(); } } } void Revise3() { int8 SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); Selchar(0,0,num00,2); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==1) { minhour(); } else if(SecKey==3 ) { addhour(); } else if(SecKey==2) { F2Menu(); } else if(SecKey==4) { makenhour(); } } } void Revise4() { int8 SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); Selchar(0,0,num00,2); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==1) { minhour(); } else if(SecKey==3 ) { addhour(); } else if(SecKey==2) { F2Menu(); } else if(SecKey==4) { makenhour(); } } } void Revise5() { int8 SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); Selchar(0,24,num00,2); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==1) { minhour(); } else if(SecKey==3 ) { addhour(); } else if(SecKey==2) { F2Menu(); } else if(SecKey==4) { makenhour(); } } } void F1Menu() { int8 SecMenu=0,SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); show_Second_Menu_1(); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==1) { SecMenu=(SecMenu-1+6)%6; switch(SecMenu) { case 0: { show_Second_Menu_1(); break;} case 1: { show_Second_Menu_2(); break;} case 2: { show_Second_Menu_3(); break;} case 3: { show_Second_Menu_4(); break;} case 4: { show_Second_Menu_5(); break;} case 5: { show_Second_Menu_6(); break;} } } else if(SecKey==3) { SecMenu=(SecMenu+1)%6; switch(SecMenu) { case 0: { show_Second_Menu_1(); break;} case 1: { show_Second_Menu_2(); break;} case 2: { show_Second_Menu_3(); break;} case 3: { show_Second_Menu_4(); break;} case 4: { show_Second_Menu_5(); break;} case 5: { show_Second_Menu_6(); break;} } } else if(SecKey==2) { MainMenu(); } else if(SecKey==4) { switch(SecMenu) { case 0: { On_Off_1();break;} case 1: { On_Off_2();break;} case 2: { On_Off_3();break;} case 3: { On_Off_4();break;} case 4: { On_Off_5();break;} case 5: { On_Off_6();break;} } } } } void F2Menu() { int8 SecMenu=0,SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); show_Th_Menu_1(); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==3) { SecMenu=(SecMenu+1)%5; switch(SecMenu) { case 0: { show_Th_Menu_1(); break;} case 1: { show_Th_Menu_2(); break;} case 2: { show_Th_Menu_3(); break;} case 3: { show_Th_Menu_4(); break;} case 4: { show_Th_Menu_5(); break;} } } else if(SecKey==1) { SecMenu=(SecMenu-1+5)%5; switch(SecMenu) { case 0: { show_Th_Menu_1(); break;} case 1: { show_Th_Menu_2(); break;} case 2: { show_Th_Menu_3(); break;} case 3: { show_Th_Menu_4(); break;} case 4: { show_Th_Menu_5(); break;} } } else if(SecKey==2) { MainMenu(); } else if(SecKey==4) { switch(SecMenu) { case 0: { Revise1(); break;} case 1: { Revise2(); break;} case 2: { Revise3(); break;} case 3: { Revise4(); break;} case 4: { Revise5(); break;} } } } } void MainMenu() { int8 SecMenu=0,SecKey; IODIR |=KC0+KC1+KH0+KH1; vLCDInit(); show_First_Menu_1(); while(1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==3) { SecMenu=(SecMenu+1)%3; switch(SecMenu) { case 0: { show_First_Menu_1(); break; } case 1: { show_First_Menu_2(); break; } case 2: { show_First_Menu_3(); break; } } } else if(SecKey==1) { SecMenu=(SecMenu-1+3)%3; switch(SecMenu) { case 0: { show_First_Menu_1(); break; } case 1: { show_First_Menu_2(); break; } case 2: { show_First_Menu_3(); break; } } } else if(SecKey==4) { switch(SecMenu) { case 0:{ F1Menu(); break;} case 1:{ F2Menu(); break;} case 2:{ break;} } } else if(SecKey==2 ) { StartMenu(); } } } //**************************************************************************** //* 名称:Dispchars //* 功能:显示n个字符 //一个汉字需要两页*16列 //*注意: 按照这种写法要每个字符单独取模 //************************************************** void Dispchars(uint8 ucPage,uint8 ucCol,uint8 pDisTable[][16],uint8 Num) { uint8 i=0; for(i= 0;i<Num;i++) DispOnechar (ucPage,ucCol+8*i,*(pDisTable+i)); } //******************************************************************************* //** 函数名称 :Rtc_time() //** 函数功能 :读取RTC的时间值 //** 入口参数 :无 //** 出口参数 :无 //*******************************************************************************/ void Rtc_time (void) { uint32 datas; uint32 times; uint32 bak; times = CTIME0; // 读取完整的时钟寄存器 datas = CTIME1; bak = (datas >> 16) & 0xfff; // 获取年 dis_buf[0]=bak/1000; bak = bak % 1000; dis_buf[1]=bak/100; 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; //年 if(dis_buf[0]==0) DispOnechar(0,0,num0); if(dis_buf[0]==1) DispOnechar(0,0,num1); if(dis_buf[0]==2) DispOnechar(0,0,num2); if(dis_buf[0]==3) DispOnechar(0,0,num3); if(dis_buf[0]==4) DispOnechar(0,0,num4); if(dis_buf[1]==0) DispOnechar(0,8,num0); if(dis_buf[1]==1) DispOnechar(0,8,num1); if(dis_buf[1]==2) DispOnechar(0,8,num2); if(dis_buf[1]==3) DispOnechar(0,8,num3); if(dis_buf[1]==4) DispOnechar(0,8,num4); if(dis_buf[1]==5) DispOnechar(0,8,num5); if(dis_buf[1]==6) DispOnechar(0,8,num6); if(dis_buf[1]==7) DispOnechar(0,8,num7); if(dis_buf[1]==8) DispOnechar(0,8,num8); if(dis_buf[1]==9) DispOnechar(0,8,num9); if(dis_buf[2]==0) DispOnechar(0,16,num0); if(dis_buf[2]==1) DispOnechar(0,16,num1); if(dis_buf[2]==2) DispOnechar(0,16,num2); if(dis_buf[2]==3) DispOnechar(0,16,num3); if(dis_buf[2]==4) DispOnechar(0,16,num4); if(dis_buf[2]==5) DispOnechar(0,16,num5); if(dis_buf[2]==6) DispOnechar(0,16,num6); if(dis_buf[2]==7) DispOnechar(0,16,num7); if(dis_buf[2]==8) DispOnechar(0,16,num8); if(dis_buf[2]==9) DispOnechar(0,16,num9); if(dis_buf[3]==0) DispOnechar(0,24,num0); if(dis_buf[3]==1) DispOnechar(0,24,num1); if(dis_buf[3]==2) DispOnechar(0,24,num2); if(dis_buf[3]==3) DispOnechar(0,24,num3); if(dis_buf[3]==4) DispOnechar(0,24,num4); if(dis_buf[3]==5) DispOnechar(0,24,num5); if(dis_buf[3]==6) DispOnechar(0,24,num6); if(dis_buf[3]==7) DispOnechar(0,24,num7); if(dis_buf[3]==8) DispOnechar(0,24,num8); if(dis_buf[3]==9) DispOnechar(0,24,num9); //- DispOnechar(0,32,gang); //月 if(dis_buf[5]==0) DispOnechar(0,40,num0); if(dis_buf[5]==1) DispOnechar(0,40,num1); if(dis_buf[6]==0) DispOnechar(0,48,num0); if(dis_buf[6]==1) DispOnechar(0,48,num1); if(dis_buf[6]==2) DispOnechar(0,48,num2); if(dis_buf[6]==3) DispOnechar(0,48,num3); if(dis_buf[6]==4) DispOnechar(0,48,num4); if(dis_buf[6]==5) DispOnechar(0,48,num5); if(dis_buf[6]==6) DispOnechar(0,48,num6); if(dis_buf[6]==7) DispOnechar(0,48,num7); if(dis_buf[6]==8) DispOnechar(0,48,num8); if(dis_buf[6]==9) DispOnechar(0,48,num9); //- DispOnechar(0,56,gang); //日 if(dis_buf[8]==0) DispOnechar(0,64,num0); if(dis_buf[8]==1) DispOnechar(0,64,num1); if(dis_buf[8]==2) DispOnechar(0,64,num2); if(dis_buf[8]==3) DispOnechar(0,64,num3); if(dis_buf[9]==0) DispOnechar(0,72,num0); if(dis_buf[9]==1) DispOnechar(0,72,num1); if(dis_buf[9]==2) DispOnechar(0,72,num2); if(dis_buf[9]==3) DispOnechar(0,72,num3); if(dis_buf[9]==4) DispOnechar(0,72,num4); if(dis_buf[9]==5) DispOnechar(0,72,num5); if(dis_buf[9]==6) DispOnechar(0,72,num6); if(dis_buf[9]==7) DispOnechar(0,72,num7); if(dis_buf[9]==8) DispOnechar(0,72,num8); if(dis_buf[9]==9) DispOnechar(0,72,num9); //小时 if(dis_buf[13]==0) DispOnechar(2,0,num0); if(dis_buf[13]==1) DispOnechar(2,0,num1); if(dis_buf[13]==2) DispOnechar(2,0,num2); if(dis_buf[14]==0) DispOnechar(2,8,num0); if(dis_buf[14]==1) DispOnechar(2,8,num1); if(dis_buf[14]==2) DispOnechar(2,8,num2); if(dis_buf[14]==3) DispOnechar(2,8,num3); if(dis_buf[14]==4) DispOnechar(2,8,num4); if(dis_buf[14]==5) DispOnechar(2,8,num5); if(dis_buf[14]==6) DispOnechar(2,8,num6); if(dis_buf[14]==7) DispOnechar(2,8,num7); if(dis_buf[14]==8) DispOnechar(2,8,num8); if(dis_buf[14]==9) DispOnechar(2,8,num9); //冒号 DispOnechar(2,16,colon); //分 if(dis_buf[16]==0) DispOnechar(2,24,num0); if(dis_buf[16]==1) DispOnechar(2,24,num1); if(dis_buf[16]==2) DispOnechar(2,24,num2); if(dis_buf[16]==3) DispOnechar(2,24,num3); if(dis_buf[16]==4) DispOnechar(2,24,num4); if(dis_buf[16]==5) DispOnechar(2,24,num5); if(dis_buf[17]==0) DispOnechar(2,32,num0); if(dis_buf[17]==1) DispOnechar(2,32,num1); if(dis_buf[17]==2) DispOnechar(2,32,num2); if(dis_buf[17]==3) DispOnechar(2,32,num3); if(dis_buf[17]==4) DispOnechar(2,32,num4); if(dis_buf[17]==5) DispOnechar(2,32,num5); if(dis_buf[17]==6) DispOnechar(2,32,num6); if(dis_buf[17]==7) DispOnechar(2,32,num7); if(dis_buf[17]==8) DispOnechar(2,32,num8); if(dis_buf[17]==9) DispOnechar(2,32,num9); //冒号 DispOnechar(2,40,colon); //秒 if(dis_buf[19]==0) DispOnechar(2,48,num0); if(dis_buf[19]==1) DispOnechar(2,48,num1); if(dis_buf[19]==2) DispOnechar(2,48,num2); if(dis_buf[19]==3) DispOnechar(2,48,num3); if(dis_buf[19]==4) DispOnechar(2,48,num4); if(dis_buf[19]==5) DispOnechar(2,48,num5); if(dis_buf[20]==0) DispOnechar(2,56,num0); if(dis_buf[20]==1) DispOnechar(2,56,num1); if(dis_buf[20]==2) DispOnechar(2,56,num2); if(dis_buf[20]==3) DispOnechar(2,56,num3); if(dis_buf[20]==4) DispOnechar(2,56,num4); if(dis_buf[20]==5) DispOnechar(2,56,num5); if(dis_buf[20]==6) DispOnechar(2,56,num6); if(dis_buf[20]==7) DispOnechar(2,56,num7); if(dis_buf[20]==8) DispOnechar(2,56,num8); if(dis_buf[20]==9) DispOnechar(2,56,num9); } /******************************************************************************* ** 函数名称 :RTCInit() ** 函数功能 :初始化实时时钟 ** 入口参数 :无 ** 出口参数 :无 *******************************************************************************/ void RTCInit (void) { PREINT = Fpclk / 32768 - 1; // 设置基准时钟分频器 PREFRAC = Fpclk - (Fpclk / 32768) * 32768; CCR = 0x00; // 禁止时间计数器 YEAR = 2007; MONTH = 8; DOM = 1; DOW = 3; HOUR = 8; MIN = 0; SEC = 0; CIIR = 0x01; // 设置秒值的增量产生1次中断 CCR = 0x01; // 启动RTC } void StartMenu() { int8 SecKey; IODIR |=KC0+KC1+KH0+KH1; vCleanAll(); DelayNS(10); // DispChinese(4,0,Tem,2); // DispOnechar(4,32,colon); Dispchars(0,96,num28,2) ; DispOneChinese(0,112,tem1) ; while (1) { SecKey=KeyNum(); IOSET|=KC0+KC1; if(SecKey==4) { MainMenu(); } while (0 == (ILR & 0x01)); // 等待RTC增量中断 ILR = 0x01; // 清除中断标志 Rtc_time(); } } int main() { PINSEL0=0x00000000; //设置IO口工作模式 PINSEL1=0x00000000; IODIR|=LEDCON+LCDBK; IOCLR|=LEDCON; Delay(5000); IOSET|=LEDCON; IOCLR|=LCDBK; vLCDInit(); vCleanAll(); DisPicture(0,0,PicTable,128,64); DelayNS(300); RTCInit(); StartMenu(); }
lcd12864.h /***************************/ //*************************************************************************** //* * //* **************************LCD12864驱动************************** * //* * //*************************************************************************** #ifndef __LCD12864_H__ #define __LCD12864_H__ //#include "config.h" //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> typedef unsigned char BOOLEAN; /* 布尔变量 */ typedef unsigned char INT8U; /* 无符号8位整型变量 */ typedef signed char INT8S; /* 有符号8位整型变量 */ typedef unsigned short INT16U; /* 无符号16位整型变量 */ typedef signed short INT16S; /* 有符号16位整型变量 */ typedef unsigned int INT32U; /* 无符号32位整型变量 */ typedef signed int INT32S; /* 有符号32位整型变量 */ typedef float FP32; /* 单精度浮点数(32位长度) */ typedef double FP64; /* 双精度浮点数(64位长度) */ typedef unsigned char uint8 ; uint8 F1[4][32]= { 0x00,0x18,0x04,0x14,0x94,0x94,0xD5,0xB6,0x14,0x14,0x94,0x04,0x14,0x0C,0x04,0x00, 0x00,0x29,0x29,0x15,0x14,0x4A,0x89,0x44,0x3F,0x06,0x09,0x09,0x10,0x30,0x10,0x00, 0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00, 0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00, 0x08,0x08,0x08,0xFF,0x88,0x48,0x00,0x98,0x48,0x28,0x0A,0x2C,0x48,0xD8,0x08,0x00, 0x02,0x42,0x81,0x7F,0x00,0x00,0x40,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x40,0x00, 0x00,0x50,0x4F,0x4A,0x48,0xFF,0x48,0x48,0x48,0x00,0xFC,0x00,0x00,0xFF,0x00,0x00, 0x00,0x00,0x3F,0x01,0x01,0xFF,0x21,0x61,0x3F,0x00,0x0F,0x40,0x80,0x7F,0x00,0x00 }; uint8 F2[4][32]= { 0x00,0xFC,0x84,0x84,0x84,0xFC,0x00,0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x00, 0x00,0x3F,0x10,0x10,0x10,0x3F,0x00,0x00,0x01,0x06,0x40,0x80,0x7F,0x00,0x00,0x00, 0x00,0xF8,0x01,0x06,0x00,0xF0,0x92,0x92,0x92,0x92,0xF2,0x02,0x02,0xFE,0x00,0x00, 0x00,0xFF,0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x04,0x07,0x40,0x80,0x7F,0x00,0x00, 0x40,0x41,0xCE,0x04,0x00,0x80,0x40,0xBE,0x82,0x82,0x82,0xBE,0xC0,0x40,0x40,0x00, 0x00,0x00,0x7F,0x20,0x90,0x80,0x40,0x43,0x2C,0x10,0x10,0x2C,0x43,0xC0,0x40,0x00, 0x00,0x20,0x2F,0xA9,0xA9,0xAF,0xE9,0xB9,0xA9,0xAF,0xA9,0xA9,0x2F,0x20,0x00,0x00, 0x80,0x80,0x80,0xFF,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xFF,0x80,0x80,0x80,0x00 }; uint8 F3[4][32]= { 0x10,0x0C,0x44,0x44,0x44,0x44,0x45,0xC6,0x44,0x44,0x44,0x44,0x44,0x14,0x0C,0x00, 0x80,0x40,0x20,0x1E,0x20,0x40,0x40,0x7F,0x44,0x44,0x44,0x44,0x44,0x40,0x40,0x00, 0x00,0xFC,0x44,0x44,0x44,0xFC,0x10,0x90,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x00, 0x00,0x07,0x04,0x04,0x04,0x07,0x00,0x00,0x03,0x40,0x80,0x7F,0x00,0x00,0x00,0x00, 0x40,0x41,0xCE,0x04,0x00,0x80,0x40,0xBE,0x82,0x82,0x82,0xBE,0xC0,0x40,0x40,0x00, 0x00,0x00,0x7F,0x20,0x90,0x80,0x40,0x43,0x2C,0x10,0x10,0x2C,0x43,0xC0,0x40,0x00, 0x00,0x20,0x2F,0xA9,0xA9,0xAF,0xE9,0xB9,0xA9,0xAF,0xA9,0xA9,0x2F,0x20,0x00,0x00, 0x80,0x80,0x80,0xFF,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xFF,0x80,0x80,0x80,0x00 }; uint8 S1[3][32]= { 0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00, 0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00, 0x08,0x08,0x89,0x4E,0xAA,0x18,0x00,0xFE,0x02,0x02,0xFA,0x02,0x02,0xFE,0x00,0x00, 0x02,0x01,0x00,0xFF,0x00,0x87,0x42,0x21,0x18,0x06,0x01,0x3E,0x40,0x43,0x70,0x00, 0x08,0x08,0xC8,0xFF,0x48,0x88,0x08,0x00,0xFE,0x02,0x02,0x02,0xFE,0x00,0x00,0x00, 0x04,0x03,0x00,0xFF,0x00,0x41,0x30,0x0C,0x03,0x00,0x00,0x00,0x3F,0x40,0x78,0x00 }; uint8 S2[3][32]= { 0x00,0x02,0xCC,0x00,0x10,0x10,0xF0,0x10,0x00,0xFF,0xC0,0x20,0x38,0x10,0x00,0x00, 0x02,0x7E,0x21,0x10,0x0C,0x03,0x00,0x20,0x40,0x3F,0x00,0x03,0x04,0x18,0x08,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0x88,0x87,0x82,0xF6,0x8A,0x82,0x12,0xE8,0x27,0x22,0x26,0x3A,0xE2,0x02,0x00, 0x20,0x10,0x0C,0x03,0xFF,0x02,0x0C,0x00,0xFF,0x49,0x49,0x49,0x49,0xFF,0x00,0x00 }; uint8 S3[3][32]= { 0x10,0x0C,0x84,0x44,0x24,0x14,0x05,0x06,0x04,0x14,0x24,0x44,0x84,0x14,0x0C,0x00, 0x00,0x40,0x40,0x41,0x41,0x41,0x41,0x7F,0x41,0x41,0x41,0x41,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, 0x20,0x21,0xEE,0x04,0x00,0x00,0xFF,0x29,0xA9,0xBF,0xA9,0xA9,0x01,0xFF,0x00,0x00, 0x00,0x00,0x1F,0x88,0x44,0x30,0x0F,0x00,0x0F,0x04,0x04,0x4F,0x80,0x7F,0x00,0x00 }; uint8 S4[3][32]= { 0x44,0xC4,0x44,0xFF,0x24,0x04,0x14,0xA4,0x7F,0xC4,0x84,0x7C,0x84,0x00,0x00,0x00, 0xC0,0x62,0x34,0x03,0x14,0x62,0x01,0x08,0x30,0x60,0x01,0x08,0x33,0x64,0x07,0x00, 0x00,0x10,0x10,0x10,0x90,0x70,0x00,0xFF,0x20,0x60,0x90,0x08,0x04,0x00,0x00,0x00, 0x10,0x10,0x08,0x06,0x01,0x40,0x80,0x7F,0x00,0x00,0x01,0x06,0x0C,0x18,0x08,0x00, 0x40,0x40,0x4F,0x49,0x49,0xC9,0xCF,0x70,0xC0,0xCF,0x49,0x59,0x69,0x4F,0x00,0x00, 0x02,0x02,0x7E,0x45,0x45,0x44,0x7C,0x00,0x7C,0x44,0x45,0x45,0x7E,0x06,0x02,0x00 }; uint8 S5[3][32]= { 0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00, 0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0x70,0x00,0xFF,0x40,0x30,0x00,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x00, 0x40,0x30,0x0C,0x03,0x02,0x04,0x08,0x00,0x00,0x20,0x40,0x3F,0x00,0x00,0x00,0x00 }; uint8 S6[3][32]= { 0x00,0xFC,0x04,0x04,0xFC,0x00,0x00,0x7F,0x49,0x49,0x49,0x49,0x7F,0x00,0x00,0x00, 0x00,0x0F,0x04,0x04,0x0F,0x00,0xFF,0x49,0x49,0x49,0x49,0x49,0x49,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,0x00,0x00, 0x10,0x10,0xD0,0xFF,0x90,0x10,0x00,0xFE,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00, 0x04,0x03,0x00,0xFF,0x00,0x83,0x60,0x1F,0x00,0x00,0x00,0x3F,0x40,0x40,0x78,0x00 }; uint8 on[1][32]= { 0x40,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0x00, 0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00 }; uint8 off[1][32]= { 0x00,0x10,0x10,0x10,0x11,0x1E,0x14,0xF0,0x10,0x18,0x17,0x12,0x18,0x10,0x00,0x00, 0x01,0x81,0x41,0x21,0x11,0x09,0x05,0x03,0x05,0x09,0x31,0x61,0xC1,0x41,0x01,0x00 }; uint8 G[]= // '/' { 0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00 }; uint8 TDS[6][32]= { 0x00,0xFC,0x84,0x84,0x84,0xFC,0x00,0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x00, 0x00,0x3F,0x10,0x10,0x10,0x3F,0x00,0x00,0x01,0x06,0x40,0x80,0x7F,0x00,0x00,0x00, 0x00,0xF8,0x01,0x06,0x00,0xF0,0x12,0x12,0x12,0xF2,0x02,0x02,0x02,0xFE,0x00,0x00, 0x00,0xFF,0x00,0x00,0x00,0x1F,0x11,0x11,0x11,0x1F,0x00,0x40,0x80,0x7F,0x00,0x00, 0x40,0x41,0xCE,0x04,0x00,0x80,0x40,0xBE,0x82,0x82,0x82,0xBE,0xC0,0x40,0x40,0x00, 0x00,0x00,0x7F,0x20,0x90,0x80,0x40,0x43,0x2C,0x10,0x10,0x2C,0x43,0xC0,0x40,0x00, 0x00,0x20,0x2F,0xA9,0xA9,0xAF,0xE9,0xB9,0xA9,0xAF,0xA9,0xA9,0x2F,0x20,0x00,0x00, 0x80,0x80,0x80,0xFF,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xFF,0x80,0x80,0x80,0x00 }; uint8 TS[4][32]= { 0x10,0x0C,0x44,0x44,0x44,0x44,0x45,0xC6,0x44,0x44,0x44,0x44,0x44,0x14,0x0C,0x00, 0x80,0x40,0x20,0x1E,0x20,0x40,0x40,0x7F,0x44,0x44,0x44,0x44,0x44,0x40,0x40,0x00, 0x00,0xFC,0x84,0x84,0x84,0xFC,0x00,0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x00, 0x00,0x3F,0x10,0x10,0x10,0x3F,0x00,0x00,0x01,0x06,0x40,0x80,0x7F,0x00,0x00,0x00, 0x40,0x41,0xCE,0x04,0x00,0x80,0x40,0xBE,0x82,0x82,0x82,0xBE,0xC0,0x40,0x40,0x00, 0x00,0x00,0x7F,0x20,0x90,0x80,0x40,0x43,0x2C,0x10,0x10,0x2C,0x43,0xC0,0x40,0x00, 0x00,0x20,0x2F,0xA9,0xA9,0xAF,0xE9,0xB9,0xA9,0xAF,0xA9,0xA9,0x2F,0x20,0x00,0x00, 0x80,0x80,0x80,0xFF,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xFF,0x80,0x80,0x80,0x00 } ; uint8 gang []= {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01}; //- uint8 colon[]= {0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00}; // : uint8 num0[]= {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00}; // 0 uint8 num1[]= {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}; // 1 uint8 num2[]= {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}; // 2 uint8 num3[]= {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}; // 3 uint8 num4[]= {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}; // 4 uint8 num5[]= {0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00}; // 5 uint8 num6[]= {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}; // 6 uint8 num7[]= {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00}; // 7 uint8 num8[]= {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00}; // 8 uint8 num9[]= {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00}; // 9 uint8 num28[2][16]= { {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}, // 2 {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00} // 8 }; uint8 tem1[]= { 0x00,0x02,0x05,0xE2,0x18,0x04,0x02,0x02,0x02,0x02,0x02,0x02,0x04,0x1E,0x00,0x00, 0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x18,0x00,0x00 }; uint8 kg[1][32]= { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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 kg2[2][32]= { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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 date[2][32]= //擔婜 { 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, 0x00,0x04,0xFF,0x54,0x54,0x54,0xFF,0x04,0x00,0xFE,0x22,0x22,0x22,0xFE,0x00,0x00, 0x42,0x22,0x1B,0x02,0x02,0x0A,0x33,0x62,0x18,0x07,0x02,0x22,0x42,0x3F,0x00,0x00 }; uint8 time[2][32]= { 0x00,0xFC,0x84,0x84,0x84,0xFC,0x00,0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x00, 0x00,0x3F,0x10,0x10,0x10,0x3F,0x00,0x00,0x01,0x06,0x40,0x80,0x7F,0x00,0x00,0x00, 0x00,0xF8,0x01,0x06,0x00,0xF0,0x92,0x92,0x92,0x92,0xF2,0x02,0x02,0xFE,0x00,0x00, 0x00,0xFF,0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x04,0x07,0x40,0x80,0x7F,0x00,0x00 }; uint8 num00[2][16]= { 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00, 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00 }; uint8 num01[2][16]= { 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00, 0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00 }; uint8 num02[2][16]= { 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00, 0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00 }; uint8 num03[2][16]= { {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00}, {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00} }; uint8 num04[2][16]= { {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00}, {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00} }; uint8 num05[2][16]= { {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00}, {0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00} }; uint8 num06[2][16]= { {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00}, {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00} }; uint8 num07[2][16]= { {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00}, {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00} }; uint8 num08[2][16]= { {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00}, {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00} }; uint8 num09[2][16]= { {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00}, {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00} }; uint8 num10[2][16]= { {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00} }; uint8 num11[2][16]= { {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00} }; uint8 num12[2][16]= { {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00} }; uint8 num13[2][16]= { {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00} }; uint8 num14[2][16]= { {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00} }; uint8 num15[2][16]= { {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00} }; uint8 num16[2][16]= { {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00} }; uint8 num17[2][16]= { {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00} }; uint8 num18[2][16]= { {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00} }; uint8 num19[2][16]= { {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00} }; uint8 num20[2][16]= { {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}, {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00} }; uint8 num21[2][16]= { {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}, {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00} }; uint8 num22[2][16]= { {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}, {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00} }; uint8 num23[2][16]= { {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}, {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00} }; uint8 num24[2][16]= { {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}, {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00} }; uint8 num25[2][16]= { {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}, {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00} }; uint8 num26[2][16]= { {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}, {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00} }; uint8 num27[2][16]= { {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}, {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00} }; uint8 num29[2][16]= { {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}, {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00} }; uint8 num30[2][16]= { {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}, {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00} }; uint8 num31[2][16]= { {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00} }; uint8 num32[2][16]= { {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00} }; uint8 num33[2][16]= { {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00} } ; uint8 num34[2][16]= { {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00} } ; uint8 num35[2][16]= { {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}, {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00} } ; uint8 num36[2][16]= { {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}, {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00} }; uint8 num37[2][16]= { {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00} } ; uint8 num38[2][16]= { {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00} }; uint8 num39[2][16]= { {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}, {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00} } ; uint8 num40[2][16]= { {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}, {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00} }; uint8 num41[2][16]= { {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}, {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00} }; uint8 num42[2][16]= { {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}, {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00} }; uint8 num43[2][16]= { {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}, {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00} }; uint8 num44[2][16]= { {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}, {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00} }; uint8 num45[2][16]= { {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}, {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00} }; uint8 num46[2][16]= { {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}, {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00} }; uint8 num47[2][16]= { {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}, {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00} }; uint8 num48[2][16]= { {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}, {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00} }; uint8 num49[2][16]= { {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}, {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00} }; uint8 num50[2][16]= { {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}, {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00} }; uint8 num51[2][16]= { {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00} } ; uint8 num52[2][16]= { {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00} }; uint8 num53[2][16]= { {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00} }; uint8 num54[2][16]= { {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00} }; uint8 num55[2][16]= { {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}, {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00} }; uint8 num56[2][16]= { {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}, {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00} }; uint8 num57[2][16]= { {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00} }; uint8 num58[2][16]= { {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}, {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00} }; uint8 num59[2][16]= { {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}, {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00} }; uint8 PicTable[]= {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x30,0xF0,0xF0,0xB0,0x90,0xE0,0xF0,0xE0,0xC0,0x00,0x00,0x00,0x00,0xF0,0xF0,0xF0, 0x50,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF0,0xD0,0x78,0xF8,0xF8,0x78,0x78,0x58, 0x38,0x40,0x80,0xE0,0xE0,0xB0,0xF0,0x00,0x00,0x00,0x02,0x06,0x0E,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0xFF,0xFF,0xFD,0x7F,0xB6,0x1D,0x79,0xCE,0xF7,0xFE,0x7C,0xB0,0x7F,0xFF,0xDF, 0x79,0xBB,0xFF,0x80,0xF0,0xFC,0xFC,0xFE,0x7B,0xDD,0x4B,0xCD,0xCB,0xCF,0xFA,0xF7, 0x7A,0xFE,0x5C,0xF0,0xFE,0xFF,0xE7,0xDF,0xB7,0xFF,0x00,0x00,0x00,0x00,0xFE,0xFF, 0xF7,0x7B,0xCB,0xFF,0x00,0xF0,0xDC,0xBE,0xB2,0xFF,0xBF,0xEB,0xEF,0xCF,0xCB,0x5F, 0xDF,0x9E,0x3E,0x00,0xF0,0xD4,0xCC,0xFE,0xFF,0xF9,0x1B,0x0F,0x0F,0x0F,0x1E,0xFF, 0xF2,0x2E,0x54,0xB8,0xE6,0x1F,0x1F,0xF9,0xD5,0xFE,0x6D,0xFF,0xDF,0x1F,0x1F,0x1F, 0x1F,0x2F,0xFF,0xBB,0xF5,0xAF,0xEF,0x1F,0x1D,0x19,0x17,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xC0,0xE3,0xE5,0xC3,0xFF,0x4A,0x00,0x00,0x00,0x03,0x07,0x1F,0x37,0x7B,0xFF,0xDE, 0xC7,0xFD,0xFF,0x01,0x0F,0x15,0x3B,0x63,0x6F,0xED,0xD9,0xF9,0xF1,0xD1,0xF1,0xF9, 0xF1,0x59,0x7D,0x7D,0x07,0x3F,0x73,0xFF,0x75,0xDF,0xFC,0xF8,0xF8,0x78,0x7F,0xF7, 0xFE,0xEF,0xF7,0xFF,0x00,0x38,0x6D,0xE9,0xFB,0xF3,0xB2,0xE3,0xF7,0xF1,0xDF,0x7B, 0x3F,0x37,0x3F,0x0E,0x0F,0x1F,0x3B,0x2E,0x5F,0xEF,0xE8,0xD0,0xB0,0x98,0x78,0xFF, 0x77,0x7D,0x3B,0x1F,0x05,0x00,0x00,0xFF,0xFD,0xD7,0xEB,0xFF,0x7F,0x00,0x00,0x00, 0x00,0x2C,0x7D,0x7B,0xD4,0xEB,0x7F,0xD8,0x70,0xD8,0x78,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; #endif
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 11059000 //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 ********************************************************************************************************/
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 /*************************/ ;/*****************************************************************************/ ;/* STARTUP.S: Startup file for Philips LPC2000 */ ;/*****************************************************************************/ ;/* <<< Use Configuration Wizard in Context Menu >>> */ ;/*****************************************************************************/ ;/* This file is part of the uVision/ARM development tools. */ ;/* Copyright (c) 2005-2007 Keil Software. All rights reserved. */ ;/* This software may only be used under the terms of a valid, current, */ ;/* end user licence from KEIL for a compatible version of KEIL software */ ;/* development tools. Nothing else gives you the right to use this software. */ ;/*****************************************************************************/ ;/* ; * The STARTUP.S code is executed after CPU Reset. This file may be ; * translated with the following SET symbols. In uVision these SET ; * symbols are entered under Options - ASM - Define. ; * ; * REMAP: when set the startup code initializes the register MEMMAP ; * which overwrites the settings of the CPU configuration pins. The ; * startup and interrupt vectors are remapped from: ; * 0x00000000 default setting (not remapped) ; * 0x80000000 when EXTMEM_MODE is used ; * 0x40000000 when RAM_MODE is used ; * ; * EXTMEM_MODE: when set the device is configured for code execution ; * from external memory starting at address 0x80000000. ; * ; * RAM_MODE: when set the device is configured for code execution ; * from on-chip RAM starting at address 0x40000000. ; * ; * EXTERNAL_MODE: when set the PIN2SEL values are written that enable ; * the external BUS at startup. ; */ ; Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs Mode_USR EQU 0x10 Mode_FIQ EQU 0x11 Mode_IRQ EQU 0x12 Mode_SVC EQU 0x13 Mode_ABT EQU 0x17 Mode_UND EQU 0x1B Mode_SYS EQU 0x1F I_Bit EQU 0x80 ; when I bit is set, IRQ is disabled F_Bit EQU 0x40 ; when F bit is set, FIQ is disabled ;// <h> Stack Configuration (Stack Sizes in Bytes) ;// <o0> Undefined Mode <0x0-0xFFFFFFFF:8> ;// <o1> Supervisor Mode <0x0-0xFFFFFFFF:8> ;// <o2> Abort Mode <0x0-0xFFFFFFFF:8> ;// <o3> Fast Interrupt Mode <0x0-0xFFFFFFFF:8> ;// <o4> Interrupt Mode <0x0-0xFFFFFFFF:8> ;// <o5> User/System Mode <0x0-0xFFFFFFFF:8> ;// </h> UND_Stack_Size EQU 0x00000000 SVC_Stack_Size EQU 0x00000008 ABT_Stack_Size EQU 0x00000000 FIQ_Stack_Size EQU 0x00000000 IRQ_Stack_Size EQU 0x00000080 USR_Stack_Size EQU 0x00000400 ISR_Stack_Size EQU (UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + \ FIQ_Stack_Size + IRQ_Stack_Size) AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE USR_Stack_Size __initial_sp SPACE ISR_Stack_Size Stack_Top ;// <h> Heap Configuration ;// <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF> ;// </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit ; VPBDIV definitions VPBDIV EQU 0xE01FC100 ; VPBDIV Address ;// <e> VPBDIV Setup ;// <i> Peripheral Bus Clock Rate ;// <o1.0..1> VPBDIV: VPB Clock ;// <0=> VPB Clock = CPU Clock / 4 ;// <1=> VPB Clock = CPU Clock ;// <2=> VPB Clock = CPU Clock / 2 ;// <o1.4..5> XCLKDIV: XCLK Pin ;// <0=> XCLK Pin = CPU Clock / 4 ;// <1=> XCLK Pin = CPU Clock ;// <2=> XCLK Pin = CPU Clock / 2 ;// </e> VPBDIV_SETUP EQU 0 VPBDIV_Val EQU 0x00000000 ; Phase Locked Loop (PLL) definitions PLL_BASE EQU 0xE01FC080 ; PLL Base Address PLLCON_OFS EQU 0x00 ; PLL Control Offset PLLCFG_OFS EQU 0x04 ; PLL Configuration Offset PLLSTAT_OFS EQU 0x08 ; PLL Status Offset PLLFEED_OFS EQU 0x0C ; PLL Feed Offset PLLCON_PLLE EQU (1<<0) ; PLL Enable PLLCON_PLLC EQU (1<<1) ; PLL Connect PLLCFG_MSEL EQU (0x1F<<0) ; PLL Multiplier PLLCFG_PSEL EQU (0x03<<5) ; PLL Divider PLLSTAT_PLOCK EQU (1<<10) ; PLL Lock Status ;// <e> PLL Setup ;// <o1.0..4> MSEL: PLL Multiplier Selection ;// <1-32><#-1> ;// <i> M Value ;// <o1.5..6> PSEL: PLL Divider Selection ;// <0=> 1 <1=> 2 <2=> 4 <3=> 8 ;// <i> P Value ;// </e> PLL_SETUP EQU 1 PLLCFG_Val EQU 0x00000024 ; Memory Accelerator Module (MAM) definitions MAM_BASE EQU 0xE01FC000 ; MAM Base Address MAMCR_OFS EQU 0x00 ; MAM Control Offset MAMTIM_OFS EQU 0x04 ; MAM Timing Offset ;// <e> MAM Setup ;// <o1.0..1> MAM Control ;// <0=> Disabled ;// <1=> Partially Enabled ;// <2=> Fully Enabled ;// <i> Mode ;// <o2.0..2> MAM Timing ;// <0=> Reserved <1=> 1 <2=> 2 <3=> 3 ;// <4=> 4 <5=> 5 <6=> 6 <7=> 7 ;// <i> Fetch Cycles ;// </e> MAM_SETUP EQU 1 MAMCR_Val EQU 0x00000002 MAMTIM_Val EQU 0x00000004 ; External Memory Controller (EMC) definitions EMC_BASE EQU 0xFFE00000 ; EMC Base Address BCFG0_OFS EQU 0x00 ; BCFG0 Offset BCFG1_OFS EQU 0x04 ; BCFG1 Offset BCFG2_OFS EQU 0x08 ; BCFG2 Offset BCFG3_OFS EQU 0x0C ; BCFG3 Offset ;// <e> External Memory Controller (EMC) EMC_SETUP EQU 0 ;// <e> Bank Configuration 0 (BCFG0) ;// <o1.0..3> IDCY: Idle Cycles <0-15> ;// <o1.5..9> WST1: Wait States 1 <0-31> ;// <o1.11..15> WST2: Wait States 2 <0-31> ;// <o1.10> RBLE: Read Byte Lane Enable ;// <o1.26> WP: Write Protect ;// <o1.27> BM: Burst ROM ;// <o1.28..29> MW: Memory Width <0=> 8-bit <1=> 16-bit ;// <2=> 32-bit <3=> Reserved ;// </e> BCFG0_SETUP EQU 0 BCFG0_Val EQU 0x0000FBEF ;// <e> Bank Configuration 1 (BCFG1) ;// <o1.0..3> IDCY: Idle Cycles <0-15> ;// <o1.5..9> WST1: Wait States 1 <0-31> ;// <o1.11..15> WST2: Wait States 2 <0-31> ;// <o1.10> RBLE: Read Byte Lane Enable ;// <o1.26> WP: Write Protect ;// <o1.27> BM: Burst ROM ;// <o1.28..29> MW: Memory Width <0=> 8-bit <1=> 16-bit ;// <2=> 32-bit <3=> Reserved ;// </e> BCFG1_SETUP EQU 0 BCFG1_Val EQU 0x0000FBEF ;// <e> Bank Configuration 2 (BCFG2) ;// <o1.0..3> IDCY: Idle Cycles <0-15> ;// <o1.5..9> WST1: Wait States 1 <0-31> ;// <o1.11..15> WST2: Wait States 2 <0-31> ;// <o1.10> RBLE: Read Byte Lane Enable ;// <o1.26> WP: Write Protect ;// <o1.27> BM: Burst ROM ;// <o1.28..29> MW: Memory Width <0=> 8-bit <1=> 16-bit ;// <2=> 32-bit <3=> Reserved ;// </e> BCFG2_SETUP EQU 0 BCFG2_Val EQU 0x0000FBEF ;// <e> Bank Configuration 3 (BCFG3) ;// <o1.0..3> IDCY: Idle Cycles <0-15> ;// <o1.5..9> WST1: Wait States 1 <0-31> ;// <o1.11..15> WST2: Wait States 2 <0-31> ;// <o1.10> RBLE: Read Byte Lane Enable ;// <o1.26> WP: Write Protect ;// <o1.27> BM: Burst ROM ;// <o1.28..29> MW: Memory Width <0=> 8-bit <1=> 16-bit ;// <2=> 32-bit <3=> Reserved ;// </e> BCFG3_SETUP EQU 0 BCFG3_Val EQU 0x0000FBEF ;// </e> End of EMC ; External Memory Pins definitions PINSEL2 EQU 0xE002C014 ; PINSEL2 Address PINSEL2_Val EQU 0x0E6149E4 ; CS0..3, OE, WE, BLS0..3, ; D0..31, A2..23, JTAG Pins PRESERVE8 ; Area Definition and Entry Point ; Startup Code must be linked first at Address at which it expects to run. AREA RESET, CODE, READONLY ARM ; Exception Vectors ; Mapped to Address 0. ; Absolute addressing mode must be used. ; Dummy Handlers are implemented as infinite loops which can be modified. Vectors LDR PC, Reset_Addr LDR PC, Undef_Addr LDR PC, SWI_Addr LDR PC, PAbt_Addr LDR PC, DAbt_Addr NOP ; Reserved Vector ; LDR PC, IRQ_Addr LDR PC, [PC, #-0x0FF0] ; Vector from VicVectAddr LDR PC, FIQ_Addr Reset_Addr DCD Reset_Handler Undef_Addr DCD Undef_Handler SWI_Addr DCD SWI_Handler PAbt_Addr DCD PAbt_Handler DAbt_Addr DCD DAbt_Handler DCD 0 ; Reserved Address IRQ_Addr DCD IRQ_Handler FIQ_Addr DCD FIQ_Handler Undef_Handler B Undef_Handler SWI_Handler B SWI_Handler PAbt_Handler B PAbt_Handler DAbt_Handler B DAbt_Handler IRQ_Handler B IRQ_Handler FIQ_Handler B FIQ_Handler ; Reset Handler EXPORT Reset_Handler Reset_Handler ; Setup External Memory Pins IF :DEF:EXTERNAL_MODE LDR R0, =PINSEL2 LDR R1, =PINSEL2_Val STR R1, [R0] ENDIF ; Setup External Memory Controller IF EMC_SETUP <> 0 LDR R0, =EMC_BASE IF BCFG0_SETUP <> 0 LDR R1, =BCFG0_Val STR R1, [R0, #BCFG0_OFS] ENDIF IF BCFG1_SETUP <> 0 LDR R1, =BCFG1_Val STR R1, [R0, #BCFG1_OFS] ENDIF IF BCFG2_SETUP <> 0 LDR R1, =BCFG2_Val STR R1, [R0, #BCFG2_OFS] ENDIF IF BCFG3_SETUP <> 0 LDR R1, =BCFG3_Val STR R1, [R0, #BCFG3_OFS] ENDIF ENDIF ; EMC_SETUP ; Setup VPBDIV IF VPBDIV_SETUP <> 0 LDR R0, =VPBDIV LDR R1, =VPBDIV_Val STR R1, [R0] ENDIF ; Setup PLL IF PLL_SETUP <> 0 LDR R0, =PLL_BASE MOV R1, #0xAA MOV R2, #0x55 ; Configure and Enable PLL MOV R3, #PLLCFG_Val STR R3, [R0, #PLLCFG_OFS] MOV R3, #PLLCON_PLLE STR R3, [R0, #PLLCON_OFS] STR R1, [R0, #PLLFEED_OFS] STR R2, [R0, #PLLFEED_OFS] ; Wait until PLL Locked PLL_Loop LDR R3, [R0, #PLLSTAT_OFS] ANDS R3, R3, #PLLSTAT_PLOCK BEQ PLL_Loop ; Switch to PLL Clock MOV R3, #(PLLCON_PLLE:OR:PLLCON_PLLC) STR R3, [R0, #PLLCON_OFS] STR R1, [R0, #PLLFEED_OFS] STR R2, [R0, #PLLFEED_OFS] ENDIF ; PLL_SETUP ; Setup MAM IF MAM_SETUP <> 0 LDR R0, =MAM_BASE MOV R1, #MAMTIM_Val STR R1, [R0, #MAMTIM_OFS] MOV R1, #MAMCR_Val STR R1, [R0, #MAMCR_OFS] ENDIF ; MAM_SETUP ; Memory Mapping (when Interrupt Vectors are in RAM) MEMMAP EQU 0xE01FC040 ; Memory Mapping Control IF :DEF:REMAP LDR R0, =MEMMAP IF :DEF:EXTMEM_MODE MOV R1, #3 ELIF :DEF:RAM_MODE MOV R1, #2 ELSE MOV R1, #1 ENDIF STR R1, [R0] ENDIF ; Initialise Interrupt System ; ... ; Setup Stack for each mode LDR R0, =Stack_Top ; Enter Undefined Instruction Mode and set its Stack Pointer MSR CPSR_c, #Mode_UND:OR:I_Bit:OR:F_Bit MOV SP, R0 SUB R0, R0, #UND_Stack_Size ; Enter Abort Mode and set its Stack Pointer MSR CPSR_c, #Mode_ABT:OR:I_Bit:OR:F_Bit MOV SP, R0 SUB R0, R0, #ABT_Stack_Size ; Enter FIQ Mode and set its Stack Pointer MSR CPSR_c, #Mode_FIQ:OR:I_Bit:OR:F_Bit MOV SP, R0 SUB R0, R0, #FIQ_Stack_Size ; Enter IRQ Mode and set its Stack Pointer MSR CPSR_c, #Mode_IRQ:OR:I_Bit:OR:F_Bit MOV SP, R0 SUB R0, R0, #IRQ_Stack_Size ; Enter Supervisor Mode and set its Stack Pointer MSR CPSR_c, #Mode_SVC:OR:I_Bit:OR:F_Bit MOV SP, R0 SUB R0, R0, #SVC_Stack_Size ; Enter User Mode and set its Stack Pointer MSR CPSR_c, #Mode_USR IF :DEF:__MICROLIB EXPORT __initial_sp ELSE MOV SP, R0 SUB SL, SP, #USR_Stack_Size ENDIF ; Enter the C code IMPORT __main LDR R0, =__main BX R0 IF :DEF:__MICROLIB EXPORT __heap_base EXPORT __heap_limit ELSE ; User Initial Stack & Heap AREA |.text|, CODE, READONLY IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + USR_Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ENDIF END