Hi Nishant, The comparator module has it's own 8-bit DAC, this DAC can use the VREF+ node as its reference source. If using SysConfig: Under the VREF Module Basic Configuration: Mode: External VREF+/VREF- Configuration: VREF+ Enabled, VREF- enabled (disabled will also work if you want to use MCU ground instead) External Voltage: Set this value to what you're external reference is (3.3V in your case) This value will get propagated to your DAC module In the COMP module under Basic Configuration -> Reference Voltage Generation Configuration set: Reference source: "VREF selected as the reference source to DAC and DAC output applied as reference to comparator" Terminal: Reference Applied to positive terminal Negative terminal can also be used DAC Control: DACSW bit controls selection between DACCODE0 and DACCODE1 DAC Input: DACCODE0 selected as input for 8-bit COMP when DACCTL bit is 1 Input Code through DACCODE0: Hex value associated with the voltage you want 0xFF is max so if you have a 2.8V reference then 0xFF will output 2.8V. The DAC12 module is completely separate module and can be input into the positive terminal of the comparators. This is helpful if needing that extra resolution. For the example, were you looking at the comp_hs_dac_vref_external example? To me it looks like the wrong VREF setting is getting chosen in SysConfig, you would need to make the change that I listed under the VREF Module Basic Configuration. The .c code is correct though. Regards, Luke
↧