18F26K22 DAC5bits level output

Status
Not open for further replies.

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,469
Helped
298
Reputation
596
Reaction score
286
Trophy points
1,363
Location
France 01800
paulfjujo.free.fr
Activity points
10,639
hello,

I am working on a PIC18F46K22 with the DAC 5 bits for DDS signal generation .(sinus,triangle,carre..)
RA2 is dedicated for the DAC output. ... it's works fine !

Code:
void Config_DAC(void)
{
// init DAC 5bits output
VREFCON0=0x00;VREFCON0bits.FVREN=1;       // valid Fixed REF. Voltage
VREFCON0bits.FVRS1=1;       // Voltage ref= 4.096V
VREFCON0bits.FVRS0=1;
Tempo(1000L);
VREFCON1bits.DACEN=1 ;      // valide DAC
VREFCON1bits.DACLPS=0;      // sortie a 0 en mode Low Power
VREFCON1bits.DACOE=1;       // sortie DAC sur PIN
VREFCON1bits.DACPSS1=1;     // DAC positive source is FVR Buff1 output
VREFCON1bits.DACPSS0=0;
VREFCON1bits.DACPSS0=0;
VREFCON1bits.DACNSS=0;      // DAC Negative source is 0V (=VSS)
VSSVREFCON2=0x00;              // output level=0}

But i wand to add an offset to the DAC output, by adding a litle level as +0,2V via the pin -REF...
In DAC configuration we can choose
Maximum reference as +VDD , or 4,096V or 2,048V or 1,024V
and for mimimum reference VSS or -REF ..(with VREFCON1bits.DACNSS=1
for DAC voltage output
as we can see on the datasheet drawing.

or if i look on I/O configuration list, i see RA2 is also -REF ???
what is wrong..
it seems -REF can be used , only with ADC , not with DAC ?
am i wrong somewhere ?
Is it possible to use other minimum reference as VSS for the DAC ?
if yes, and How can we do it ?
 

Attachments

  • Dac5bit_Config.jpg
    121.3 KB · Views: 58

Is it possible to use other minimum reference as VSS for the DAC ?
No. There are other ways to add an offset that are suffciently accurate for a 5-bit DAC, e.g. voltage dividers.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…