新版的固件库V3.0以上 main等源文件中不再直接包含stm32f10x_conf.h,而是stm32f10x.h,stm32f10x.h则定义了启动设置,以及所有寄存器宏定义,此文件中需要注意的有:

1、device选择

#if !defined (STM32F10X_LD) && !defined (STM32F10X_LD_VL) && !defined (STM32F10X_MD) && !defined (STM32F10X_MD_VL) && !defined (STM32F10X_HD) && !defined (STM32F10X_HD_VL) && !defined (STM32F10X_XL) && !defined (STM32F10X_CL)

/* #define STM32F10X_LD */     /*!< STM32F10X_LD: STM32 Low density devices */

/* #define STM32F10X_LD_VL */  /*!< STM32F10X_LD_VL: STM32 Low density Value Line devices */

/* #define STM32F10X_MD */     /*!< STM32F10X_MD: STM32 Medium density devices */

#define STM32F10X_MD

/* #define STM32F10X_MD_VL */  /*!< STM32F10X_MD_VL: STM32 Medium density Value Line devices */

/* #define STM32F10X_HD */     /*!< STM32F10X_HD: STM32 High density devices */

/* #define STM32F10X_HD_VL */  /*!< STM32F10X_HD_VL: STM32 High density value line devices */

/* #define STM32F10X_XL */     /*!< STM32F10X_XL: STM32 XL-density devices */

/* #define STM32F10X_CL */     /*!< STM32F10X_CL: STM32 Connectivity line devices */

#endif

此段代码在stm32f10x.h的开始处,根据所用的器件 取消合适的注释。我常用的是stm32f103c8t6  属于Medium density Value Line devices.

2、外部时钟频率选择

#if !defined  HSE_VALUE

#ifdef STM32F10X_CL

#define HSE_VALUE    ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */

#else

#define HSE_VALUE    ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */

#endif /* STM32F10X_CL */

#endif /* HSE_VALUE */

注意STM32F10X_CL,STM32F10X_CL是stm32f105 和stm32f107 互联型的device,用到此器件外部要选用25MHz的晶体,由于前面的代买没有取消  /* #define STM32F10X_CL */     /*!< STM32F10X_CL: STM32 Connectivity line devices */的注释,所以此处默认的外部8MHz的晶体

3、外设宏定义USE_STDPERIPH_DRIVER

#if !defined  USE_STDPERIPH_DRIVER

/**

* @brief Comment the line below if you will not use the peripherals drivers.

In this case, these drivers will not be included and the application code will

be based on direct access to peripherals registers

*/

/*#define USE_STDPERIPH_DRIVER*/

#endif

如果不适用片内外设,则不要取消  /*#define USE_STDPERIPH_DRIVER*/的注释

注意stm32f10x.h文件的最后有这样的代码:

#ifdef USE_STDPERIPH_DRIVER

#include "stm32f10x_conf.h"

#endif

stm32f10x_conf.h中包含了所有外设的头文件,因此任意源文件只要包含了stm32f10x.h,就可以在源文件调用任意外设的函数。

若有外设为使用到,在stm32f10x_conf.h注释相应部分,项目编译时就不会在编译去掉的外设。

转载:http://hi.baidu.com/ancient2008/blog/item/ea0ea30d4aa59cd53bc7638c.html

stm32f10x_conf.h 与 stm32f10x.h相关推荐

  1. stm32中stm32f10x_type.h(固件3.0以前)、stm32f10x.h(固件3.0以后)、stdint.h文件的关系

    在stm32f10x的3.5固件库中stm32f10x.h有以下代码(第478行开始): /*** @}*/#include "core_cm3.h" #include " ...

  2. 详细分析stm32f10x.h

    /**这里是STM32比较重要的头文件    ***************************************************************************** ...

  3. stm32f10x.h解析

    /**这里是STM32比较重要的头文件      *************************************************************************** ...

  4. ..\USER\stm32f10x.h(428): error: #67: expected a “}“ ADC1_2_IRQn = 18, /*!<

    MDK软件编译,出现如下错误: ..\USER\stm32f10x.h(428): error: #67: expected a "}"ADC1_2_IRQn = 18, /*!& ...

  5. error in include chain(stm32f10x.h)

    用keil5,在cm3_core.h添加#include "stm32f10x.h"后,这里报错:error in include chain(stm32f10x.h).删除后就恢 ...

  6. #include Windows.h 和 Winsock2.h冲突的改进解决方案

    #include <Windows.h> #include <Winsock2.h> 上面的代码会导致重定义错误, 原因就是 Windows.h 中包含了 Winsock.h( ...

  7. Linux的目录结构和头文件相关;哪里找- sys/types.h, sys/stat.h

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/qq_29757283/article/ ...

  8. C语言stdio.h与stdlib.h的区别

    一.定位不同 1.stdlib.h是standard library标准库头文件,定位在通用工具函数. 2.stdio.h是standard input&output标准输入输出头文件,定位在 ...

  9. 最简单的基于librtmp的示例:发布H.264(H.264通过RTMP发布)

    ===================================================== 最简单的基于libRTMP的示例系列文章列表: 最简单的基于librtmp的示例:接收(RT ...

最新文章

  1. 论文,质量管理+进度管理(主质量)
  2. c语言坐标三角形判断,【C语言】判断三角形类型(示例代码)
  3. Electric device abnormal detection based on IoT and knowledge graph-学习笔记
  4. 关于gedit的编码问题
  5. datagridview 绑定list 不能刷新界面_人人都可写代码-H5零基础编程-首页界面实操06...
  6. websocket 发送图片_Netty(四)实现WebSocket
  7. Centos 7/linux 安装gcc 教程
  8. caxa明细表导入零件材质_caxa中如何使明细表风格应用到任一个图纸中
  9. mysql .idb_mysql.idb
  10. 利用akshare读取50EFF期权1
  11. 完美Zotero文件同步,Zotero+Koofr+OneDrive神器叠buff
  12. 用电脑远程给海信智能电视安装软件的办法
  13. java 检测u盘_java实现监听u盘示例分享
  14. 计算机组成原理 十套,计算机组成原理十套卷答案白中英(74页)-原创力文档...
  15. HDU-1278-逃离迷宫
  16. 如何用ps做故障艺术风格效果
  17. 金立android 7.1.1,金立K30Pro正式上市:运行安卓7.1.1系统,699元起
  18. 小傻蛋的妹妹跟随小甲鱼学习Python的第二节002
  19. Java Web项目开发灵感和知识点总结
  20. 传奇私服服务器移动玩家位置,传奇私服服务端里面哪个是玩家数据文件文件

热门文章

  1. 把一个钝角三角形分成若干个锐角三角形
  2. 【C++】类和对象-友元
  3. 忆享聚焦|软件营收76814亿、全球首款注射疫苗机器人面世……互联网一线资讯最新出炉
  4. 香港动态ip服务器有哪些优点
  5. 联想X3850 X6服务器报imm kernel loading
  6. 从主流厂商宣传语看中国CRM领域的发展
  7. 安卓开发:修改app的文字样式
  8. 直播答题APP撒币背后,这些行业可能被革命!
  9. oracle子库存转移项目转移,是什么原因呢?物料可以做子库存转移?
  10. php如何使用layui.table分页,layui实现数据表格及分页的方法