This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

咨询28035比较器



问题1:全速运行到一个断点处比较器1、2只有比较器2输出1,而单步运行到同一个断点处,两个比较器都输出1,是什么原因?

2:为什么比较器1输出1时不触发EPwm1Regs.TZ事件,而比较器2输出1时却触发EPwm2Regs.TZ事件,代码如下(两个比较器输出都配置到EPwm2Regs.TZSEL.bit.DCxEVT1)

EPwm1Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT;     // DCAH = Comparator 1 output
    EPwm1Regs.TZDCSEL.bit.DCAEVT1 = TZ_DCAH_HI;         // DCAEVT1 = DCAH high(will become active
                                                        // as Comparator output goes high)
    EPwm1Regs.DCACTL.bit.EVT1SRCSEL = DC_EVT1;             // DCAEVT1 = DCAEVT1 (not filtered)
    EPwm1Regs.DCACTL.bit.EVT1FRCSYNCSEL = DC_EVT_ASYNC;    // Take async path

// Enable DCAEVT1 as a one-shot source
    EPwm1Regs.TZSEL.bit.DCAEVT1 = 1;

// What do we want the DCAEVT1 event to do?
    EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO;                 // EPWMxA will go low
//    EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_LO;                 // EPWMxB will go low
    EDIS;

// Comp1, DACval = Itrip1, DAC Source is DACval, Ramp Source = don't care, Slope = don't care
    DacDrvCnf(1, Itrip1, 0, 2, 0);

// Configure PWM2, Comparator2 and DAC for over current protection for channel 2
    EALLOW;    
// Define an event (DCBEVT1) based on Comparator 2 Output
    EPwm2Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP2OUT;     // DCBH = Comparator 2 output
    EPwm2Regs.TZDCSEL.bit.DCBEVT1 = TZ_DCBH_HI;         // DCBEVT1 = DCBH high(will become active
                                                        // as Comparator output goes high)
    EPwm2Regs.DCBCTL.bit.EVT1SRCSEL = DC_EVT1;             // DCBEVT1 = DCBEVT1 (not filtered)
    EPwm2Regs.DCBCTL.bit.EVT1FRCSYNCSEL = DC_EVT_ASYNC;    // Take async path

// Enable DCBEVT1 as a one-shot source
    EPwm2Regs.TZSEL.bit.DCBEVT1 = 1;

// What do we want the DCAEVT1 event to do?
    EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_LO;                 // EPWMxA will go low
//    EPwm2Regs.TZCTL.bit.TZB = TZ_FORCE_LO;                 // EPWMxB will go low
    EDIS;

// Comp2, DACval = Itrip2, DAC Source is DACval, Ramp Source = don't care, Slope = don't care
    DacDrvCnf(2, Itrip2, 0, 2, 0);