stm8s003 tim1 pwm输出求助
1个回答
2017-08-17
展开全部
void TIM1_PWM_OC_init (void) //TIM1_CH3 1KHz 50% duty
{
TIM1_IER = 0x00;
TIM1_EGR = 0x01;
TIM1_PSCRH = 0x00;
TIM1_PSCRL = 0x00;
TIM1_CCMR3 |= 0x60;
TIM1_CCER2 |= 0x03;
TIM1_ARRH = 0x3e;
TIM1_ARRL = 0x80;
TIM1_CCR3H = 0x1f;
TIM1_CCR3L = 0x40;
TIM1_CNTRH = 0x00;
TIM1_CNTRL = 0x00;
TIM1_BKR |= 0x80;
TIM1_CR1 |= 0x80;
TIM1_CR1 |= 0x01;
}
{
TIM1_IER = 0x00;
TIM1_EGR = 0x01;
TIM1_PSCRH = 0x00;
TIM1_PSCRL = 0x00;
TIM1_CCMR3 |= 0x60;
TIM1_CCER2 |= 0x03;
TIM1_ARRH = 0x3e;
TIM1_ARRL = 0x80;
TIM1_CCR3H = 0x1f;
TIM1_CCR3L = 0x40;
TIM1_CNTRH = 0x00;
TIM1_CNTRL = 0x00;
TIM1_BKR |= 0x80;
TIM1_CR1 |= 0x80;
TIM1_CR1 |= 0x01;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询