关于STM32单片机一个库函数问题求解答

什么时候需要调用SYS.H 和STM32f10x.h这两个文件 萌新求解 中文手册如果有 可以告诉我地方我自己去查

STM32f10x.h是芯片寄存器头文件,就像51单片机的reg51.H。基本上所有涉及到控制单片机的c程序都要包含。
至于SYS.H 我猜你用的是原子的库,里边就4条函数看你需要。
void WFI_SET(void); //执行WFI指令
void INTX_DISABLE(void);//关闭所有中断
void INTX_ENABLE(void); //开启所有中断
void MSR_MSP(u32 addr); //设置堆栈地址
里边还有IO口操作宏定义,如果你想像51一样操作io口就用吧。
一般情况这两个头文件都会包含。

这个好像是系统时钟里面的

可以去查查手册中的系统定时器

STM32f10x.h就是定义的一些宏定义,寄存器名称什么的,库函数的说明里面一般都有,下面是我截下的注解说明:

  • @file stm32f10x.h
  • @author MCD Application Team
  • @version V3.5.0
  • @date 11-March-2011
  • @brief CMSIS Cortex-M3 Device Peripheral Access Layer Header File.
  • This file contains all the peripheral register's definitions, bits
  • definitions and memory mapping for STM32F10x Connectivity line,
  • High density, High density value line, Medium density,
  • Medium density Value line, Low density, Low density Value line
  • and XL-density devices. *
  • The file is the unique include file that the application programmer
  • is using in the C source code, usually in main.c. This file contains:
  • - Configuration section that allows to select:
  • - The device used in the target application
  • - To use or not the peripheral’s drivers in application code(i.e.
  • code will be based on direct access to peripheral’s registers
  • rather than drivers API), this option is controlled by
  • "#define USE_STDPERIPH_DRIVER"
  • - To change few application-specific parameters such as the HSE
  • crystal frequency
  • - Data structures and the address mapping for all peripherals
  • - Peripheral's registers declarations and bits definition
  • - Macros to access peripheral’s registers hardware

你编译后在用到这两个头文件的C文件中找到.h的源文件,看这两个头文件中定义了哪些变量及声明了哪些函数,看你用到了没有,没有的话注释掉就好了,第一个应该是工程启动文件,第二个应该是用的开发库定义的文件。