32 #ifndef __STC8Ax_COMP_H_
33 #define __STC8Ax_COMP_H_
44 #if (PER_LIB_MCU_MUODEL == STC8Ax)
46 #elif (PER_LIB_MCU_MUODEL == STC8Cx)
48 #elif (PER_LIB_MCU_MUODEL == STC8Fx)
50 #elif (PER_LIB_MCU_MUODEL == STC8Gx)
52 #elif (PER_LIB_MCU_MUODEL == STC8Hx)
62 #ifndef PER_LIB_MCU_MUODEL
63 #define PER_LIB_MCU_MUODEL STC8Ax
68 #ifndef PER_LIB_COMP_CTRL
69 #define PER_LIB_COMP_CTRL 1
74 #ifndef PER_LIB_COMP_INIT_CTRL
75 #define PER_LIB_COMP_INIT_CTRL 1
80 #ifndef PER_LIB_COMP_NVIC_CTRL
81 #define PER_LIB_COMP_NVIC_CTRL 1
86 #ifndef PER_LIB_COMP_WORK_CTRL
87 #define PER_LIB_COMP_WORK_CTRL 1
92 #define COMP_PE_P37 0xF7
95 #define COMP_PE_P10_8Ax 0x00
96 #define COMP_PE_P11_8Ax 0x01
97 #define COMP_PE_P12_8Ax 0x02
98 #define COMP_PE_P13_8Ax 0x03
99 #define COMP_PE_P14_8Ax 0x04
100 #define COMP_PE_P15_8Ax 0x05
101 #define COMP_PE_P16_8Ax 0x06
102 #define COMP_PE_P17_8Ax 0x07
103 #define COMP_PE_P00_8Ax 0x08
104 #define COMP_PE_P01_8Ax 0x09
105 #define COMP_PE_P02_8Ax 0x0A
106 #define COMP_PE_P03_8Ax 0x0B
107 #define COMP_PE_P04_8Ax 0x0C
108 #define COMP_PE_P05_8Ax 0x0D
109 #define COMP_PE_P06_8Ax 0x0E
112 #define COMP_PE_P30_8G1K08A 0x00
113 #define COMP_PE_P31_8G1K08A 0x01
114 #define COMP_PE_P32_8G1K08A 0x02
115 #define COMP_PE_P33_8G1K08A 0x03
116 #define COMP_PE_P54_8G1K08A 0x04
117 #define COMP_PE_P55_8G1K08A 0x05
120 #define COMP_PE_P10_8G1K08_T 0x00
121 #define COMP_PE_P11_8G1K08_T 0x01
122 #define COMP_PE_P12_8G1K08_T 0x02
123 #define COMP_PE_P13_8G1K08_T 0x03
124 #define COMP_PE_P14_8G1K08_T 0x04
125 #define COMP_PE_P15_8G1K08_T 0x05
126 #define COMP_PE_P16_8G1K08_T 0x06
127 #define COMP_PE_P17_8G1K08_T 0x07
128 #define COMP_PE_P30_8G1K08_T 0x08
129 #define COMP_PE_P31_8G1K08_T 0x09
130 #define COMP_PE_P32_8G1K08_T 0x0A
131 #define COMP_PE_P33_8G1K08_T 0x0B
132 #define COMP_PE_P34_8G1K08_T 0x0C
133 #define COMP_PE_P35_8G1K08_T 0x0D
134 #define COMP_PE_P36_8G1K08_T 0x0E
137 #define COMP_PE_P10_8G2K64S2_S4 0x00
138 #define COMP_PE_P11_8G2K64S2_S4 0x01
139 #define COMP_PE_P12_8G2K64S2_S4 0x02
140 #define COMP_PE_P13_8G2K64S2_S4 0x03
141 #define COMP_PE_P14_8G2K64S2_S4 0x04
142 #define COMP_PE_P15_8G2K64S2_S4 0x05
143 #define COMP_PE_P16_8G2K64S2_S4 0x06
144 #define COMP_PE_P17_8G2K64S2_S4 0x07
145 #define COMP_PE_P00_8G2K64S2_S4 0x08
146 #define COMP_PE_P01_8G2K64S2_S4 0x09
147 #define COMP_PE_P02_8G2K64S2_S4 0x0A
148 #define COMP_PE_P03_8G2K64S2_S4 0x0B
149 #define COMP_PE_P04_8G2K64S2_S4 0x0C
150 #define COMP_PE_P05_8G2K64S2_S4 0x0D
151 #define COMP_PE_P06_8G2K64S2_S4 0x0E
154 #define COMP_PE_P10_8H1K28 0x00
155 #define COMP_PE_P11_8H1K28 0x01
156 #define COMP_PE_P12_8H1K28 0x02
157 #define COMP_PE_P13_8H1K28 0x03
158 #define COMP_PE_P14_8H1K28 0x04
159 #define COMP_PE_P15_8H1K28 0x05
160 #define COMP_PE_P16_8H1K28 0x06
161 #define COMP_PE_P17_8H1K28 0x07
162 #define COMP_PE_P00_8H1K28 0x08
163 #define COMP_PE_P01_8H1K28 0x09
164 #define COMP_PE_P02_8H1K28 0x0A
165 #define COMP_PE_P03_8H1K28 0x0B
168 #define COMP_PE_P10_8H1K08 0x00
169 #define COMP_PE_P11_8H1K08 0x01
170 #define COMP_PE_P30_8H1K08 0x08
171 #define COMP_PE_P31_8H1K08 0x09
172 #define COMP_PE_P32_8H1K08 0x0A
173 #define COMP_PE_P33_8H1K08 0x0B
174 #define COMP_PE_P34_8H1K08 0x0C
175 #define COMP_PE_P35_8H1K08 0x0D
176 #define COMP_PE_P36_8H1K08 0x0E
179 #define COMP_PE_P10_8H3K64S2_S4 0x00
180 #define COMP_PE_P11_8H3K64S2_S4 0x01
181 #define COMP_PE_P12_8H3K64S2_S4 0x02
182 #define COMP_PE_P16_8H3K64S2_S4 0x06
183 #define COMP_PE_P17_8H3K64S2_S4 0x07
184 #define COMP_PE_P00_8H3K64S2_S4 0x08
185 #define COMP_PE_P01_8H3K64S2_S4 0x09
186 #define COMP_PE_P02_8H3K64S2_S4 0x0A
187 #define COMP_PE_P03_8H3K64S2_S4 0x0B
188 #define COMP_PE_P04_8H3K64S2_S4 0x0C
189 #define COMP_PE_P05_8H3K64S2_S4 0x0D
190 #define COMP_PE_P06_8H3K64S2_S4 0x0E
193 #define COMP_PE_P10_8H8K64U_2K64T 0x00
194 #define COMP_PE_P11_8H8K64U_2K64T 0x01
195 #define COMP_PE_P54_8H8K64U_2K64T 0x02
196 #define COMP_PE_P13_8H8K64U_2K64T 0x03
197 #define COMP_PE_P14_8H8K64U_2K64T 0x04
198 #define COMP_PE_P15_8H8K64U_2K64T 0x05
199 #define COMP_PE_P16_8H8K64U_2K64T 0x06
200 #define COMP_PE_P17_8H8K64U_2K64T 0x07
201 #define COMP_PE_P00_8H8K64U_2K64T 0x08
202 #define COMP_PE_P01_8H8K64U_2K64T 0x09
203 #define COMP_PE_P02_8H8K64U_2K64T 0x0A
204 #define COMP_PE_P03_8H8K64U_2K64T 0x0B
205 #define COMP_PE_P04_8H8K64U_2K64T 0x0C
206 #define COMP_PE_P05_8H8K64U_2K64T 0x0D
207 #define COMP_PE_P06_8H8K64U_2K64T 0x0E
210 #define COMP_NE_P36 0x10
213 #define COMP_IN_REV 0x0F
270 #if (PER_LIB_COMP_CTRL == 1)
272 #if (PER_LIB_COMP_INIT_CTRL == 1)
289 #if (PER_LIB_COMP_NVIC_CTRL == 1)
307 #define NVIC_COMP_CTRL(run) do{CMPCR1 = (CMPCR1 & 0xCF)|(run << 4);}while(0)
315 #define COMP_NVIC_PRI(pri) \
317 IP2H = (IP2H & 0xEF) | ((pri & 0x02) << 3); \
318 IP2 = (IP2 & 0xEF) | ((pri & 0x01) << 4); \
324 #if (PER_LIB_COMP_WORK_CTRL == 1)
332 #define COMP_GET_FLAG() (CMPCR1 & 0x40)
340 #define COMP_CLEAR_FLAG() do{CMPCR1 &= 0xBF;}while(0)
357 #define COMP_GET_RESULT() (CMPCR1 & 0x01)
NVICPri_Type
Definition: ELL_CORE.h:99
BOOL
Definition: ELL_CORE.h:50
FSCSTATE
Definition: ELL_CORE.h:65
GPIOSWPort_Type
Definition: ELL_CORE.h:81
unsigned int uint16_t
Definition: ELL_TYPE.h:73
unsigned char uint8_t
Definition: ELL_TYPE.h:72
FSCSTATE GPIO_COMP_SWPort(GPIOSWPort_Type port)
COMP切换复用IO函数。
COMPDIRPut_Type
COMP输出方向枚举体。
Definition: STC8x_COMP.h:221
@ COMP_DIR_Forward
Definition: STC8x_COMP.h:222
@ COMP_DIR_Reverse
Definition: STC8x_COMP.h:225
FSCSTATE COMP_Init(const COMP_InitType *compx)
COMP初始化函数。
COMPTri_Type
COMP中断触发方式枚举体。
Definition: STC8x_COMP.h:236
@ COMP_Tri_Rising
Definition: STC8x_COMP.h:243
@ COMP_Tri_Null
Definition: STC8x_COMP.h:237
@ COMP_Tri_Edge
Definition: STC8x_COMP.h:246
@ COMP_Tri_Falling
Definition: STC8x_COMP.h:240
FSCSTATE NVIC_COMP_Init(NVICPri_Type pri, COMPTri_Type triMode)
COMP中断初始化函数。
COMP初始化结构体句柄,初始化时请定义该句柄,并用其地址来传参。
Definition: STC8x_COMP.h:257
BOOL Output
Definition: STC8x_COMP.h:263
BOOL AC_FTW
Definition: STC8x_COMP.h:260
uint8_t NEPin
Definition: STC8x_COMP.h:259
BOOL Run
Definition: STC8x_COMP.h:264
COMPDIRPut_Type DIRPut
Definition: STC8x_COMP.h:262
uint8_t PEPin
Definition: STC8x_COMP.h:258
uint16_t DC_FTW
Definition: STC8x_COMP.h:261