8051-ELL库  beta 1.1.6
8051-ELL library API Document Center
STC8x_RST.h
浏览该文件的文档.
1 /*-----------------------------------------------------------------------
2 | FILE DESCRIPTION |
3 -----------------------------------------------------------------------*/
4 /*----------------------------------------------------------------------
5  - File name : STC8x_RST.h
6  - Author : zeweni
7  - Update date : 2020.02.06
8  - Copyright(C) : 2020-2021 zeweni. All rights reserved.
9 -----------------------------------------------------------------------*/
10 /*------------------------------------------------------------------------
11 | COPYRIGHT NOTICE |
12 ------------------------------------------------------------------------*/
13 /*
14  * Copyright (C) 2021, zeweni (17870070675@163.com)
15 
16  * This file is part of 8051 ELL low-layer libraries.
17 
18  * 8051 ELL low-layer libraries is free software: you can redistribute
19  * it and/or modify it under the terms of the Apache-2.0 License.
20 
21  * 8051 ELL low-layer libraries is distributed in the hope that it will
22  * be useful,but WITHOUT ANY WARRANTY; without even the implied warranty
23  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * Apache-2.0 License for more details.
25 
26  * You should have received a copy of the Apache-2.0 License.8051 ELL
27  * low-layer libraries. If not, see <http://www.apache.org/licenses/>.
28 **/
29 /*-----------------------------------------------------------------------
30 | INCLUDES |
31 -----------------------------------------------------------------------*/
32 #ifndef __STC8x_RST_H_
33 #define __STC8x_RST_H_
34 
35 /*--------------------------------------------------------
36 | @Description: ELL library core |
37 --------------------------------------------------------*/
38 #include "ELL_CORE.h"
39 
40 /*--------------------------------------------------------
41 | @Description: STC8x MCU Register |
42 --------------------------------------------------------*/
43 
44 #if (PER_LIB_MCU_MUODEL == STC8Ax)
45  #include "STC8Ax_REG.h"
46 #elif (PER_LIB_MCU_MUODEL == STC8Cx)
47  #include "STC8Cx_REG.h"
48 #elif (PER_LIB_MCU_MUODEL == STC8Fx)
49  #include "STC8Fx_REG.h"
50 #elif (PER_LIB_MCU_MUODEL == STC8Gx)
51  #include "STC8Gx_REG.h"
52 #elif (PER_LIB_MCU_MUODEL == STC8Hx)
53  #include "STC8Hx_REG.h"
54 #endif
55 
56 /*-----------------------------------------------------------------------
57 | DATA |
58 -----------------------------------------------------------------------*/
59 
60 
61 #ifndef PER_LIB_MCU_MUODEL
64  #define PER_LIB_MCU_MUODEL STC8Ax
65 #endif
66 
67 
68 #ifndef PER_LIB_RST_CTRL
71  #define PER_LIB_RST_CTRL 1
72 #endif
73 
74 
75 #ifndef PER_LIB_RST_INIT_CTRL
78  #define PER_LIB_RST_INIT_CTRL 1
79 #endif
80 
81 
82 #ifndef PER_LIB_RST_WORK_CTRL
85  #define PER_LIB_RST_WORK_CTRL 1
86 #endif
87 
88 
93 typedef enum
94 {
95 
96  RST_USER_DATA_KEEP = 0x00,
101  RST_USER_DATA_CLEAN = 0x01
106 
107 
112 typedef enum
113 {
114  LVD_RST_2_2V = 0x00,
115  LVD_RST_2_4V = 0x01,
116  LVD_RST_2_7V = 0x02,
117  LVD_RST_3_0V = 0x03
119 
120 /*-----------------------------------------------------------------------
121 | API FUNCTION |
122 -----------------------------------------------------------------------*/
123 #if (PER_LIB_RST_CTRL == 1)
124 
125  #if (PER_LIB_RST_INIT_CTRL == 1)
126 
137 
138  #endif
139 
140  #if (PER_LIB_RST_WORK_CTRL == 1)
141 
151 
152 
163  void Auto_RST_download(void);
164 
165 
170  #define RST_P54_ENABLE() do{RSTCFG |= 0x10;}while(0)
171 
172 
177  #define RST_P54_DISABLE() do{RSTCFG &= 0xEF;}while(0)
178 
179  #endif
180 
181 #endif
182 /*-----------------------------------------------------------------------
183 | END OF FLIE. (C) COPYRIGHT zeweni |
184 -----------------------------------------------------------------------*/
185 #endif
BOOL
Definition: ELL_CORE.h:50
FSCSTATE
Definition: ELL_CORE.h:65
FSCSTATE LVD_RST_Init(LVDRstDiv_Type lvDiv, BOOL run)
低压复位函数,可以选择不同低压复位标准。
RSTChoice_Type
RST复位方式选择枚举体。
Definition: STC8x_RST.h:94
@ RST_USER_DATA_CLEAN
Definition: STC8x_RST.h:101
@ RST_USER_DATA_KEEP
Definition: STC8x_RST.h:96
void Auto_RST_download(void)
软件复位自动下载功能,需要在串口中断里调用, 需要在STC-ISP助手里设置下载口令:10个0x7F。
FSCSTATE SFW_RST_Ctrl(RSTChoice_Type choice, BOOL run)
软件复位控制函数。
LVDRstDiv_Type
低压复位的电压临界点选择枚举体。
Definition: STC8x_RST.h:113
@ LVD_RST_2_7V
Definition: STC8x_RST.h:116
@ LVD_RST_3_0V
Definition: STC8x_RST.h:117
@ LVD_RST_2_4V
Definition: STC8x_RST.h:115
@ LVD_RST_2_2V
Definition: STC8x_RST.h:114