Dear team:
My customer want RAMPSTS to load the value of RAMPMAXREF as soon as COMPSTS is set.
But the debugging phenomenon is that after COMPSTS is set to 1, RAMPSTS will keep the count value unchanged, and will not continue to count until the next PWMSYNC arrives.
Is it a configuration problem in the following code?
EALLOW; Comp1Regs.COMPCTL.bit.COMPDACEN = 1; Comp1Regs.RAMPMAXREF_SHDW = 0xfff0; Comp1Regs.RAMPDECVAL_SHDW = 0x0100; Comp1Regs.COMPCTL.bit.COMPSOURCE = 0; Comp1Regs.DACCTL.bit.DACSOURCE = 1; //PWMSYNC1 is the source sync RAMPSOURCE+1 Comp1Regs.DACCTL.bit.RAMPSOURCE = 0; Comp1Regs.DACCTL.bit.FREE_SOFT =0; // Synchronized value of comparator is passed through Comp1Regs.COMPCTL.bit.QUALSEL = 5; //0:Asynchronous version of Comparator output is passed //1:Synchronous version of Comparator output is passed Comp1Regs.COMPCTL.bit.SYNCSEL=0; Comp1Regs.COMPCTL.bit.CMPINV = 0; EDIS;
Best regards,
Green