新手请教!
CLK_PeripheralClockConfig(CLK_Peripheral_TIM2, ENABLE);
GPIO_Init(GPIOB,GPIO_Pin_0,GPIO_Mode_Out_PP_High_Fast);
TIM2->CCMR1 = TIM2->CCMR1 | 0x70;
TIM2->CCER1 = TIM2->CCER1 | 0x03;
TIM2->ARRH = 0;
TIM2->ARRL = 0xFF;
TIM2->CCR1H = 0;
TIM2->CCR1L = 0;
TIM2->PSCR = 0;
TIM2->CR1 =TIM2->CR1 | 0x01;
while (1)
{
unsigned char i;
for(i=0;i<128;i++)
{
TIM1->CCR1H = 0;
TIM1->CCR1L = i;
delay_10us(500);
}
for(i=128;i>0;i--)
{
TIM1->CCR1H = 0;
TIM1->CCR1L = i;
delay_10us(500);
}
}
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
怎么解决的,是用的PD4输出的还是PC5复用输出的?我用PD4输出不了,其它的PWM都可以输出,我要崩溃了
TIM2_BKR |=(1<<MOE)
一周热门 更多>