Tool/software: Code Composer Studio
how can i use the ramp generator in cmpss to work instead of the dacvala register?
is there a way such that i can use the digital filter in cmpss code for the giving the ramp generation
in the pre-existing code for cmpss digital filter -
void InitCMPSS(void)
{
EALLOW;
//
//Enable CMPSS
//
Cmpss1Regs.COMPCTL.bit.COMPDACE = 1;
//
//NEG signal comes from DAC
//
Cmpss1Regs.COMPCTL.bit.COMPHSOURCE = NEGIN_DAC;
//
//Use VDDA as the reference for DAC
//
Cmpss1Regs.COMPDACCTL.bit.SELREF = REFERENCE_VDDA;
//
//Set DAC to midpoint for arbitrary reference
//
Cmpss1Regs.DACHVALS.bit.DACVAL = 2048;
//
// Configure Digital Filter
//Maximum CLKPRESCALE value provides the most time between samples
//
Cmpss1Regs.CTRIPHFILCLKCTL.bit.CLKPRESCALE = 0x3FF;
//
//Maximum SAMPWIN value provides largest number of samples
//
Cmpss1Regs.CTRIPHFILCTL.bit.SAMPWIN = 0x1F;
//
//Maximum THRESH value requires static value for entire window
// THRESH should be GREATER than half of SAMPWIN
//
Cmpss1Regs.CTRIPHFILCTL.bit.THRESH = 0x1F;
//
//Reset filter logic & start filtering
//
Cmpss1Regs.CTRIPHFILCTL.bit.FILINIT = 1;
//
// Configure CTRIPOUT path
// Digital filter output feeds CTRIPH and CTRIPOUTH
//
Cmpss1Regs.COMPCTL.bit.CTRIPHSEL = CTRIP_FILTER;
Cmpss1Regs.COMPCTL.bit.CTRIPOUTHSEL = CTRIP_FILTER;
//
// Configure CTRIPOUTH output pin
//Configure OUTPUTXBAR3 to be CTRIPOUT1H
//
OutputXbarRegs.OUTPUT3MUX0TO15CFG.all &= ~((Uint32)1);
//
//Enable OUTPUTXBAR3 Mux for Output
//
OutputXbarRegs.OUTPUT3MUXENABLE.all |= (Uint32)1;
EDIS;
}
c
there is no inclusion of any code for choosing the the source of compH_n from dac or ramp generator
COMPDACCTL.bit.DACSOURCE = 1; //for selecting the ramp generator as a source