Microchip PIC24 DAC output too low

dacmicrochippic

I'm using explorer 16 evaluation with PIC24FJ256GB410 Module.
And I am trying to work with the internal DAC. My code :

ANSG = 0x00 ;            // Analog function disable
TRISGbits.TRISG9    = 0; // Dac output enable
DAC1CONbits.DACREF = 3;  // setting reference to internal 
DAC1CONbits.DACEN = 1;   // DAC Enable
DAC1CONbits.DACOE = 1;   // Dac Output Enable
DAC1DAT  = 0xFFFF;
  • Vdd = 3.3V
  • Vref+ input = 3.3V

At , both DACREF = 3(internal reference) and 1(VREF+) , I measure 1.2V at the output. And at DACREF = 1(AVDD) I measure 0V.
It is strange because :

  1. DAC suppose to multiply internal 1.2V X2.
  2. External reference also high 3.3V
  3. AVDD – I don't know what it is because there is no such input

I appreciate your help

Best Answer

Thanks for the effort. Here is the solution :

DAC pin should be set to input :

TRISGbits.TRISG9 = 1;

(probably so as not conflict with DAC output)

Actual VREF+ can be alternated between A10 and B0 in configuration. Where leg 30 is probably AVDD and not VREF+ as in datasheet.

And it works correctly. With 2.4v reference it outputs 2.4v maximum. And with VDD=3.2v, and REF=AVDD or REF=VREF+ the maximum is 3.2v. As expected.