MicroChip Sample Code setting Current to a CMPDAC, DAC threshold which expect an voltage
- by jason hong
Sorry, the MicroChip Forum is very slow,I prefer to use overflow site to ask questions.
dsPIC33FJ06GS101/X02 and dsPIC33FJ16GSX02/X04 device
Sample Code
// configure comparator2
CMPCON2bits.CMPON = 1; // enable comparator
CMPCON2bits.INSEL = 1; // select CMP2B input pin (RB0)
CMPCON2bits.RANGE = 1; // select high range, max DAC value = Avdd/2
//CMPDACx: COMPARATOR DAC CONTROL REGISTER
//CMREF<9:0>: Comparator Reference Voltage Select bits
CMPDAC2 = CURR_HWLIM; // DAC threshold
#define CURR_HWLIM 1023 // 1023 // 10.15 * 101A
MicroChip Sample code setting CURR_HWLIM which 1023A to COMPDAC2 which expects voltage
I think that's mistake.