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)
{
}
}
还要怎么设置呢,为什么不出波形呢
|