问答

汇集网友智慧,解决技术难题

qidiao

TA的家园币:58  

  • HC32L130F8UA配置PCA成PWM PB1通道3不成功

    HC32L130F8UA脚位32个PCA配置成PWM使用PA6通道0配置成功改成PB1通道3不成功?staticvoidApp_GpioInit(void){stc_gpio_cfg_tGpioInitStruct;DDL_ZERO_STRUCT(GpioInitStruct);Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio,TRUE);//PB01GpioInitStruct.enDrv=GpioDrvH;GpioInitStruct.enDir=GpioDirOut;Gpio_Init(GpioPortB,GpioPin1,&GpioInitStruct);Gpio_SetAfMode(GpioPortB,GpioPin1,GpioAf2);////这里是GpioAf2吗?}/**********************************************************************************\brief配置PCA****\return无******************************************************************************/voidApp_PcaInit(uint16_tPca_carr){App_GpioInit();stc_pcacfg_tPcaInitStruct;Sysctrl_SetPeripheralGate(SysctrlPeripheralPca,TRUE);PcaInitStruct.pca_clksrc=PcaPclkdiv2;//pclk/32PcaInitStruct.pca_cidl=FALSE;//空闲模式IDLE,PCA不停止工作PcaInitStruct.pca_ecom=PcaEcomEnable;//允许比较器功能PcaInitStruct.pca_capp=PcaCappDisable;//禁止上升沿捕获PcaInitStruct.pca_capn=PcaCapnDisable;//禁止下降沿捕获PcaInitStruct.pca_mat=PcaMatEnable;//允许匹配PcaInitStruct.pca_tog=PcaTogEnable;//允许翻转PcaInitStruct.pca_pwm=PcaPwm8bitDisable;//禁止8位pwmPcaInitStruct.pca_epwm=PcaEpwmEnable;//允许16位pwmPcaInitStruct.pca_ccap=10000;PcaInitStruct.pca_carr=Pca_carr;//占空比Pca_M3Init(&PcaInitStruct);///<PCA开始运行Pca_StartPca(TRUE);}intmain(void){...............................................................................while{1}{Pca_SetCcap(PcaModule3,per_T);//改变占空比}}各位大佬帮我看看哪里配置错了占空比不变化。