STM32查看系統(tǒng)時(shí)鐘
函數(shù)原形void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks)
本文引用地址:http://butianyuan.cn/article/201611/317496.htmRCC_ClocksTypeDef定義于文件“stm32f10x_rcc.h”:
typedef struct
{
uint32_t SYSCLK_Frequency; /*!< SYSCLK clock frequency expressed in Hz */
uint32_t HCLK_Frequency; /*!< HCLK clock frequency expressed in Hz */
uint32_t PCLK1_Frequency; /*!< PCLK1 clock frequency expressed in Hz */
uint32_t PCLK2_Frequency; /*!< PCLK2 clock frequency expressed in Hz */
}RCC_ClocksTypeDef;
例:
/* Get the frequencies of different on chip clocks */
RCC_ClocksTypeDef RCC_Clocks;
RCC_GetClocksFreq(&RCC_Clocks);
執(zhí)行完后,直接查看RCC_Clocks,在各成員中取出所需要時(shí)鐘頻率就行了。
評(píng)論