TIM1的pwm输出没有波形?

2019-07-21 02:26发布

我感觉是库函数的问题,因为库函数没有要求给他TIM3,参数只有数据 [mw_shl_code=c,true]void TIM_BDTRStructInit(TIM_BDTRInitTypeDef* TIM_BDTRInitStruct) { /* Set the default configuration */ TIM_BDTRInitStruct->TIM_OSSRState = TIM_OSSRState_Disable; TIM_BDTRInitStruct->TIM_OSSIState = TIM_OSSIState_Disable; TIM_BDTRInitStruct->TIM_LOCKLevel = TIM_LOCKLevel_OFF; TIM_BDTRInitStruct->TIM_DeadTime = 0x00; TIM_BDTRInitStruct->TIM_Break = TIM_Break_Disable; TIM_BDTRInitStruct->TIM_BreakPolarity = TIM_BreakPolarity_Low; TIM_BDTRInitStruct->TIM_AutomaticOutput = TIM_AutomaticOutput_Disable; }[/mw_shl_code] 没有要求让我把TIM1给他,那么他如何知道我是要初始化TIM1的呢?其他部分代码应该没有问题,因为使用tim3时可以输出
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
7条回答
胡桃
2019-07-21 14:21
再贴一段别人需要传参的代码 [mw_shl_code=c,true]TIM_BDTRConfig(TIM1, &TIM_BDTRInitStructure);[/mw_shl_code] [mw_shl_code=c,true]这里是传了TIM1的[/mw_shl_code] [mw_shl_code=c,true]TIM_BDTRInitStructure.TIM_OSSRState = TIM_OSSRState_Enable; //运行模式下“关闭状态”使能 TIM_BDTRInitStructure.TIM_OSSIState = TIM_OSSIState_Enable; //关闭模式下“关闭状态”使能 TIM_BDTRInitStructure.TIM_LOCKLevel = TIM_LOCKLevel_OFF; //锁定关闭 TIM_BDTRInitStructure.TIM_DeadTime = 80; //死区时间为13.8ns TIM_BDTRInitStructure.TIM_Break = TIM_Break_Disable; //刹车功能使能 TIM_BDTRInitStructure.TIM_BreakPolarity = TIM_BreakPolarity_High; //刹车输入高电平有效 TIM_BDTRInitStructure.TIM_AutomaticOutput = TIM_AutomaticOutput_Enable; //自动输出使能 TIM_BDTRConfig(TIM1, &TIM_BDTRInitStructure);[/mw_shl_code]

一周热门 更多>