Files
STC32G_Power_Monitor/Header/clock_init.h
2025-08-31 21:43:17 +08:00

62 lines
1.9 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __CLOCK_INIT_H__
#define __CLOCK_INIT_H__
#include "common.h"
//FOSC可选值:35000000, 33177600, 30000000, 27000000. 24000000, 22118400
// #define FOSC 0 // FOSC的值设置为0则内核频率通过寄存器强制设置为33.1776Mhz
// 不管STC-ISP软件下载时候选择多少他都是33.1776Mhz。
#define FOSC 33177600 // FOSC的值设置为33.1776Mhz,
// 使用STC-ISP软件下载的时候
// 此频率需要跟STC-ISP软件中的 <输入用户程序运行时的IRC频率>选项的频率一致。
#define EXTERNAL_CRYSTA_ENABLE 0 // 使用外部晶振0为不使用1为使用建议使用内部晶振
#define PRINTF_ENABLE 1 // printf使能0为失能1为使能
#define ENABLE_IAP 1 // 使能软件一键下载功能0为失能1为使能
#define DEBUG_UART UART_1
#define DEBUG_UART_BAUD 115200
#define DEBUG_UART_RX_PIN UART1_RX_P30
#define DEBUG_UART_TX_PIN UART1_TX_P31
#define DEBUG_UART_TIM TIM_2
#define USE_USB_CDC 1
#if (1==PRINTF_ENABLE)
#if (1==USE_USB_CDC)
#include "stc32_stc8_usb.h"
#define printf printf_hid
#else
char putchar(char c);
#endif
#endif
#define SET_P54_RESRT (RSTCFG |= 1<<4) //设置P54为复位引脚
extern int32 sys_clk;
void board_init(void);
void DisableGlobalIRQ(void);
void EnableGlobalIRQ(void);
#define T22M_ADDR CHIPID11 //22.1184MHz
#define T24M_ADDR CHIPID12 //24MHz
#define T27M_ADDR CHIPID13 //27MHz
#define T30M_ADDR CHIPID14 //30MHz
#define T33M_ADDR CHIPID15 //33.1776MHz
#define T35M_ADDR CHIPID16 //35MHz
#define T36M_ADDR CHIPID17 //36.864MHz
#define T40M_ADDR CHIPID18 //40MHz
#define T44M_ADDR CHIPID19 //44.2368MHz
#define T48M_ADDR CHIPID20 //48MHz
#define VRT6M_ADDR CHIPID21 //VRTRIM_6M
#define VRT10M_ADDR CHIPID22 //VRTRIM_10M
#define VRT27M_ADDR CHIPID23 //VRTRIM_27M
#define VRT44M_ADDR CHIPID24 //VRTRIM_44M
#endif