您好,
配置28069的PWM为UPDOWN模式,预设值9000,比较值4500,但实测PWM占空比为25%,请专家帮忙看看哪里设置得不对?
=============================================
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;// TB_COUNT_UP;
EPwm1Regs.TBPRD = 9000;
EPwm1Regs.CMPA.half.CMPA = 4500; // Fix duty at 50%
EPwm1Regs.TBPHS.all = 0;
EPwm1Regs.TBCTR = 0;
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE;
EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_DISABLE;//TB_CTR_ZERO; //used to sync EPWM(n+1) "down-stream"
EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1;
EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1;
EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;
EPwm1Regs.AQCTLA.bit.ZRO = AQ_SET;
EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR;
EPwm1Regs.DBCTL.bit.IN_MODE = DBA_ALL;
EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE;
EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; // Active Hi Complimentary
// Dead time setting
EPwm1Regs.DBRED = 360;//12; // dummy value for now
EPwm1Regs.DBFED = 360;//12; // dummy value for now
//TZ
EPwm1Regs.TZFRC.bit.OST = 1;
EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO ; // EPWMxA will go low
EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_LO ; // EPWMxB will go low
EPwm1Regs.ETSEL.bit.INTSEL = ET_CTR_PRD;// ET_CTR_ZERO; //ET_CTR_ZERO;ET_CTR_PRD //触发CLA1的ADC任务
EPwm1Regs.ETSEL.bit.INTEN = 1; //使能中断
EPwm1Regs.ETPS.bit.INTPRD = ET_1ST; // Generate INT on 1st event