STM32F10X_XX宏定义的选择

//=====================================================================
//TITLE:
//    STM32F10X_XX宏定义的选择
//AUTHOR:
//    norains
//DATE:
//    Tuesday  12-October-2010
//Environment:
//    KEIL MDK 4.0
//    RedCow Board
//=====================================================================

 

     如果你使用stm32f10x_stdperiph_lib,会发现在stm32f10x.h文件会有一段关于宏选择的代码,如:

#if !defined (STM32F10X_LD) && !defined (STM32F10X_MD) && !defined (STM32F10X_HD) && !defined (STM32F10X_CL) /* #define STM32F10X_LD */ /*!< STM32F10X_LD: STM32 Low density devices */ /* #define STM32F10X_MD */ /*!< STM32F10X_MD: STM32 Medium density devices */ /* #define STM32F10X_HD */ /*!< STM32F10X_HD: STM32 High density devices */ #define STM32F10X_CL /*!< STM32F10X_CL: STM32 Connectivity line devices */ #endif

 

    至于要使用哪个宏,则需要根据具体的芯片来进行选择。那么,这些宏又对应着哪些具体的芯片呢?其实我们可以在《Reference manual》的第九章中找到答案,如文档截图:


 

    这段话的意思很明显,如果是STM32F105xx和STM32F107xx,是Connectivity Line Devices,则宏定义选择的是STM32F10X_CL;如果是别的型号,则根据FLASH的容量来进行选择。可能文字写的有点不太清楚,还是以表格来说明:

MCU 型号

FLASH大小

STM32F10X_LD

STM32F101xx

STM32F102xx

STM32F103xx

16 ~ 32 Kbytes

STM32F10X_MD

STM32F101xx

STM32F102xx

STM32F103xx

64 ~ 128 Kbytes

STM32F10X_HD

STM32F101xx

STM32F103xx

256 ~ 512 Kbytes

STM32F10X_CL

STM32F105xx

STM32F107xx

忽略

    这些参数,和MDK的设备参数一致,如图所示:
 

你可能感兴趣的:(STM32F)