芯片是stm8s105 下面是我的配置但是通道1没有输出哪位大侠帮我分析一下,最好贴一个能用的tim1的pwm输出寄存器程序,谢谢!
! TIM1->CCMR1 = TIM1->CCMR1 | 0x70; // Output mode PWM2.
TIM1->CCER1 = TIM1->CCER1 | 0x03; // CC polarity low,enable PWM output
TIM1->CCMR1 |= 0x08; //输出比较1预装载使能
TIM1->ARRH = 0x07; // 自动重载寄存器ARR=0x03e8=1000
TIM1->ARRL = 0xd0; // 每记数500次产生一次中断,即1000ms
TIM1->CCR1H = 0x03;
TIM1->CCR1L = 0xe8;
TIM1->
SCRH = 0x00;
TIM1->
SCRL = 0x03;
TIM1->CR1 |= 0x01;
一周热门 更多>