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.

HIGH AND LOW COMPARATORS

Hi,

I'm working with F2807x Piccolo device.

I would like to configure two comparator output in three possible configurations; I write this code:

Cmpss1Regs.COMPDACCTL.bit.SELREF = 0;

Cmpss1Regs.COMPCTL.bit.CTRIPHSEL = 0;

Cmpss1Regs.COMPCTL.bit.CTRIPOUTHSEL = 0;

Cmpss1Regs.COMPCTL.bit.COMPHSOURCE = 0;

Cmpss1Regs.COMPCTL.bit.CTRIPLSEL = 0;

Cmpss1Regs.COMPCTL.bit.CTRIPOUTLSEL = 0;

Cmpss1Regs.COMPCTL.bit.COMPLSOURCE = 0;

Cmpss1Regs.DACHVALS.bit.DACVAL = n_max;

Cmpss1Regs.DACLVALS.bit.DACVAL = n_min;

Cmpss1Regs.COMPCTL.bit.COMPLINV = 0;

Cmpss1Regs.COMPCTL.bit.COMPHINV = 0;

Cmpss1Regs.COMPCTL.bit.COMPDACE = 1;

n_max value is Greater than n_min value and I want to create three working areas:

1 - comparator input < n_max value and comparator input < n_min value - > Cmpss1Regs.COMPSTS.bit.COMPHSTS = 0 and Cmpss1Regs.COMPSTS.bit.COMPLSTS = 0

2 - comparator input < n_max value and comparator input > n_min value - > Cmpss1Regs.COMPSTS.bit.COMPHSTS = 0 and Cmpss1Regs.COMPSTS.bit.COMPLSTS = 1

3 - comparator input > n_max value and comparator input > n_min value - > Cmpss1Regs.COMPSTS.bit.COMPHSTS = 1 and Cmpss1Regs.COMPSTS.bit.COMPLSTS = 1

Is previous code correct?