8051-ELL库  beta 1.1.6
8051-ELL library API Document Center
STC8x_WDT.h
浏览该文件的文档.
1 /*-----------------------------------------------------------------------
2 | FILE DESCRIPTION |
3 -----------------------------------------------------------------------*/
4 /*----------------------------------------------------------------------
5  - File name : STC8x_WDT.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_WDT_H_
33 #define __STC8x_WDT_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 /*-----------------------------------------------------------------------
58 | DATA |
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 
89 /*--------------------------------------------------------
90 | @Description: WDT clock ferquency division define |
91 --------------------------------------------------------*/
92 
93 #define WDTCLK_DIV2 0x00
94 #define WDTCLK_DIV4 0x01
95 #define WDTCLK_DIV8 0x02
96 #define WDTCLK_DIV16 0x03
97 #define WDTCLK_DIV32 0x04
98 #define WDTCLK_DIV64 0x05
99 #define WDTCLK_DIV128 0x06
100 #define WDTCLK_DIV256 0x07
101 
102 /*-----------------------------------------------------------------------
103 | API FUNCTION |
104 -----------------------------------------------------------------------*/
105 
106 #if (PER_LIB_RST_CTRL == 1)
107 
108  #if (PER_LIB_RST_INIT_CTRL == 1)
109 
119 
120  #endif
121 
122  #if (PER_LIB_RST_WORK_CTRL == 1)
123 
131 
132 
138  #define WDT_FEED() do{WDT_CONTR |= 0x10;}while(0)
139 
140  #endif
141 
142 #endif
143 /*-----------------------------------------------------------------------
144 | END OF FLIE. (C) COPYRIGHT zeweni |
145 -----------------------------------------------------------------------*/
146 #endif
BOOL
Definition: ELL_CORE.h:50
FSCSTATE
Definition: ELL_CORE.h:65
unsigned long uint32_t
Definition: ELL_TYPE.h:74
unsigned char uint8_t
Definition: ELL_TYPE.h:72
uint32_t Get_WDT_Time(void)
获取喂狗时间函数,以便定时喂狗。
FSCSTATE WDT_Init(uint8_t clKDiv, BOOL run)
看门狗初始函数。