void tim1_init(void)
{
CLK_PCKENR1 =0x80;
TIM1_CCER1 = 0x30; //通道1极性,有效电平为低电平
TIM1_CCMR1 = 0x70; //配置通道1 模式PWM 1
TIM1_PSCRH = 0x00;
TIM1_PSCRL = 0x00; //预分频系数 1
TIM1_ARRH = 0x00;
TIM1_ARRL = 0xff; //最大计数值
TIM1_CCR1H = 0x00;
TIM1_CCR1L = 0x06; //通道1的比较值
TIM1_BKR |= 0x80; //使能PWM输出
TIM1_CR1 = 0x01; //启动Tim1 向上计数模式
}
未输出PWM 求大神指点迷津! |