Datasheet
2009-2016 Microchip Technology Inc. DS40001365F-page 233
PIC18(L)F1XK22
21.0 DIGITAL-TO-ANALOG
CONVERTER (DAC) MODULE
The Digital-to-Analog Converter supplies a variable
voltage reference, ratiometric with the input source,
with 32 selectable output levels.
The input of the DAC can be connected to:
•External V
REF pins
•VDD supply voltage
• FVR (Fixed Voltage Reference)
The output of the DAC can be configured to supply a
reference voltage to the following:
• Comparator positive input
• ADC input channel
• DAC1OUT pin
The Digital-to-Analog Converter (DAC) can be enabled
by setting the D1EN bit of the VREFCON1 register.
21.1 Output Voltage Selection
The DAC has 32 voltage level ranges. The 32 levels
are set with the DAC1R<4:0> bits of the VREFCON2
register.
The DAC output voltage is determined by the following
equations:
EQUATION 21-1: DAC OUTPUT VOLTAGE
21.2 Ratiometric Output Level
The DAC output value is derived using a resistor ladder
with each end of the ladder tied to a positive and
negative voltage reference input source. If the voltage
of either input source fluctuates, a similar fluctuation will
result in the DAC output value.
The value of the individual resistors within the ladder
can be found in Section 26.0 “Electrical
Specifications”.
21.3 Low-Power Voltage State
In order for the DAC module to consume the least
amount of power, one of the two voltage reference input
sources to the resistor ladder must be disconnected.
Either the positive voltage source, (V
SRC+), or the
negative voltage source, (V
SRC-) can be disabled.
The negative voltage source is disabled by setting the
D1LPS bit in the VREFCON1 register. Clearing the
D1LPS bit in the VREFCON1 register disables the
positive voltage source.
21.4 Output Clamped to Positive
Voltage Source
The DAC output voltage can be set to VSRC+ with the
least amount of power consumption by performing the
following:
• Clearing the D1EN bit in the VREFCON1 register.
• Setting the D1LPS bit in the VREFCON1 register.
• Configuring the D1PSS bits to the proper positive
source.
• Configuring the DAC1Rx bits to ‘11111’ in the
VREFCON2 register.
This is also the method used to output the voltage level
from the FVR to an output pin. See Section 21.6 “DAC
Voltage Reference Output” for more information.
21.5 Output Clamped to Negative
Voltage Source
The DAC output voltage can be set to VSRC- with the
least amount of power consumption by performing the
following:
• Clearing the D1EN bit in the VREFCON1 register.
• Clearing the DAC1R bit in the VREFCON1 register.
• Configuring the D1PSS bits to the proper negative
source.
• Configuring the DAC1Rx bits to ‘00000’ in the
VREFCON2 register.
This allows the comparator to detect a zero-crossing
while not consuming additional current through the DAC
module.
21.6 DAC Voltage Reference Output
The DAC can be output to the DAC1OUT (CVREF) pin by
setting the DAC1OE bit of the VREFCON1 register to ‘1’.
Selecting the DAC reference voltage for output on the
DAC1OUT pin automatically overrides the digital output
buffer and digital input threshold detector functions of
that pin. Reading the DAC1OUT pin when it has been
configured for DAC reference voltage output will always
return a ‘0’.
Due to the limited current drive capability, a buffer must
be used on the DAC voltage reference output for
external connections to DAC1OUT. Figure 21-2 shows
an example buffering technique.
VOUT VSRC+VSRC-–
DACR<4:0>
2
5
-------------------------------
=
+ V
SRC-
V
SRC+ = VDD, VREF+ or FVR1
V
SRC- = VSS or VREF-