Hello!
I have a PWM where the pulse width is controlled by a comparator. TZCTL[TZA] forces low and TZCTL[TZB] forces high. The dead band is generated by an external circuit.
In case of an error (ADC value, etc.) I want to disable the PWM with a Trip Zone one shot event. Is is is sufficient to configure TZCTL just before the OST Event, or is there some timing restrictions. Will the below code work?
Is there another elegant way to disable the PWM?
-Thomas
// start PWM
EALLOW;
EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO;
EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_HI;
EPwm1Regs.TZCLR.bit.OST = 1;
EDIS;
// Stop PWM
EALLOW;
EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO;
EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_LO;
EPwm1Regs.TZFRC.bit.OST = 1;
EDIS;