独立看门狗实验中在《iwdg.c》文件中的代码如下:求教这段代码里为什么不能少#include "stm32f10x_iwdg.h"这句。少了这句就编译报错!加上就无错无警告。但是在别的程序中又不需要添加这是为什么呢?
#include "iwdg.h"
#include "led.h"
#include "stm32f10x_iwdg.h"
void IWDG_Init(u8 prer,u16 rlr)
{
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
IWDG_SetPrescaler(prer);
IWDG_SetReload(rlr);
IWDG_ReloadCounter();
IWDG_Enable();
}
void IWDG_Feed(void)
{
IWDG_ReloadCounter();
}
求教这段代码里为什么不能少#include "stm32f10x_iwdg.h"这句。少了这句就编译报错!但是在别的程序中又不需要添加这是为什么呢?
..HARDWAREIWDGiwdg.c(17): warning: #223-D: function "IWDG_WriteAccessCmd" declared implicitly
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); //使能对寄存器IWDG_PR和IWDG_RLR的写操作
..HARDWAREIWDGiwdg.c(17): error: #20: identifier "IWDG_WriteAccess_Enable" is undefined
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); //使能对寄存器IWDG_PR和IWDG_RLR的写操作
..HARDWAREIWDGiwdg.c(19): warning: #223-D: function "IWDG_SetPrescaler" declared implicitly
IWDG_SetPrescaler(prer); //设置IWDG预分频值:设置IWDG预分频值为64
..HARDWAREIWDGiwdg.c(21): warning: #223-D: function "IWDG_SetReload" declared implicitly
IWDG_SetReload(rlr); //设置IWDG重装载值
..HARDWAREIWDGiwdg.c(23): warning: #223-D: function "IWDG_ReloadCounter" declared implicitly
IWDG_ReloadCounter(); //按照IWDG重装载寄存器的值重装载IWDG计数器
..HARDWAREIWDGiwdg.c(25): warning: #223-D: function "IWDG_Enable" declared implicitly
IWDG_Enable(); //使能IWDG
..HARDWAREIWDGiwdg.c(30): warning: #223-D: function "IWDG_ReloadCounter" declared implicitly
IWDG_ReloadCounter();
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>