stm8s_tim1.c中的子函数无法调用

2019-07-19 21:05发布

配置TIM1中的PWM模式时,stm8s_tim1.c中配置寄存器的子函数无法调用,先声明,我已经加了stm8s_lib.h文件,并且 stm8s_conf.h文件也定义了TIM1,但是结果如题!求大神解答!//---------------stm8s_lib.h文件------------------
#ifdef _TIM1
#include "stm8s_tim1.h"
#endif /* _TIM1 */

#ifdef _TIM2
#include "stm8s_tim2.h"
#endif /* _TIM2 */

//---------------stm8s_conf.h文件------------------
/*** TIMERs *******************************************************************/
#define _TIM1 (1)
#define _TIM2 (1)
#define _TIM3 (1)
#define _TIM4 (1)


//---------------drvTimer.h文件------------------
#include "stm8s_lib.h"
#include "system_function.h"
//#include "stm8s_tim1.c"
//----- Initialization for TIM1 and Its PWM
void InitTim1()
{
        TIM1_DeInit();
       
        //----- Configure TIM1->EGR |= 0x01;        重新初始化TIM1
        TIM1_GenerateEvent(TIM1_EVENTSOURCE_UPDATE);
        //----- Configure TIM1->CR1
        TIM1_ARRPreloadConfig( DISABLE );                                                                                        //Configure TIM1->CR1[7]:自动重新加载允许位
        TIM1_CounterModeConfig( TIM1_COUNTERMODE_UP );                                //Configure TIM1->CR1[6:4]:边沿对齐的向上计数
        TIM1_SelectOnePulseMode( TIM1_OPMODE_REPETITIVE );                //Configure TIM1->CR1[3]:单脉冲模式计数器不停止
        TIM1_UpdateRequestConfig( TIM2_UPDATESOURCE_GLOBAL );        //Configure TIM1->CR1[2]:更新请求源
        TIM1_UpdateDisableConfig( DISABLE );                                                                        //Configure TIM1->CR1[1]:允许更新
        //----- Configure CNTH CNTL
        TIM1_SetCounter(0x0000);
        //----- Configure PWM Freq: (100kHz = 16M/160,10us)
        TIM1_TimeBaseInit(TIM2_PRESCALER_1,TIM1_COUNTERMODE_UP,TIM1_PWM_DIV,0x00);
        //----- Configure TIM1->CCER2[1,0], TIM1->CCMR3, TIM1->OISR, TIM1->CCR3H/LWM Duty: 95%
        TIM1_OC3Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE, TIM1_OUTPUTNSTATE_DISABLE, TIM1_PWM_DUTY_UPLIMIT,
                                                        TIM1_OCPOLARITY_HIGH, TIM1_OCNPOLARITY_LOW, TIM1_OCIDLESTATE_RESET, TIM1_OCNIDLESTATE_RESET);
       
        //----- Configure TIM1->DTR, TIM1->BKR
        TIM1_BDTRConfig(TIM1_OSSISTATE_DISABLE, TIM1_LOCKLEVEL_OFF, 0x00, TIM1_BREAK_DISABLE,TIM1_BREAKPOLARITY_LOW,
                  TIM1_AUTOMATICOUTPUT_DISABLE);
       
        TIM1_ITConfig( TIM1_IT_CC3, ENABLE);
  TIM1_Cmd(ENABLE);
}




提示的错误:
Running Linker
clnk -l"C:Program FilesCOSMICCXSTM8_EVALLib"  -o Debug x.sm8 -mDebug x.map Debug x.lkf
#error clnk Debug x.lkf:1 symbol _TIM1_SetCounter not defined (Debugdrvtimer.o )
#error clnk Debug x.lkf:1 symbol _TIM1_GenerateEvent not defined (Debugdrvtimer.o )
#error clnk Debug x.lkf:1 symbol _TIM1_SelectOnePulseMode not defined (Debugdrvtimer.o )
#error clnk Debug x.lkf:1 symbol _TIM1_Cmd not defined (Debugdrvtimer.o )
#error clnk Debug x.lkf:1 symbol _TIM1_DeInit not defined (Debugdrvtimer.o )
#error clnk Debug x.lkf:1 symbol _TIM1_OC3Init not defined (Debugdrvtimer.o )


友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。