8051-ELL库  beta 1.1.6
8051-ELL library API Document Center
STC8x_EEPROM.h
浏览该文件的文档.
1 /*-----------------------------------------------------------------------
2 | FILE DESCRIPTION |
3 -----------------------------------------------------------------------*/
4 /*----------------------------------------------------------------------
5  - File name : STC8x_EEPROM.h
6  - Author : zeweni
7  - Update date : 2020.04.23
8  - Copyright(C) : 2020-2021 zeweni. All rights reserved.
9 -----------------------------------------------------------------------*/
10 /*-----------------------------------------------------------------------
11 | UPDATE NOTE |
12 -----------------------------------------------------------------------*/
13 /*------------------------------------------------------------------------
14 | COPYRIGHT NOTICE |
15 ------------------------------------------------------------------------*/
16 /*
17  * Copyright (C) 2021, zeweni (17870070675@163.com)
18 
19  * This file is part of 8051 ELL low-layer libraries.
20 
21  * 8051 ELL low-layer libraries is free software: you can redistribute
22  * it and/or modify it under the terms of the Apache-2.0 License.
23 
24  * 8051 ELL low-layer libraries is distributed in the hope that it will
25  * be useful,but WITHOUT ANY WARRANTY; without even the implied warranty
26  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * Apache-2.0 License for more details.
28 
29  * You should have received a copy of the Apache-2.0 License.8051 ELL
30  * low-layer libraries. If not, see <http://www.apache.org/licenses/>.
31 **/
32 /*-----------------------------------------------------------------------
33 | INCLUDES |
34 -----------------------------------------------------------------------*/
35 #ifndef __STC8x_EEPROM_H_
36 #define __STC8x_EEPROM_H_
37 
38 /*--------------------------------------------------------
39 | @Description: ELL library core |
40 --------------------------------------------------------*/
41 #include "ELL_CORE.h"
42 
43 /*--------------------------------------------------------
44 | @Description: STC8x MCU Register |
45 --------------------------------------------------------*/
46 
47 #if (PER_LIB_MCU_MUODEL == STC8Ax)
48  #include "STC8Ax_REG.h"
49 #elif (PER_LIB_MCU_MUODEL == STC8Cx)
50  #include "STC8Cx_REG.h"
51 #elif (PER_LIB_MCU_MUODEL == STC8Fx)
52  #include "STC8Fx_REG.h"
53 #elif (PER_LIB_MCU_MUODEL == STC8Gx)
54  #include "STC8Gx_REG.h"
55 #elif (PER_LIB_MCU_MUODEL == STC8Hx)
56  #include "STC8Hx_REG.h"
57 #endif
58 
59 /*-----------------------------------------------------------------------
60 | DATA |
61 -----------------------------------------------------------------------*/
62 
63 
64 #ifndef PER_LIB_MCU_MUODEL
67  #define PER_LIB_MCU_MUODEL STC8Ax
68 #endif
69 
70 
71 #ifndef PER_LIB_EEPROM_CTRL
74  #define PER_LIB_EEPROM_CTRL 1
75 #endif
76 
77 
78 #ifndef PER_LIB_EEPROM_INIT_CTRL
81  #define PER_LIB_EEPROM_INIT_CTRL 1
82 #endif
83 
84 
85 #ifndef PER_LIB_EEPROM_WORK_CTRL
88  #define PER_LIB_EEPROM_WORK_CTRL 1
89 #endif
90 
91 /*-----------------------------------------------------------------------
92 | API FUNCTION |
93 -----------------------------------------------------------------------*/
94 #if (PER_LIB_EEPROM_CTRL == 1)
95 
96  #if (PER_LIB_EEPROM_INIT_CTRL == 1)
97 
106 
107  #endif
108 
109 
110  #if (PER_LIB_EEPROM_WORK_CTRL == 1)
111 
116  #define EEPROM_GET_STATE() (IAP_CONTR & 0x01)
117 
118 
124  #define EEPROM_CTRL(run) {IAP_CONTR = (IAP_CONTR & 0x7F) | (run << 7);}
125 
126 
137 
138 
148 
149 
159 
160 
171 
172 
180 
181 
192 
193  #endif
194 
195 
196 
197 #endif
198 /*-----------------------------------------------------------------------
199 | END OF FLIE. (C) COPYRIGHT zeweni |
200 -----------------------------------------------------------------------*/
201 #endif
BOOL
Definition: ELL_CORE.h:50
FSCSTATE
Definition: ELL_CORE.h:65
unsigned int uint16_t
Definition: ELL_TYPE.h:73
unsigned char uint8_t
Definition: ELL_TYPE.h:72
uint8_t EEPROM_Read_Byte(uint16_t addr)
EEPROM读取一个字节函数。
FSCSTATE EEPROM_Read_Arry(uint16_t addr, uint8_t *arry, uint8_t len)
EEPROM读取一个数组函数。
FSCSTATE EEPROM_Write_Byte(uint16_t addr, uint8_t byte)
EEPROM写一个字节函数。
FSCSTATE EEPROM_Write_Str(uint16_t addr, const uint8_t *str)
EEPROM写一个字符串。
FSCSTATE EEPROM_Erase_Page(uint16_t addr)
EEPROM 擦除扇区函数。
FSCSTATE EEPROM_Init(BOOL run)
EEPROM初始化函数。
FSCSTATE EEPROM_Write_Arry(uint16_t addr, const uint8_t *arry, uint8_t len)
EEPROM写一个数组函数。