32 #ifndef __STC8x_SYSCLK_H_
33 #define __STC8x_SYSCLK_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)
61 #ifndef PER_LIB_MCU_MUODEL
64 #define PER_LIB_MCU_MUODEL STC8Ax
67 #ifndef PER_LIB_SYSCLK_CTRL
70 #define PER_LIB_SYSCLK_CTRL 1
73 #ifndef PER_LIB_SYSCLK_VALUE
76 #define PER_LIB_SYSCLK_VALUE 0
80 #ifndef PER_LIB_SYSCLK_INIT_CTRL
83 #define PER_LIB_SYSCLK_INIT_CTRL 1
87 #ifndef PER_LIB_SYSCLK_WORK_CTRL
90 #define PER_LIB_SYSCLK_WORK_CTRL 1
97 #if (PER_LIB_MCU_MUODEL == STC8Ax || PER_LIB_MCU_MUODEL == STC8Fx )
99 #define SYSCLK_DIV1 0x10
100 #define SYSCLK_DIV2 0x20
101 #define SYSCLK_DIV4 0x40
102 #define SYSCLK_DIV8 0x70
103 #define SYSCLK_DIV16 0x90
104 #define SYSCLK_DIV32 0xB0
105 #define SYSCLK_DIV64 0xD0
106 #define SYSCLK_DIV128 0xF0
143 #if (PER_LIB_MCU_MUODEL == STC8Hx)
150 #if (PER_LIB_MCU_MUODEL == STC8Cx || PER_LIB_MCU_MUODEL == STC8Gx || PER_LIB_MCU_MUODEL == STC8Hx)
159 #if (PER_LIB_MCU_MUODEL == STC8Cx || PER_LIB_MCU_MUODEL == STC8Gx)
161 #elif (PER_LIB_MCU_MUODEL == STC8Hx)
162 IRC_Band_35MHz = 0x01
168 #if (PER_LIB_MCU_MUODEL == STC8Hx)
193 #if (PER_LIB_MCU_MUODEL == STC8Cx || PER_LIB_MCU_MUODEL == STC8Gx || PER_LIB_MCU_MUODEL == STC8Hx)
200 #if (PER_LIB_MCU_MUODEL == STC8Hx)
209 #if (PER_LIB_SYSCLK_CTRL == 1)
211 #if (PER_LIB_SYSCLK_INIT_CTRL == 1)
227 #if (PER_LIB_SYSCLK_WORK_CTRL == 1)
FSCSTATE
Definition: ELL_CORE.h:65
unsigned long uint32_t
Definition: ELL_TYPE.h:74
unsigned char uint8_t
Definition: ELL_TYPE.h:72
XOSCFilter_Type
外部晶振滤波频段枚举体。
Definition: STC8x_SYSCLK.h:175
@ XOSC_Filter_66MHz
Definition: STC8x_SYSCLK.h:178
@ XOSC_Filter_Null
Definition: STC8x_SYSCLK.h:179
@ XOSC_Filter_125MHz
Definition: STC8x_SYSCLK.h:177
@ XOSC_Filter_150MHz
Definition: STC8x_SYSCLK.h:176
FSCSTATE SYSCLK_Init(const SYSCLK_InitType *sysClkn)
系统时钟初始化函数。
SCLKOut_Type
系统时钟输出引脚枚举体。
Definition: STC8x_SYSCLK.h:128
@ SCLK_OUT_P16
Definition: STC8x_SYSCLK.h:130
@ SCLK_OUT_P54
Definition: STC8x_SYSCLK.h:129
LIRCTRIM_Type
IRC频率微调枚举体。
Definition: STC8x_SYSCLK.h:115
@ TRIM2
Definition: STC8x_SYSCLK.h:118
@ TRIM1
Definition: STC8x_SYSCLK.h:117
@ TRIM3
Definition: STC8x_SYSCLK.h:119
@ TRIM0
Definition: STC8x_SYSCLK.h:116
MCLKSrc_Type
系统主时钟源枚举体。
Definition: STC8x_SYSCLK.h:139
@ X32KSC
Definition: STC8x_SYSCLK.h:144
@ XOSC
Definition: STC8x_SYSCLK.h:146
@ LIRC
Definition: STC8x_SYSCLK.h:142
@ HIRC
Definition: STC8x_SYSCLK.h:141
@ AUTO
Definition: STC8x_SYSCLK.h:140
IRCBand_Type
IRC频段选择器枚举体。
Definition: STC8x_SYSCLK.h:157
@ IRC_Band_20MHz
Definition: STC8x_SYSCLK.h:158
@ IRC_Band_33MHz
Definition: STC8x_SYSCLK.h:160
uint32_t Get_SysClk_FRE(void)
获取系统时钟频率函数,用于定时器、串口、EEPROM等进行时钟计算。 这个函数只能获取内部IRC做时钟源时的系统频率,如果你使用的是外部晶振, 请在Lib_CFG....
系统时钟初始化结构体句柄,需要在函数初始化时定义它,并用其地址传参。
Definition: STC8x_SYSCLK.h:189
IRCBand_Type IRCBand
Definition: STC8x_SYSCLK.h:194
XOSCFilter_Type XOSCFilter
Definition: STC8x_SYSCLK.h:201
uint8_t SCLKDiv
Definition: STC8x_SYSCLK.h:198
uint8_t IRCTRIM
Definition: STC8x_SYSCLK.h:191
MCLKSrc_Type MCLKSrc
Definition: STC8x_SYSCLK.h:190
uint8_t MCLKDiv
Definition: STC8x_SYSCLK.h:196
LIRCTRIM_Type LIRCTRIM
Definition: STC8x_SYSCLK.h:192
SCLKOut_Type SCLKOutPin
Definition: STC8x_SYSCLK.h:199