STM8L152C6 TIM1设置输出比较,定时翻转

2019-07-19 21:47发布

void main(void)
{

    GPIO_Init(GPIOD, GPIO_Pin_2, GPIO_Mode_Out_PP_High_Fast);
    CLK_PeripheralClockConfig(CLK_Peripheral_TIM1,ENABLE);
    TIM1_TimeBaseInit(0x0000, TIM1_CounterMode_Up, 0x00FF, 0x00);
    TIM1_OC1PreloadConfig(ENABLE);
    TIM1_OC1Init(TIM1_OCMode_Toggle, TIM1_OutputState_Enable, TIM1_OutputState_Enable, 0x00ff, TIM1_OCPolarity_High,      TIM1_OCPolarity_High, TIM1_OCIdleState_Set, TIM1_OCIdleState_Set);
    TIM1_Cmd(ENABLE);
    while (1)
    {
    }
}


还要怎么设置呢,为什么不出波形呢
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。