📄 sky_main.c
字号:
typedef unsigned char UINT8;
typedef unsigned int UINT16;
typedef unsigned long int UINT32;
#include <Reg52.h>
#define write_XDATA(address, value) (*((unsigned char volatile pdata*)address) = value)
#define ESC 0x01
#define MOVE 0x02
#define DOWN 0x03
#define ENTER 0x04
#define UP 0x05
#define X_ADRESS 0xB8 /* Adress base for Page 0 */
#define Y_ADRESS 0x40 /* Adress base for Y0 */
#define START_LINE 0xC0 /* Adress base for line 0 */
#define DISPLAY_ON 0x3F /* Turn display on */
#define DISPLAY_OFF 0x3E /* Turn display off */
#define LCD_DATA P0
#define LEDON 0x01 /*背光开*/
#define LEDOFF 0x00 /*背光关*/
#define SPEAKERON 0x01 /*音乐开*/
#define SPEAKEROFF 0x00 /*音乐关*/
sfr WDT=0x8f;
code unsigned char Mfont_0[16]={0x00,0xe0,0x10,0x08,0x08,0x10,0xe0,0x00,0x00,0x07,0x08,0x10,0x10,0x08,0x07,0x00}; //
code unsigned char Mfont_1[16]={0x00,0x00,0x10,0x10,0xf8,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x1f,0x10,0x10,0x00}; //
code unsigned char Mfont_2[16]={0x00,0x30,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x18,0x14,0x12,0x11,0x10,0x18,0x00}; //
code unsigned char Mfont_3[16]={0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x0c,0x10,0x10,0x10,0x11,0x0e,0x00}; //
code unsigned char Mfont_4[16]={0x00,0x80,0x40,0x20,0xf8,0x00,0x00,0x00,0x00,0x03,0x02,0x12,0x1f,0x12,0x12,0x00}; //
code unsigned char Mfont_5[16]={0x00,0xf8,0x88,0x48,0x48,0x48,0x88,0x00,0x00,0x0c,0x10,0x10,0x10,0x10,0x0f,0x00}; //
code unsigned char Mfont_6[16]={0x00,0xe0,0x10,0x88,0x88,0x98,0x00,0x00,0x00,0x0f,0x11,0x10,0x10,0x10,0x0f,0x00}; //
code unsigned char Mfont_7[16]={0x00,0x38,0x08,0x08,0xc8,0x38,0x08,0x00,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00}; //
code unsigned char Mfont_8[16]={0x00,0x70,0x88,0x88,0x88,0x88,0x70,0x00,0x00,0x0e,0x11,0x10,0x10,0x11,0x0e,0x00}; //
code unsigned char Mfont_9[16]={0x00,0xf0,0x08,0x08,0x08,0x90,0xe0,0x00,0x00,0x00,0x19,0x11,0x11,0x08,0x07,0x00}; //
code unsigned char * Time_offset[10] = {Mfont_0,Mfont_1,Mfont_2,Mfont_3,Mfont_4,Mfont_5,Mfont_6,Mfont_7,Mfont_8,Mfont_9};
code unsigned char Mfont_S[16]={0x70,0x88,0x84,0x04,0x04,0x08,0x1c,0x00,0x78,0x20,0x40,0x41,0x41,0x22,0x1c,0x00};//S
code unsigned char Mfont_a[16]={0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x33,0x48,0x48,0x44,0x44,0x7f,0x40,0x60};//a
code unsigned char Mfont_v[16]={0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x01,0x06,0x18,0x60,0x18,0x06,0x01,0x00};//v
code unsigned char Mfont_e[16]={0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x1e,0x25,0x44,0x44,0x44,0x15,0x1e,0x00};//e
code unsigned char * Save[4] ={Mfont_S,Mfont_a,Mfont_v,Mfont_e};
code unsigned char nai[32]={0x0,0x40,0x20,0x10,0xCE,0x48,0x48,0x48,0xF8,0x48,0x48,0x48,0x4C,0x8,0x0,0x0,
0x0,0x4,0x4,0x4,0x7,0x4,0x4,0x4,0x7F,0x4,0x4,0x4,0x4,0x6,0x4,0x0};//年
code unsigned char yue[32]={0x00,0x00,0x00,0x00,0x00,0xff,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0xff,0x00,0x00,
0x00,0x40,0x20,0x18,0x06,0x01,0x01,0x01,0x01,0x01,0x21,0x21,0x61,0x3f,0x00,0x00};//月
code unsigned char ri[32]={0x00,0x00,0xfe,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0xfe,0x00,0x00,0x00,
0x00,0x00,0x7f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7f,0x00,0x00,0x00};//日
code unsigned char shi[32]={0x0,0x0,0xF8,0x88,0x88,0xF8,0x0,0x10,0x90,0x10,0x10,0xFE,0x10,0x10,0x10,0x0,
0x0,0x0,0x3F,0x8,0x8,0x1F,0x0,0x0,0x0,0x23,0x40,0x3F,0x0,0x0,0x0,0x0};//时
code unsigned char fei[32]={0x80,0x40,0x20,0x98,0x87,0x82,0x80,0x80,0x83,0x84,0x98,0x30,0x60,0xc0,0x40,0x00,
0x00,0x00,0x40,0x20,0x10,0x0f,0x00,0x00,0x20,0x40,0x3f,0x00,0x00,0x00,0x00,0x00};//分
code unsigned char mao[32]={0x00,0x12,0x12,0xd2,0xfe,0x91,0x11,0xc0,0x38,0x10,0x00,0xff,0x00,0x08,0x10,060,
0x00,0x04,0x03,0x00,0x7f,0x00,0x03,0x00,0x40,0x40,0x20,0x23,0x10,0x08,0x04,0x03};//秒
code unsigned char xin[32]={0x00,0x00,0x00,0x7c,0x54,0x54,0x54,0xd4,0x54,0x54,0x5,0x7e,0x04,0x00,0x00,0x00,
0x00,0x48,0x44,0x4b,0x4a,0x4a,0x4a,0x7f,0x4a,0x4a,0x4a,0x4b,0x62,0x40,0x00,0x00};//星
code unsigned char qi[32]={0x00,0x00,0x08,0xfe,0x28,0x28,0xfe,0x08,0x00,0xfc,0x24,0x24,0x24,0xfe,0x04,0x00,
0x00,0x44,0x24,0x17,0x0d,0x05,0x0f,0x54,0x20,0x1f,0x02,0x22,0x42,0x3f,0x00,0x00};//期
code unsigned char jian[32]={0x00,0xf8,0x02,0x0c,0x00,0xe4,0x24,0x24,0x24,0xe4,0x04,0x04,0xfe,0x04,0x00,0x00,
0x00,0x7f,0x00,0x00,0x00,0x0f,0x09,0x09,0x09,0x0f,0x20,0x40,0x3f,0x00,0x00,0x00};//间
code unsigned char xie[32]={0x00,0x40,0x40,0x42,0xcc,0x80,0x40,0xbc,0x84,0x84,0x84,0x9e,0xa4,0x20,0x20,0x00,
0x00,0x00,0x00,0x00,0x1f,0x48,0x44,0x20,0x23,0x14,0x08,0x14,0x23,0x60,0x20,0x00};//设
code unsigned char zi[32]={0x00,0x00,0x40,0x5c,0x54,0x54,0x5c,0xf4,0x54,0x5c,0x54,0x54,0x5e,0x44,0x40,0x00,
0x00,0x40,0x40,0x40,0x7f,0x55,0x55,0x55,0x55,0x55,0x55,0x7f,0x40,0x40,0x40,0x00};//置
code unsigned char di[32]={0x00,0x00,0x20,0x58,0x48,0x48,0x48,0x4a,0x4c,0x48,0x48,0x48,0x48,0x28,0x18,0x00,
0x00,0x40,0x20,0x10,0x0f,0x10,0x20,0x20,0x7f,0x44,0x44,0x44,0x44,0x40,0x40,0x00};//定
code unsigned char can[32]={0x00,0x40,0x40,0x50,0x50,0xd8,0x74,0x52,0x50,0x50,0x54,0x58,0x50,0x40,0x40,0x00,
0x00,0x04,0x04,0x42,0x55,0x54,0x4a,0x29,0x24,0x12,0x10,0x09,0x02,0x06,0x02,0x00};//参
code unsigned char shu[32]={0x00,0x10,0x94,0x58,0x30,0xfe,0x58,0x94,0x50,0xe0,0x1e,0x10,0x10,0xf8,0x10,0x00,
0x00,0x42,0x42,0x2a,0x2e,0x13,0x1a,0x26,0x40,0x21,0x16,0x08,0x17,0x20,0x40,0x00};//数
code unsigned char ben[32]={0x00,0x00,0x10,0x10,0x10,0x10,0x90,0x50,0xfe,0x50,0x90,0x10,0x10,0x18,0x10,0x00,
0x00,0x08,0x08,0x04,0x05,0x09,0x08,0x08,0x7f,0x08,0x08,0x09,0x05,0x04,0x08,0x00};//本
code unsigned char ji[32]={0x00,0x20,0x20,0xa0,0xfe,0xa0,0x20,0x00,0xfc,0x04,0x04,0xfe,0x04,0x00,0x00,0x00,
0x00,0x04,0x02,0x01,0x7f,0x40,0x21,0x10,0x0f,0x00,0x00,0x3f,0x40,0x40,0x78,0x00};//机
code unsigned char yu[32]={0x00,0x40,0x42,0xcc,0x00,0x04,0x24,0x24,0xe4,0x3c,0x24,0x24,0xe4,0x06,0x04,0x00,
0x00,0x00,0x00,0x3f,0x10,0x09,0x01,0x7d,0x25,0x25,0x25,0x25,0x7d,0x00,0x00,0x00};//语
code unsigned char yan[32]={0x00,0x08,0x08,0x08,0x28,0x28,0x28,0x2a,0x2c,0x28,0x28,0x28,0x28,0x0c,0x08,0x00,
0x00,0x00,0x00,0x00,0x7d,0x25,0x25,0x25,0x25,0x25,0x25,0x7d,0x01,0x00,0x00,0x00};//言
code unsigned char kai[32]={0x00,0x80,0x84,0x84,0x84,0xfc,0x84,0x84,0x84,0x84,0xfc,0x84,0x86,0xc4,0x80,0x00,
0x00,0x40,0x40,0x20,0x10,0x0f,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00};//开
code unsigned char hua[32]={0x00,0x04,0xe4,0x04,0x04,0xf4,0x94,0x94,0xf4,0x94,0x94,0xf4,0x04,0xe6,0x04,0x00,
0x00,0x00,0x3f,0x20,0x20,0x2f,0x28,0x28,0x2f,0x28,0x28,0x2f,0x20,0x7f,0x00,0x00};//画
code unsigned char mian[32]={0x00,0x04,0x04,0xe4,0x24,0x24,0xf4,0xac,0xa4,0xe4,0x24,0x24,0x24,0xe6,0x04,0x00,
0x00,0x00,0x00,0x7f,0x20,0x20,0x3f,0x24,0x24,0x3f,0x20,0x20,0x20,0x7f,0x00,0x00};//面
code unsigned char qian[32]={0x00,0x40,0x70,0xce,0x48,0x00,0xc8,0xb8,0xa0,0xa8,0xa8,0xfe,0xa8,0xf8,0x20,0x00,
0x00,0x02,0x02,0x3f,0x12,0x4a,0x26,0x18,0x27,0x2a,0x4a,0x5f,0x4a,0x4a,0x48,0x00};//键
code unsigned char pan[32]={0x00,0x20,0x20,0x20,0xfc,0x24,0x24,0xae,0x34,0x24,0x24,0xfc,0x20,0x30,0x20,0x00,
0x00,0x44,0x42,0x7d,0x44,0x44,0x7c,0x44,0x45,0x7c,0x45,0x45,0x7c,0x40,0x40,0x00};//盘
code unsigned char sheng[32]={0x00,0x08,0x08,0xa8,0xa8,0xa8,0xa8,0xa8,0xbe,0xa8,0xa8,0xa8,0xa8,0x0c,0x08,0x00,
0x00,0x40,0x20,0x1f,0x04,0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x07,0x00,0x00,0x00};//声
code unsigned char ying[32]={0x00,0x80,0x88,0x88,0x88,0x98,0xe8,0x8a,0x8c,0xc8,0xb8,0x88,0x8c,0xc8,0x80,0x00,
0x00,0x00,0x00,0x00,0x7e,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x7e,0x00,0x00,0x00,0x00};//音
code unsigned char chi[32]={0x00,0x00,0x00,0xf8,0x48,0x48,0x48,0x4a,0x4c,0x48,0x48,0x48,0x7c,0x08,0x00,0x00,
0x00,0x40,0x20,0x1f,0x00,0x7e,0x22,0x22,0x22,0x22,0x22,0x22,0x7e,0x00,0x00,0x00};//启
code unsigned char ting[32]={0x00,0x40,0x20,0xf8,0x06,0x04,0x04,0x74,0x54,0x56,0x54,0x54,0x74,0x04,0x00,0x00,
0x00,0x00,0x00,0x7f,0x00,0x03,0x01,0x05,0x25,0x45,0x3d,0x05,0x05,0x01,0x03,0x00};//停
code unsigned char lu[32]={0x00,0x00,0x7c,0x44,0xc4,0x44,0x7c,0x20,0x10,0xae,0x48,0xa8,0x9c,0x08,0x00,0x00,
0x00,0x20,0x7f,0x20,0x1f,0x11,0x11,0x02,0x7f,0x22,0x22,0x22,0x7e,0x01,0x01,0x00};//路
code unsigned char tian[32]={0x0,0x40,0x44,0x44,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0x46,0x44,0x60,0x40,0x0,
0x0,0x40,0x40,0x20,0x10,0x8,0x6,0x1,0x1,0x6,0x8,0x10,0x20,0x60,0x20,0x0};//天
code unsigned char space[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};//space
code unsigned char guan[32]={0x00,0x00,0x20,0x20,0x22,0x2c,0x20,0xe0,0x20,0x28,0x26,0x20,0x20,0x00,0x00,0x00,
0x00,0x41,0x41,0x21,0x11,0x09,0x07,0x01,0x07,0x09,0x11,0x21,0x41,0x41,0x00,0x00};//关
code unsigned char qing[32]={0x0,0x20,0xC2,0xC,0xC0,0x44,0x54,0x54,0x54,0x7E,0x54,0x54,0x54,0x44,0x40,0x0,
0x0,0x4,0x7C,0x3,0x0,0x0,0x7F,0x15,0x15,0x15,0x15,0x55,0x7F,0x0,0x0,0x0};//清
code unsigned char chiu[32]={0x0,0x0,0xFC,0x44,0xB4,0xC,0x40,0x20,0x50,0x48,0xC6,0x48,0x50,0x20,0x40,0x0,
0x0,0x0,0x7F,0x4,0x8,0x27,0x12,0xA,0x22,0x42,0x3F,0x2,0xA,0x12,0x20,0x0};//除
code unsigned char chen[32]={0x0,0x20,0x10,0x88,0x66,0x0,0xFC,0x24,0xA4,0xA4,0xFC,0xA2,0xA2,0xA2,0x20,0x0,
0x0,0x2,0x1,0x7F,0x40,0x30,0xF,0x0,0x7F,0x2A,0x2A,0x2A,0x2A,0x7F,0x0,0x0};//循
code unsigned char huan[32]={0x0,0x44,0x44,0xFC,0x44,0x44,0x0,0x4,0x84,0x64,0xDC,0x4,0x84,0x6,0x4,0x0,
0x0,0x8,0x18,0x7,0x4,0x0,0x4,0x2,0x1,0x0,0x7F,0x0,0x1,0x6,0x0,0x0};//环
code unsigned char zhou[32]={0x0,0x0,0x0,0xFC,0x4,0x44,0x54,0x54,0x7C,0x54,0x54,0x44,0x4,0xFE,0x4,0x0,
0x0,0x40,0x30,0xF,0x0,0x0,0x1F,0x9,0x9,0x9,0x1F,0x20,0x40,0x3F,0x0,0x0};//周
code unsigned char ju[32]={0x0,0x10,0x10,0xFE,0x90,0x90,0x0,0xFC,0x94,0x94,0xD4,0x94,0x94,0x9E,0x84,0x0,
0x0,0x22,0x41,0x3F,0x40,0x20,0x1C,0x3,0x7C,0x24,0x27,0x24,0x24,0x7C,0x0,0x0};//据
code unsigned char yi[32]={0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,0x80,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};//一
code unsigned char re[32]={0x0,0x0,0x0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x18,0x10,0x0,0x0,0x0,
0x0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x18,0x10,0x0};//二
code unsigned char san[32]={0x0,0x0,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x88,0xC,0x8,0x0,0x0,
0x0,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x30,0x20,0x0};//三
code unsigned char si[32]={0x0,0x0,0xFC,0x4,0x4,0x4,0xFC,0x4,0x4,0xFC,0x4,0x4,0x4,0xFE,0x4,0x0,
0x0,0x0,0x7F,0x28,0x24,0x22,0x21,0x20,0x20,0x23,0x24,0x24,0x24,0x7F,0x0,0x0};//四
code unsigned char wu[32]={0x0,0x0,0x4,0x84,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0xC4,0x86,0x4,0x0,0x0,
0x0,0x40,0x40,0x40,0x40,0x40,0x7F,0x40,0x40,0x40,0x40,0x7F,0x40,0x60,0x40,0x0};//五
code unsigned char liu[32]={0x0,0x0,0x20,0x20,0x20,0x20,0x20,0x22,0x2C,0x20,0x20,0x20,0x20,0x30,0x20,0x0,
0x0,0x0,0x20,0x10,0xC,0x3,0x0,0x0,0x0,0x0,0x1,0x2,0xC,0x30,0x0,0x0};//六
code unsigned char yes[32]={0x0,0x0,0x0,0x0,0x0,0x7C,0x54,0x54,0x54,0x54,0x54,0x7E,0x4,0x80,0x0,0x0,
0x0,0x41,0x21,0x11,0xF,0x9,0x11,0x21,0x3F,0x45,0x45,0x45,0x45,0x45,0x41,0x0};//是
code unsigned char no[32]={0x0,0x84,0x84,0x44,0x24,0x14,0xC,0xFC,0x14,0x14,0x24,0x24,0x46,0xC4,0x0,0x0,
0x0,0x0,0x0,0x7E,0x22,0x22,0x22,0x22,0x22,0x22,0x7F,0x2,0x0,0x0,0x0,0x0};//否
code unsigned char * WEEK1[7]={ri,yi,re,san,si,wu,liu};
code unsigned char * HZ[9]={nai,yue,ri,shi,fei,mao,xin,qi,guan};
code unsigned char * menu1[6]={ri,qi,shi,jian,xie,zi};
code unsigned char * menu2[6]={di,shi,can,shu,xie,zi};
code unsigned char * menu3[6]={ben,ji,xie,zi,space,space};
code unsigned char * menu4[6]={chen,huan,zhou,qi,xie,zi};
code unsigned char * menu5[6]={chi,ting,lu,shu,tian,shu};
code unsigned char * menu6[6]={kai,guan,shi,jian,xie,zi};
code unsigned char * menu7[6]={qing,chiu,shu,ju,xie,zi};
code unsigned char * menu8[6]={qian,pan,sheng,ying,xie,zi};
code unsigned char * menu9[6]={lu,shu,space,xin,qi,space};
code unsigned char * menu10[3]={di,shi,shu};
code unsigned char * system[4]={kai,guan,kai,guan};
code unsigned char * system1[2]={yes,no};
code unsigned char * menu11[8]={qing,chiu,space,tian,space,lu,di,shi};
code UINT8 confirm[2][112]={{0x0,0x8,0x88,0xF8,0x88,0x88,0x48,0xE0,0xB8,0xAE,0xE8,0xB8,0xA8,0xE0,0x0,0x0,0x0,0x20,
0x18,0x88,0x28,0x48,0xA,0xEC,0x8,0x8,0x8,0x8,0x28,0x18,0x0,0x4,0x4,0xF4,0x94,0x94,0xFC,
0x94,0x94,0xFC,0x94,0x94,0xF4,0x6,0x4,0x0,0x20,0xC2,0xC,0xC0,0x44,0x54,0x54,0x54,0x7E,
0x54,0x54,0x54,0x44,0x40,0x0,0x0,0xFC,0x44,0xB4,0xC,0x40,0x20,0x50,0x48,0xC6,0x48,0x50,
0x20,0x40,0x0,0x0,0xF8,0x8,0x8,0xF8,0x0,0x4,0xF4,0x4,0x4,0x4,0xFE,0x4,0x0,0x0,0x0,0x18,
0x4,0x4,0x84,0x44,0x38,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},{0x0,
0x2,0x3F,0x8,0x8,0x5F,0x20,0x1F,0x4,0x4,0x7F,0x4,0x44,0x7F,0x0,0x0,0x0,0x44,0x44,0x24,
0x27,0x14,0xC,0x7,0xC,0x14,0x14,0x24,0x66,0x4,0x0,0x2,0x42,0x42,0x4A,0x2E,0x2B,0x12,
0x12,0x1A,0x26,0x22,0x62,0x2,0x2,0x0,0x4,0x7C,0x3,0x0,0x0,0x7F,0x15,0x15,0x15,0x15,0x55,
0x7F,0x0,0x0,0x0,0x0,0x7F,0x4,0x8,0x27,0x12,0xA,0x22,0x42,0x3F,0x2,0xA,0x12,0x20,0x0,
0x0,0xF,0x2,0x2,0x7,0x0,0x4,0x5,0x5,0x25,0x45,0x21,0x1F,0x0,0x0,0x0,0x0,0x0,0x18,0x1B,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}};
code UINT8 logobmp[6][128]=
{{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x90,0x90,0x90,0x90,0x90,0x10,0x10,0x90,0x90,
0x90,0x90,0x90,0x90,0x90,0x10,0x10,0x10,0x90,0x90,0x90,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x90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0x21,0x21,0xF9,0x21,0x21,0x21,0xF9,0x21,0x20,0x20,0x0,0x0,0xF0,0x10,0x10,0x10,
0x19,0x11,0x11,0x11,0x11,0x10,0x0,0x20,0x20,0xF9,0x21,0x51,0xF0,0x50,0xF8,0xC8,
0x68,0x40,0x0,0x0,0x10,0x50,0x50,0x70,0xD0,0x48,0x48,0x28,0x8,0x0,0x0,0x40,0x60,
0xD8,0x60,0x0,0x90,0x50,0x38,0x10,0x90,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0},{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x1,0x0,0x3E,0x2A,0x2B,0x2A,
0x2A,0x3E,0x0,0x0,0x0,0x0,0x3F,0xA,0x2A,0x3F,0x0,0x3E,0x24,0x24,0x22,0x38,0x0,0x1,
0x0,0x3F,0x4,0x4,0x2,0x3F,0x21,0x20,0x20,0x38,0x0,0x1,0x20,0x30,0x28,0x26,0x21,0x14,
0x18,0x30,0x1,0x1,0x0,0x22,0x22,0x12,0xB,0x2,0x2,0x2,0xB,0xA,0x12,0x22,0x0,0x30,0xF,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x24,0x22,0x3F,0x2,0x3F,0x2A,0x2A,0x3F,0x2A,
0x3F,0x2,0x0,0x20,0x10,0xA,0x26,0x23,0x3E,0x2,0x6,0xB,0x12,0x20,0x0,0x12,0x13,0xA,
0x2A,0x20,0x11,0xF,0x1,0x3F,0x21,0x39,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}};
code UINT8 WAIT[4][80]={{0x0,0x0,0x0,0x0,0x10,0x10,0x90,0x10,0x10,0x10,0xF0,0x10,0x10,0x10,0x10,0x18,0x10,
0x0,0x20,0x20,0x20,0xA0,0x60,0x30,0x2C,0x20,0xA0,0x20,0x20,0x20,0x30,0x20,0x0,0x20,
0x20,0x24,0xB8,0x60,0x0,0x90,0x10,0xF0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x1,0x1,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x3,0x0,0x0,0x0,0x0,
0x0,0x0,0x3,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}};
code unsigned char CLOSEOPEN[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};//????????????~
code unsigned char CLOSEOPENB[7]={0x02,0x04,0x08,0x10,0x20,0x40,0x80 };//??????????????
data UINT8 Year=3,Month=5,Date=1,Week=4,Hour=12,Minute=0,Second=0;// 年月日星期时分秒
bit SecondFlag=0,MinuteFlag=0,HourFlag=0,DateFlag=0,MonthFlag=0,YearFlag=0;
data UINT8 Function=1,BackNum=1,CloseFlag=1;
data UINT8 Lang,Voice;
data UINT8 Pbvalue=0x00,Pcvalue=0x00,Pavalue=0x00;//?????????????????0xff
data UINT16 count2=0;
sbit LCD_CS1 = P2^1;
sbit LCD_CS2 = P2^2;
sbit LCD_RW = P2^4;
sbit LCD_DI = P2^5;
sbit LCD_E = P2^3;
sbit key_out0 = P1^5;
sbit MUNIC = P1^1;
sbit LCD_LED = P1^0;
sbit SPEAKER =P3^2;
void InitLcd(void);
void Delay1(UINT16 time);
void LOGO(void);
void Date_display(UINT8 w,UINT8 y,UINT8 m,UINT8 d,UINT8 n);
void Time_display(UINT8 row,UINT8 h,UINT8 m,UINT8 s,UINT8 n);
void clearRAM(unsigned char startpage,unsigned char stoppage);
void SetRAMAddr(UINT8 Page, UINT8 Col);
void Msingle_font_pattern(unsigned char *page_num, unsigned char page_y_in, unsigned char col_x_in,bit flag);
void HzDisplay(unsigned char *page_num, unsigned char page_y_in, unsigned char col_x_in,bit flag);
void Display_Line(unsigned char num, unsigned char page_y_in, unsigned char len,bit flag);
void Second_moudel(void);
void Display_Save(UINT8 row,UINT8 col);
void Timer0_Init(void);
void CPUInitial(void);
void Num_Display(UINT8 num, unsigned char page_y_in, unsigned char col_x_in,bit flag);
void SingleCmd(unsigned char c);
void SingleData(UINT8 col,unsigned char c);
void LcdWaitBusy(void);
void Contral8255(UINT8 num,bit flag);
void Beep1(UINT8 num);
void LedContral(UINT8 num,bit flag);
UINT8 KeyScan(void);
void ClearWatchDog(void);
sbit ISDA=P2^6;
sbit ISCL=P2^7;
sbit Led1=P1^2;
sbit Led2=P1^3;
sbit Led3=P1^4;
sbit Led4=P1^5;
sbit Led5=P1^6;
sbit Led6=P1^7;
bit EEPROMByteWrite0(UINT16 addr,UINT8 value);
UINT8 EEPROMByteRead0(UINT16 addr1);
void I2cSentByte();
void I2cStart(void);
void I2cStop(void);
extern void _nop_ (void);
data UINT8 c,BeepFlag=0;
bit ack;
bit Contralflag=0;
data UINT8 Luopencloseflag[15];
data UINT8 count1;
bit changflag=1;
bit EEPROMByteWrite0(UINT16 addr,UINT8 value)
{
I2cStart();
c=0xa0;
I2cSentByte();
if (ack==0)
return(0);
c=addr>>8;
I2cSentByte();
if (ack==0)
return(0);
c=addr;
I2cSentByte();
if (ack==0)
return(0);
c=value;
I2cSentByte();
if (ack==0)
return(0);
I2cStop();
Delay1(50);
return(1);
}
UINT8 EEPROMByteRead0(UINT16 addr1)
{
UINT8 bytedata,j;
I2cStart();
c=0xa0;
I2cSentByte();
if (ack==0)
return(0);
c=addr1>>8;
I2cSentByte();
if (ack==0)
return(0);
c=addr1;
I2cSentByte();
if (ack==0)
return(0);
I2cStart();
c=0xa1;
I2cSentByte();
if (ack==0)
return(0);
ISDA=1;
for (j=0;j<8;j++)
{
_nop_();
ISCL=0;
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
ISCL=1;
_nop_();
_nop_();
_nop_();
_nop_();
bytedata<<=1;
if (ISDA)
bytedata|=0x01;
_nop_();
_nop_();
}
ISCL=0;
_nop_();
_nop_();
_nop_();
_nop_();
ISCL=1;
I2cStop();
return (bytedata);
}
void I2cStart(void)
{
ISDA=1;
ISCL=1;
_nop_();
_nop_();
_nop_();
ISDA=0;
_nop_();
_nop_();
_nop_();
ISCL=0;
_nop_();
_nop_();
}
void I2cStop(void)
{
ISDA=0;
ISCL=1;
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
ISDA=1;
_nop_();
_nop_();
_nop_();
_nop_();
ISCL=0;
}
void I2cSentByte()
{
data UINT8 temp1,temp2;
for(temp1=0;temp1<8;temp1++)
{
temp2=c &0x80;
if(temp2==0x80)
ISDA=1;
else
ISDA=0;
c<<=1;
_nop_();
_nop_();
_nop_();
_nop_();
ISCL=1;
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
ISCL=0;
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
}
_nop_();
_nop_();
ISDA=1;
_nop_();
_nop_();
_nop_();
_nop_();
ISCL=1;
_nop_();
_nop_();
_nop_();
_nop_();
if(ISDA==1)
ack=0;
else
ack=1;
ISCL=0;
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
}
void InitLcd(void)
{
LCD_DATA = 0;
LCD_DI = 0;
LCD_RW = 0;
LCD_E = 0;
LCD_CS1 = 0;
LCD_CS2 = 0;
SingleCmd(DISPLAY_OFF); /* Display OFF */
SingleCmd(START_LINE);
SingleCmd(X_ADRESS);
SingleCmd(Y_ADRESS);
SingleCmd(DISPLAY_ON); /* Display ON */
}
/*-------------------------------------------------------------------------------
Send datas to the LCD
LcdDataWrite (U8 u8Data)
u8Data = data to send to the LCD
-------------------------------------------------------------------------------*/
void SingleData(UINT8 col,UINT8 c)
{
LCD_E=0;
LCD_DI=0;
LCD_RW=1;
if(col<64)
{
LCD_CS1=1;
}
else
{
LCD_CS2=1;
}
LcdWaitBusy(); /* wait until LCD not busy */
LCD_DI = 1; /* Data mode */
LCD_RW = 0; /* write mode */
LCD_DATA = c; /* outbyte */
Delay1(1);
LCD_E = 1; /* Strobe */
Delay1(2);
LCD_E = 0;
Delay1(3);
LCD_CS1=0;
LCD_CS2=0;
}
/*-------------------------------------------------------------------------------
Send instruction to the LCD
LcdDataWrite (U8 u8Instruction)
u8Instruction = Instructino to send to the LCD
-------------------------------------------------------------------------------*/
void SingleCmd(UINT8 c)
{
LCD_E=0;
LCD_DI=0;
LCD_RW=1;
LCD_CS1=1;
LCD_CS2=1;
LcdWaitBusy (); /* wait until LCD not busy */
LCD_DI = 0; /* Instruction mode */
LCD_RW = 0; /* Write mode */
LCD_E = 1; /* Strobe */
Delay1(2);
LCD_DATA = c;/* outbyte */
Delay1(3);
LCD_E = 0;
Delay1(5);
LCD_CS1=0;
LCD_CS2=0;
}
void LcdWaitBusy (void)
{
LCD_DATA=0xFF; /* set LCD_DATA port in input mode */
LCD_DI = 0; /* Instruction mode */
LCD_RW = 1; /* Read mode */
LCD_E = 1; /* strobe */
Delay1(1);
LCD_E = 0;
while ( LCD_DATA & 0x7f == 0x80); /* mask the other status bits and test the BUSY bit */
}
void clearRAM(UINT8 startp,UINT8 endp)
{
data UINT8 u8Page,u8Column;
for (u8Page = startp; u8Page < endp; u8Page++)
{
SetRAMAddr(u8Page,0x00);
for (u8Column = 0; u8Column < 128; u8Column++)
{
SingleData(u8Column,0x00); /* erase a column */
}
}
}
void SetRAMAddr (UINT8 Page, UINT8 Col)
{
SingleCmd(X_ADRESS | Page); /* Set the page number */
SingleCmd(Y_ADRESS |Col);
}
void LOGO(void)
{
data char j,k;
data UINT8 temp;
for(k=63;k>=0;k--)
{
for(j=1;j<7;j++)
{
SetRAMAddr(j,k);
SingleData(k,0xff);
SetRAMAddr(j,127-k);
SingleData(127-k,0xff);
}
}
ClearWatchDog();
Delay1(60000);
for(k=63;k>=0;k--)
{
for(j=1;j<7;j++)
{
SetRAMAddr(j,k);
SingleData(k,logobmp[j-1][k]);
SetRAMAddr(j,127-k);
SingleData(127-k,logobmp[j-1][127-k]);
}
Delay1(3000);
temp=KeyScan();
if(temp !=0)
return;
}
ClearWatchDog();
for(k=63;k>=0;k--)
{
for(j=1;j<7;j++)
{
SetRAMAddr(j,k);
SingleData(k,~logobmp[j-1][k]);
SetRAMAddr(j,127-k);
SingleData(127-k,~logobmp[j-1][127-k]);
}
Delay1(3000);
temp=KeyScan();
if(temp !=0)
return;
}
ClearWatchDog();
Delay1(60000);
for(k=63;k>=0;k--)
{
for(j=1;j<7;j++)
{
SetRAMAddr(j,k);
SingleData(k,logobmp[j-1][k]);
SetRAMAddr(j,127-k);
SingleData(127-k,logobmp[j-1][127-k]);
}
Delay1(3000);
temp=KeyScan();
if(temp !=0)
return;
}
ClearWatchDog();
Delay1(60000);
}
void HzDisplay(unsigned char *page_num, unsigned char page_y_in, unsigned char col_x_in,bit flag)
{
data unsigned char i;
data unsigned char page_y;
data unsigned char col_x;
page_y = page_y_in;
col_x = col_x_in;
SetRAMAddr(page_y,col_x);
for (i=0;i<16;i++) {
if(flag==0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -