TIM10 CH1,映射到PB3,無(wú)法輸出波形。

void TIM10_PWMOut_Init( u16 arr, u16 psc, u16 ccp )

{

? ? GPIO_InitTypeDef GPIO_InitStructure={0};

? ? TIM_OCInitTypeDef TIM_OCInitStructure={0};

? ? TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure={0};


? ? RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB, ENABLE );


? ? ?GPIO_PinRemapConfig(GPIO_PartialRemap_TIM10,ENABLE);

? ? RCC_APB2PeriphClockCmd( RCC_APB2Periph_TIM10, ENABLE );

? ? GPIO_PinRemapConfig(GPIO_PartialRemap_TIM10,ENABLE);

? ?

? ?

? ? GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;

? ? GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

? ? GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

? ? GPIO_Init( GPIOB, &GPIO_InitStructure );


? ? TIM_TimeBaseInitStructure.TIM_Period = arr;

? ? TIM_TimeBaseInitStructure.TIM_Prescaler = psc;

? ? TIM_TimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;

? ? TIM_TimeBaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;

? ? TIM_TimeBaseInit( TIM10, &TIM_TimeBaseInitStructure);


? ? TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2;



? ? TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;

? ? TIM_OCInitStructure.TIM_Pulse = ccp;

? ? TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;

? ? TIM_OC1Init( TIM10, &TIM_OCInitStructure );


? ? TIM_CtrlPWMOutputs(TIM10, ENABLE );


? ? TIM_OC1PreloadConfig( TIM10, TIM_OCPreload_Disable );


? ? TIM_ARRPreloadConfig( TIM10, ENABLE );

? ? TIM_Cmd( TIM10, ENABLE );

}

煩請(qǐng)F(tuán)AE看下上述初始化哪里有問(wèn)題。無(wú)法輸出波形


熱門產(chǎn)品 : USB3.0 HUB控制器:CH634

您好,注意程序中要開(kāi)啟復(fù)用時(shí)鐘


只有登錄才能回復(fù),可以選擇微信賬號(hào)登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频