void TIM2_Config(void) { CLK_PCKENR1 |= 0x20;//TIM2 CLK Enable! asm("nop"); while(!(CLK_PCKENR1 & 0x01)); TIM2_CR1 = 0x00; TIM2_PSCR = 0x00;//16/2^4 TIM2_ARRH = 0x00; TIM2_ARRL = 0xFF;// TIM2_CCR1H = 0x01; TIM2_CCR1L = 0xf4; TIM2_CCR2H = 0x1; TIM2_CCR2L = 0xf4; TIM2_CCR3H = 0x01; TIM2_CCR3L = 0xf4; TIM2_CCMR1 = 0x70; TIM2_CCMR2 = 0x70; TIM2_CCMR3 = 0x70; TIM2_CCER1 = 0x33; TIM2_CCER2 = 0x03; TIM2_IER = 0x00; TIM2_CR1 |= 0x01; //TIM2_BKR = 0xc0; }
STM8S103F3P6 输出 3路 PWM
亲测可用。
文章的脚注信息由WordPress的wp-posturl插件自动生成