tim1的pwm无输出,求助
1个回答
展开全部
//用固件库方便些#include "stm8s_lib.h"#define CCR1_Val ((u16)2047) #define CCR2_Val ((u16)1535) #define CCR3_Val ((u16)1023) #define CCR4_Val ((u16)511) void main(void) { /* TIM1 Peripheral Configuration */ TIM1_DeInit(); /* Time Base configuration */ /* TIM1_Period = 4095 TIM1_Prescaler = 0 TIM1_CounterMode = TIM1_COUNTERMODE_UP TIM1_RepetitionCounter = 0 */ TIM1_TimeBaseInit(0, TIM1_COUNTERMODE_UP, 4095, 0); /* Channel 1, 2,3 and 4 Configuration in PWM mode */ /* TIM1_OCMode = TIM1_OCMODE_PWM2 TIM1_OutputState = TIM1_OUTPUTSTATE_ENABLE TIM1_OutputNState = TIM1_OUTPUTNSTATE_ENABLE TIM1_Pulse = CCR1_Val TIM1_OCPolarity = TIM1_OCPOLARITY_LOW TIM1_OCNPolarity = TIM1_OCNPOLARITY_HIGH TIM1_OCIdleState = TIM1_OCIDLESTATE_SET TIM1_OCNIdleState = TIM1_OCIDLESTATE_RESET */ TIM1_OC1Init(TIM1_OCMODE_PWM2, TIM1_OUTPUTSTATE_ENABLE, TIM1_OUTPUTNSTATE_ENABLE, CCR1_Val, TIM1_OCPOLARITY_LOW, TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_S...
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
意法半导体(中国)投资有限公司
2023-06-12 广告
2023-06-12 广告
STM32是一款广泛应用于消费类电子、汽车、工业和物联网领域的低功耗嵌入式系统芯片。ST公司推出了多个STM32系列,以满足不同应用需求。以下是ST公司主要的STM32系列:1. STM32WB系列:这是ST公司推出的第一款支持2.4GHz...
点击进入详情页
本回答由意法半导体(中国)投资有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询