部分源代码展示:
/**********************************************************************
文件名: 12864液晶显示电子台历
编 写: 21ic论坛 --- DIY讨论区 --- ID: henangongda123(阿勇)
EEWORLD论坛 --- DIY/开源硬件专区 --- ID: henangongda-123(阿勇)
电子发烧友论坛 --- 单片机/MCU论坛 --- ID: henangongda(阿勇)
时 间: 2018年05月26日
修 改:
2018.05.26 建立初始版本;
2018.07.08 发布简易V1.0版(无LCD背光调节等功能);
2018.07.12 移植网友公开公历转农历算法成功;
2018.07.20 修改网友公开24节气查表算法成功;
2018.07.21 增加十二生肖显示及温度负数处理;
2018.07.26 发布V2.0版(带农历显示、背光亮度调节等功能);
备 注:
1. CPU主时钟选择内部16MHz RC振荡器;
2. 接口说明:
STM8S207CBT6 ----- 外部设备
******** 12864液晶显示器 ********
PD2 ----- YJ_RS
PD3 ----- YJ_RW
PD4 ----- YJ_E
PC1 ----- YJ_PSB
PC2(T1_CH2) ----- YJ_ON(PWM背光调节)
PB0-7 ----- YJ_DB0-7
******** STM8S硬件I2C ********
PE1 ----- DS3231/SHT31_SCL
PE2 ----- DS3231/SHT31_SDA
******** 照度传感器 ********
PE7/AIN8 ---- ON9658/ADC
******** 按键开关 ********
PC4 ---- S1
PC5 ---- S2
PC6 ---- S3
PC7 ---- S4
声明: 1. 本DIY液晶显示部分参考了【杜洋老师】2007年发布的【DIY12864电子
钟】小制作,非常感谢杜洋老师对电子爱好初学者所做的工作,谢谢!
2. 本DIY公历转农历算法为直接移植网友【赖皮】于2007年发布的【最强
万年历】原创程序,在此非常感谢其无私的共享精神,谢谢!
3. 本DIY中24节气算法为修改自网友【未查到原始作者ID名】公开查表算
法,其算法解析详见注释.
**********************************************************************/
//加载头文件
#include "stm8s207CB.h"
//宏定义
#define uchar unsigned char
#define uint unsigned int
#define ushort unsigned short
#define EEP_BASE 0x4000 //STM8S大容量Data EEPROM起始地址
#define EEPROM_Lock() FLASH_IAPSR&=(~0x08)
#define EEPROM_Wait_Read_Over() while(!(FLASH_IAPSR&0x04))
#define EEPROM_Wrover_Clear() FLASH_IAPSR&=(~0x04)
//全局变量
uchar DS3231_R_Data[7]; //定义、保存读取DS3231数据寄存器值
uchar DS3231_W_Data[7]; //定义、保存写入DS3231数据寄存器值
uchar sec,min,hour,day,month,year,week;//定义、保存液晶显示用的年月日时分秒等时间数据
uchar sec_r,min_r,hour_r,day_r,month_r,year_r,week_r;//定义、保存DS3231读取的年月日时分秒等时间数据
int sec_w,min_w,hour_w,day_w,month_w,year_w,week_w;//定义、保存写入DS3231的年月日时分秒等时间数据
uchar year_n,day_n,month_n; //定义保存农历年月日数据
uchar SHT31_R_Data[6]; //定义、保存读取SHT31数据值
int temperature; //定义、保存SHT31读取的温度数值
int humidity; //定义、保存SHT31读取的湿度数值
int mother_day,father_day; //定义、保存西方母亲节、父亲节日期
uint ADC_Data[3]; //定义、保存三次ADC采样数值
//系统运行全局标志
uchar mode=0; //系统工作模式
uchar display=0; //系统显示界面
uchar set_flicker=0; //参数调节闪烁
int brightness_set; //背光亮度选择
uchar month_n_moonday; //农历大小月
uchar solar_term; //24节气值
uchar ADC_Number=0; //ADC采样次数
/*================= 定制化化开机界面图片(宽度x高度=128*64)==================*/
//"欢迎使用 阿勇赠"
const uchar Pic_1[64][16] = {
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0X00,0X00,0X00,0X0F,0XE0,
0X00,0X00,0X78,0X00,0X00,0X00,0X60,0X00,0X00,0X00,0X03,0X80,0X00,0X00,0X7F,0XF0,
0X00,0X00,0XFC,0X00,0X00,0X00,0XF0,0X00,0X00,0X00,0X03,0X80,0X00,0X01,0XF8,0X38,
0X00,0X00,0X9C,0X00,0X00,0X01,0XF0,0X00,0X00,0X02,0X01,0XC0,0X00,0X0F,0XF8,0X38,
0X00,0X00,0X1C,0X00,0X03,0X83,0XFD,0XE0,0X00,0X03,0X81,0XF0,0X00,0X07,0X1C,0X38,
0X00,0X00,0X38,0X00,0X01,0XDF,0XCF,0XF0,0X00,0X03,0XCF,0XF0,0X00,0X07,0X1C,0X38,
0X00,0X00,0X38,0X00,0X01,0XEF,0X0F,0X70,0X00,0X07,0XFF,0XC0,0X00,0X06,0X1F,0X30,
0X00,0X3C,0X31,0XC0,0X01,0XCF,0X0F,0X30,0X00,0X0F,0XCF,0X80,0X00,0X06,0XFF,0XB0,
0X00,0X7E,0X77,0XE0,0X00,0X03,0X9E,0X30,0X00,0X0F,0X8F,0XF0,0X00,0X07,0XFF,0X30,
0X03,0XFE,0X7F,0XE0,0X00,0X03,0XBE,0X70,0X00,0X1E,0X13,0XF8,0X00,0X06,0XFC,0X30,
0X01,0XFE,0XFD,0XE0,0X07,0XE3,0XE6,0X70,0X00,0X3E,0X27,0XF8,0X00,0X06,0X3C,0X30,
0X00,0X9C,0XF9,0XC0,0X07,0XE3,0XE7,0X60,0X00,0X7C,0X5F,0XF8,0X00,0X06,0X3F,0X30,
0X00,0X1C,0XF7,0X80,0X01,0XE3,0XC7,0XE0,0X00,0X7C,0X7F,0XF0,0X00,0X06,0X7F,0XB0,
0X03,0XFC,0XFE,0X00,0X00,0XE3,0XC7,0XE0,0X00,0X7C,0X73,0XE0,0X00,0X06,0XFF,0XB0,
0X0F,0XF8,0XF0,0X00,0X00,0XC3,0X86,0XC0,0X00,0X6C,0X7F,0XE0,0X00,0X07,0XFC,0X30,
0X00,0XF8,0X70,0X00,0X00,0X60,0X86,0X00,0X00,0X0C,0X7F,0X00,0X00,0X06,0XFC,0X30,
0X00,0XFC,0X70,0X00,0X00,0X30,0X06,0X00,0X00,0X0F,0X9F,0X00,0X00,0X0C,0X1C,0X38,
0X01,0XFC,0X7F,0X00,0X00,0X30,0X06,0X00,0X00,0X1D,0XE7,0X00,0X00,0X0C,0X1C,0X38,
0X03,0XCC,0XE7,0XC0,0X00,0X7C,0X06,0X00,0X00,0X1C,0X7E,0X00,0X00,0X0C,0X1C,0X38,
0X0F,0X85,0XE1,0XF0,0X01,0XFF,0XFE,0X00,0X00,0X1C,0X1E,0X00,0X00,0X0C,0X1F,0X38,
0X07,0X03,0XC0,0XF8,0X01,0XF3,0XFF,0XFF,0X00,0X1C,0X0F,0X80,0X00,0X18,0X19,0XF8,
0X00,0X0F,0X80,0X38,0X00,0X00,0X3F,0XFE,0X00,0X1B,0X3F,0XE0,0X00,0X10,0X08,0XF8,
0X00,0X00,0X00,0X1C,0X00,0X00,0X03,0XF0,0X00,0X18,0XF9,0XFC,0X00,0X00,0X08,0X78,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X18,0X00,0XFF,0X80,0X00,0X08,0X38,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X08,0X00,0X7F,0XC0,0X00,0X00,0X18,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7B,0X80,0X00,0X00,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X60,0X00,0X00,0X6F,0X00,0X00,0X05,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XF0,0X00,0X00,0X4F,0X00,0X03,0X89,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XE0,0X7C,0X00,0X0E,0X80,0X04,0XC2,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XE0,0X00,0X7E,0XC0,0X08,0XC7,0XB0,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X78,0X20,0X00,0X7E,0XC0,0X0B,0XFB,0X30,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0X25,0X20,0X00,0X7C,0XC0,0X0B,0XFF,0XA0,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XEF,0XA0,0X00,0X5E,0XC0,0X0B,0X7F,0X60,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XEF,0XA0,0X00,0X5C,0X80,0X0B,0X57,0XC0,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XCF,0X20,0X00,0X1F,0X80,0X0B,0X5F,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0X8F,0X20,0X00,0X3F,0XC0,0X0B,0X77,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0X00,0X20,0X00,0XFC,0XC0,0X0E,0XC7,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0X00,0X20,0X00,0XD8,0XC0,0X06,0X8C,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0X00,0X20,0X00,0X31,0X80,0X05,0X8F,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X02,0X60,0X00,0X71,0X80,0X08,0X8C,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XE0,0X00,0X4B,0X00,0X18,0X0F,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X60,0X00,0X8F,0X00,0X00,0X05,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X20,0X03,0X06,0X00,0X00,0X00,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00
};
/*========================== 公历转农历数据表 ================================*/
//年份数据表(1901-2099年)
const uchar year_code[]={
0x04,0xAe,0x53,0x0A,0x57,0x48,0x55,0x26,0xBd,0x0d,0x26,0x50,0x0d,0x95,0x44, //1901-1905
0x46,0xAA,0xB9,0x05,0x6A,0x4d,0x09,0xAd,0x42,0x24,0xAe,0xB6,0x04,0xAe,0x4A, //1906-1910
0x6A,0x4d,0xBe,0x0A,0x4d,0x52,0x0d,0x25,0x46,0x5d,0x52,0xBA,0x0B,0x54,0x4e, //1911-1915
0x0d,0x6A,0x43,0x29,0x6d,0x37,0x09,0x5B,0x4B,0x74,0x9B,0xC1,0x04,0x97,0x54, //1916-1920
0x0A,0x4B,0x48,0x5B,0x25,0xBC,0x06,0xA5,0x50,0x06,0xd4,0x45,0x4A,0xdA,0xB8, //1921-1925
0x02,0xB6,0x4d,0x09,0x57,0x42,0x24,0x97,0xB7,0x04,0x97,0x4A,0x66,0x4B,0x3e, //1926-1930
0x0d,0x4A,0x51,0x0e,0xA5,0x46,0x56,0xd4,0xBA,0x05,0xAd,0x4e,0x02,0xB6,0x44, //1931-1935
0x39,0x37,0x38,0x09,0x2e,0x4B,0x7C,0x96,0xBf,0x0C,0x95,0x53,0x0d,0x4A,0x48, //1936-1940
0x6d,0xA5,0x3B,0x0B,0x55,0x4f,0x05,0x6A,0x45,0x4A,0xAd,0xB9,0x02,0x5d,0x4d, //1941-1945
0x09,0x2d,0x42,0x2C,0x95,0xB6,0x0A,0x95,0x4A,0x7B,0x4A,0xBd,0x06,0xCA,0x51, //1946-1950
0x0B,0x55,0x46,0x55,0x5A,0xBB,0x04,0xdA,0x4e,0x0A,0x5B,0x43,0x35,0x2B,0xB8, //1951-1955
0x05,0x2B,0x4C,0x8A,0x95,0x3f,0x0e,0x95,0x52,0x06,0xAA,0x48,0x7A,0xd5,0x3C, //1956-1960
0x0A,0xB5,0x4f,0x04,0xB6,0x45,0x4A,0x57,0x39,0x0A,0x57,0x4d,0x05,0x26,0x42, //1961-1965
0x3e,0x93,0x35,0x0d,0x95,0x49,0x75,0xAA,0xBe,0x05,0x6A,0x51,0x09,0x6d,0x46, //1966-1970
0x54,0xAe,0xBB,0x04,0xAd,0x4f,0x0A,0x4d,0x43,0x4d,0x26,0xB7,0x0d,0x25,0x4B, //1971-1975
0x8d,0x52,0xBf,0x0B,0x54,0x52,0x0B,0x6A,0x47,0x69,0x6d,0x3C,0x09,0x5B,0x50, //1976-1980
0x04,0x9B,0x45,0x4A,0x4B,0xB9,0x0A,0x4B,0x4d,0xAB,0x25,0xC2,0x06,0xA5,0x54, //1981-1985
0x06,0xd4,0x49,0x6A,0xdA,0x3d,0x0A,0xB6,0x51,0x09,0x37,0x46,0x54,0x97,0xBB, //1986-1990
0x04,0x97,0x4f,0x06,0x4B,0x44,0x36,0xA5,0x37,0x0e,0xA5,0x4A,0x86,0xB2,0xBf, //1991-1995
0x05,0xAC,0x53,0x0A,0xB6,0x47,0x59,0x36,0xBC,0x09,0x2e,0x50,0x0C,0x96,0x45, //1996-2000
0x4d,0x4A,0xB8,0x0d,0x4A,0x4C,0x0d,0xA5,0x41,0x25,0xAA,0xB6,0x05,0x6A,0x49, //2001-2005
0x7A,0xAd,0xBd,0x02,0x5d,0x52,0x09,0x2d,0x47,0x5C,0x95,0xBA,0x0A,0x95,0x4e, //2006-2010
0x0B,0x4A,0x43,0x4B,0x55,0x37,0x0A,0xd5,0x4A,0x95,0x5A,0xBf,0x04,0xBA,0x53, //2011-2015
0x0A,0x5B,0x48,0x65,0x2B,0xBC,0x05,0x2B,0x50,0x0A,0x93,0x45,0x47,0x4A,0xB9, //2016-2020 2018-351
0x06,0xAA,0x4C,0x0A,0xd5,0x41,0x24,0xdA,0xB6,0x04,0xB6,0x4A,0x69,0x57,0x3d, //2021-2025
0x0A,0x4e,0x51,0x0d,0x26,0x46,0x5e,0x93,0x3A,0x0d,0x53,0x4d,0x05,0xAA,0x43, //2026-2030
0x36,0xB5,0x37,0x09,0x6d,0x4B,0xB4,0xAe,0xBf,0x04,0xAd,0x53,0x0A,0x4d,0x48, //2031-2035
0x6d,0x25,0xBC,0x0d,0x25,0x4f,0x0d,0x52,0x44,0x5d,0xAA,0x38,0x0B,0x5A,0x4C, //2036-2040
0x05,0x6d,0x41,0x24,0xAd,0xB6,0x04,0x9B,0x4A,0x7A,0x4B,0xBe,0x0A,0x4B,0x51, //2041-2045
0x0A,0xA5,0x46,0x5B,0x52,0xBA,0x06,0xd2,0x4e,0x0A,0xdA,0x42,0x35,0x5B,0x37, //2046-2050
0x09,0x37,0x4B,0x84,0x97,0xC1,0x04,0x97,0x53,0x06,0x4B,0x48,0x66,0xA5,0x3C, //2051-2055
0x0e,0xA5,0x4f,0x06,0xB2,0x44,0x4A,0xB6,0x38,0x0A,0xAe,0x4C,0x09,0x2e,0x42, //2056-2060
0x3C,0x97,0x35,0x0C,0x96,0x49,0x7d,0x4A,0xBd,0x0d,0x4A,0x51,0x0d,0xA5,0x45, //2061-2065
0x55,0xAA,0xBA,0x05,0x6A,0x4e,0x0A,0x6d,0x43,0x45,0x2e,0xB7,0x05,0x2d,0x4B, //2066-2070
0x8A,0x95,0xBf,0x0A,0x95,0x53,0x0B,0x4A,0x47,0x6B,0x55,0x3B,0x0A,0xd5,0x4f, //2071-2075
0x05,0x5A,0x45,0x4A,0x5d,0x38,0x0A,0x5B,0x4C,0x05,0x2B,0x42,0x3A,0x93,0xB6, //2076-2080
0x06,0x93,0x49,0x77,0x29,0xBd,0x06,0xAA,0x51,0x0A,0xd5,0x46,0x54,0xdA,0xBA, //2081-2085
0x04,0xB6,0x4e,0x0A,0x57,0x43,0x45,0x27,0x38,0x0d,0x26,0x4A,0x8e,0x93,0x3e, //2086-2090
0x0d,0x52,0x52,0x0d,0xAA,0x47,0x66,0xB5,0x3B,0x05,0x6d,0x4f,0x04,0xAe,0x45, //2091-2095
0x4A,0x4e,0xB9,0x0A,0x4d,0x4C,0x0d,0x15,0x41,0x2d,0x92,0xB5 //2096-2099
};
//月份数据表
const uchar day_code1[9]={0x0,0x1f,0x3b,0x5a,0x78,0x97,0xb5,0xd4,0xf3};
const ushort day_code2[3]={0x111,0x130,0x14e};
/*========================== 24节气表 ================================*/
const uchar jie_qi[]={
0x06,0x15,0x04,0x13,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2000
0x05,0x14,0x04,0x12,0x05,0x14,0x05,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2001
0x05,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x06,0x15,0x06,0x15,
0x07,0x17,0x08,0x17,0x08,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2002
0x06,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x06,0x15,0x06,0x16,
0x07,0x17,0x08,0x17,0x08,0x17,0x09,0x18,0x08,0x17,0x07,0x16, //2003
0x06,0x15,0x04,0x13,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2004
0x05,0x14,0x04,0x12,0x05,0x14,0x05,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2005
0x05,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x05,0x15,0x06,0x15,
0x07,0x17,0x07,0x17,0x08,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2006
0x06,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x06,0x15,0x06,0x16,
0x07,0x17,0x08,0x17,0x08,0x17,0x09,0x18,0x08,0x17,0x07,0x16, //2007
0x06,0x15,0x04,0x13,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2008
0x05,0x14,0x04,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2009
0x05,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x05,0x15,0x06,0x15,
0x07,0x17,0x07,0x17,0x08,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2010
0x06,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x06,0x15,0x06,0x16,
0x07,0x17,0x08,0x17,0x08,0x17,0x08,0x18,0x08,0x17,0x07,0x16, //2011
0x06,0x15,0x04,0x13,0x05,0x14,0x04,0x14,0x05,0x14,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2012
0x05,0x14,0x04,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2013
0x05,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x05,0x15,0x06,0x15,
0x07,0x17,0x07,0x17,0x08,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2014
0x06,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x06,0x15,0x06,0x16,
0x07,0x17,0x08,0x17,0x08,0x17,0x08,0x18,0x08,0x16,0x07,0x16, //2015
0x06,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2016
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2017
0x05,0x14,0x04,0x13,0x05,0x15,0x05,0x14,0x05,0x15,0x06,0x15, //2018-432
0x07,0x17,0x07,0x17,0x08,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2018
0x05,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x06,0x15,0x06,0x15,
0x07,0x17,0x08,0x17,0x08,0x17,0x08,0x18,0x08,0x16,0x07,0x16, //2019
0x06,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2020
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2021
0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,0x05,0x15,0x06,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2022
0x05,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x06,0x15,0x06,0x15,
0x07,0x17,0x08,0x17,0x08,0x17,0x08,0x18,0x08,0x16,0x07,0x16, //2023
0x06,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2024
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2025
0x05,0x14,0x04,0x12,0x05,0x14,0x05,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2026
0x05,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x06,0x15,0x06,0x15,
0x07,0x17,0x08,0x17,0x08,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2027
0x06,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2028
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2029
0x05,0x14,0x04,0x12,0x05,0x14,0x05,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2030
0x05,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x06,0x15,0x06,0x15,
0x07,0x17,0x08,0x17,0x08,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2031
0x06,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2032
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2033
0x05,0x14,0x04,0x12,0x05,0x14,0x05,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2034
0x05,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x05,0x15,0x06,0x15,
0x07,0x17,0x07,0x17,0x08,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2035
0x06,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2036
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2037
0x05,0x14,0x04,0x12,0x05,0x14,0x05,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2038
0x05,0x14,0x04,0x13,0x05,0x15,0x05,0x14,0x05,0x15,0x06,0x15,
0x07,0x17,0x07,0x17,0x08,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2039
0x06,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2040
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x14,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2041
0x05,0x14,0x04,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2042
0x05,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x05,0x15,0x06,0x15,
0x07,0x17,0x07,0x17,0x08,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2043
0x06,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x17,0x07,0x16,0x06,0x15, //2044
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2045
0x05,0x14,0x04,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2046
0x05,0x14,0x04,0x13,0x06,0x15,0x05,0x14,0x05,0x15,0x06,0x15,
0x07,0x17,0x07,0x17,0x08,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2047
0x06,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x17,0x07,0x15,0x06,0x15, //2048
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2049
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2050
0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,0x05,0x15,0x06,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2051
0x05,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x17,0x07,0x15,0x06,0x15, //2052
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2053
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2054
0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2055
0x05,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x17,0x07,0x15,0x06,0x15, //2056
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2057
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2058
0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2059
0x05,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2060
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2061
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2062
0x05,0x14,0x04,0x12,0x05,0x14,0x05,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2063
0x05,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2064
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2065
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2066
0x05,0x14,0x04,0x12,0x05,0x14,0x05,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2067
0x05,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x04,0x14,0x05,0x14,
0x06,0x16,0x06,0x16,0x07,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2068
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2069
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x14,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2070
0x05,0x14,0x04,0x12,0x05,0x14,0x05,0x14,0x05,0x15,0x05,0x15,
0x07,0x17,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2071
0x05,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x04,0x14,0x05,0x14,
0x06,0x16,0x06,0x16,0x07,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2072
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x17,0x07,0x16,0x06,0x15, //2073
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x14,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2074
0x05,0x14,0x04,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2075
0x05,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x04,0x14,0x05,0x14,
0x06,0x16,0x06,0x16,0x07,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2076
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x17,0x07,0x16,0x06,0x15, //2077
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x17,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2078
0x05,0x14,0x04,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2079
0x05,0x14,0x04,0x13,0x05,0x14,0x04,0x13,0x04,0x14,0x05,0x14,
0x06,0x16,0x06,0x16,0x07,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2080
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x17,0x07,0x15,0x06,0x15, //2081
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2082
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2083
0x05,0x14,0x04,0x13,0x04,0x13,0x04,0x13,0x04,0x14,0x05,0x14,
0x06,0x16,0x06,0x16,0x06,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2084
0x04,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x17,0x07,0x15,0x06,0x15, //2085
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x07,0x15, //2086
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x16, //2087
0x05,0x14,0x04,0x13,0x04,0x13,0x04,0x13,0x04,0x14,0x04,0x14,
0x06,0x16,0x06,0x16,0x06,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2088
0x04,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x17,0x07,0x15,0x06,0x15, //2089
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2090
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2091
0x05,0x14,0x04,0x13,0x04,0x13,0x04,0x13,0x04,0x14,0x04,0x14,
0x06,0x16,0x06,0x16,0x06,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2092
0x04,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,
0x06,0x16,0x07,0x16,0x07,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2093
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2094
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15, //2095
0x05,0x14,0x04,0x12,0x04,0x13,0x04,0x13,0x04,0x14,0x04,0x14,
0x06,0x16,0x06,0x16,0x06,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2096
0x04,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x14,
0x06,0x16,0x06,0x16,0x07,0x16,0x07,0x16,0x06,0x15,0x06,0x15, //2097
0x05,0x13,0x03,0x12,0x05,0x14,0x04,0x13,0x05,0x14,0x05,0x15,
0x06,0x16,0x07,0x16,0x07,0x16,0x08,0x17,0x07,0x16,0x06,0x15, //2098
0x05,0x14,0x03,0x12,0x05,0x14,0x04,0x14,0x05,0x15,0x05,0x15,
0x07,0x16,0x07,0x17,0x07,0x17,0x08,0x17,0x07,0x16,0x07,0x15 //2099
};
/********** 延时函数 ********/
/***********************************************************
函数名: delay_us()、delay_ms()
功 能: 微秒级、毫秒级延时程序
参 数: us --- 欲延时微秒数
ms --- 欲延时毫秒数
/**********************************************************/
void delay_us(unsigned int us)
{
//24M 1个int us延时0.68uS
//16M 1.02us
while(us--);
}
void delay_ms(unsigned int ms)//16MHZ 延时1ms
{
unsigned int i;
while(ms--)
{
for(i=0;i<1421;i++){} //1421
}
}
/******* 系统时钟切换操作 *******/
/***********************************************************
函数名: Clk_Init()
功 能: 时钟初始化
参 数: 无
返回值: 无
/**********************************************************/
void Clk_Init(void)
{
CLK_CKDIVR = 0x00;
//配置系统内部时钟分频系数为1(16M),CPU时钟分频系数为1(16M)
}
/********* 端口初始化操作 **********/
/***********************************************************
函数名: Port_Init()
功 能: 端口初始化配置
参 数: 无
返回值: 无
/**********************************************************/
void Port_Init(void)
{
//12864液晶控制接口
PC_DDR |= 0x04; //配置PC2为输出方式(液晶显示器背光控制端口)
PC_CR1 |= 0x04; //配置端口推挽输出
PC_CR2 = 0x00; //普通2M的输出摆率
PC_ODR |= 0x04; //YJ_ON=1,选择开启液晶背光
PD_DDR |= 0x1C; //配置PD2-4为输出方式(液晶显示器RS,RW,E端口)
PD_CR1 |= 0x1C; //配置端口推挽输出
PD_CR2 = 0x00; //普通2M的输出摆率
PB_DDR |= 0xFF; //配置PB0-7输出(液晶数据DB0-7端口)
PB_CR1 |= 0xFF; //推挽输出
PB_CR2 = 0x00; //普通2M摆率
//按键接口
PC_DDR &= (~0xF0); //S1-S4按键接口输入
PC_CR1 |= 0xF0; //上拉输入
}
/********** EEPROM操作 **********/
/***********************************************************
函数名:EEPROM_Unclock()
功 能:EEPROM解锁
参 数:无
返回值:无
/**********************************************************/
void EEPROM_Unclock(void)
{
FLASH_CR1 |= 0x00;
FLASH_DUKR = 0xAE;
FLASH_DUKR = 0x56; // 解锁写保护
while(!(FLASH_IAPSR&0x08)); // 等待解锁
}
/***********************************************************
函数名:EEPROM_Write_Char
功 能:向EEPROM写一字节数据操作
参 数:addr --- 地址;
data --- 数据;
返回值:无
/**********************************************************/
void EEPROM_Write_Char(uchar addr,uchar data)
{
*((uchar*)(addr + EEP_BASE)) = data;
}
/***********************************************************
函数名:EEPROM_Write
功 能:EEPROM写操作(一字节完整操作)
参 数:addr --- 地址;
data --- 数据;
返回值:无
/**********************************************************/
void EEPROM_Write(uchar addr,uchar data)
{
EEPROM_Unclock(); //解锁EEPROM
EEPROM_Write_Char(addr,data);//EEPROM写入一字节
EEPROM_Wait_Read_Over(); //等待写完成
EEPROM_Wrover_Clear(); //清除标志
EEPROM_Lock(); //锁住EEPROM
}
/***********************************************************
函数名:EEPROM_Read()
功 能:EEPROM读操作
参 数:addr --- 欲读取的数据地址
返回值:无
/**********************************************************/
uchar EEPROM_Read(uchar addr)
{
return *((uchar*)(EEP_BASE + addr));//读取一字节数据
} |