-
关于HCF32460的PWM问题
请教一下各位,关于小华MCU,timerA的PWM输出,使用IO口为PC15,配置功能如下:但是目前从示博器来看输出波形一直保持不变,但是从打印来看,定时器是已经启动开始计数了。voidtimer_init(uint16_tCompareValue){/*MCUPeripheralregisterswriteunprotected.*/LL_PERIPH_WE(LL_PERIPH_GPIO|LL_PERIPH_FCG|LL_PERIPH_PWC_CLK_RMU);stc_tmra_init_tstcTmraInit;stc_tmra_pwm_init_tstcPwmInit;/************************gpioconfig***************************/stc_gpio_init_tstcGpioInit;(void)GPIO_StructInit(&stcGpioInit);stcGpioInit.u16PinDir=PIN_DIR_OUT;stcGpioInit.u16PinOutputType=PIN_OUT_TYPE_CMOS;//CMOS正常输出(void)GPIO_Init(ENCODER_OUT_PORT,ENCODER_OUT_PIN,&stcGpioInit);/*1.EnableTimerAperipheralclock.*/FCG_Fcg2PeriphClockCmd(FCG2_PERIPH_TMRA_4,ENABLE);/*2.SetadefaultinitializationvalueforstcTmraInit.*/(void)TMRA_StructInit(&stcTmraInit);/*3.Modifiestheinitializationvaluesdependsontheapplication.*/stcTmraInit.sw_count.u16CountMode=TMRA_MD_SAWTOOTH;//锯齿波计数模式stcTmraInit.sw_count.u16CountDir=TMRA_DIR_UP;//向上计数stcTmraInit.u32PeriodValue=10000U-1U;//自动重装载值(void)TMRA_Init(CM_TMRA_4,&stcTmraInit);/*4.Setthecomparisonreferencevalue.*/(void)TMRA_PWM_StructInit(&stcPwmInit);stcPwmInit.u32CompareValue=5000U-1;//20/4050%占空比GPIO_SetFunc(ENCODER_OUT_PORT,ENCODER_OUT_PIN,GPIO_FUNC_4);(void)TMRA_PWM_Init(CM_TMRA_4,TMRA_CH6,&stcPwmInit);TMRA_PWM_OutputCmd(CM_TMRA_4,TMRA_CH6,ENABLE);/*(void)TMRA_PWM_StructInit(&stcPwmInit);stcPwmInit.u32CompareValue=20U-1;//20/4050%占空比GPIO_SetFunc(ENCODER_IN_PORT,ENCODER_IN_PIN,GPIO_FUNC_4);(void)TMRA_PWM_Init(CM_TMRA_4,TMRA_CH5,&stcPwmInit);TMRA_PWM_OutputCmd(CM_TMRA
2024-07-01 2