new code without all the noisy comment
with both outputs driven , from fvr buff2 @2.048v [1.024v got weird results]
the unmentioned feature in data sheet is that out2 is complement of out1 and the gain seems a bit different
ps blue trace is dacout1
Code:
#CONFIG ; 16F1705
__config _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _BOREN_ON & _CLKOUTEN_OFF
__config _CONFIG2, _WRT_OFF & _PPS1WAY_OFF & _ZCDDIS_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LPBOR_OFF & _LVP_OFF
#ENDCONFIG
a var byte ' Loop counter.
b var byte[8]
DEFINE OSC 4 ' Adjust to suit design.
OSCCON = $68 ' Internal 4MHz osc.
ANSELA = 0
ANSELC = 0
FVRCON = %10001000 ' Enabled, Vref 2.048V.
DAC1CON0 = %10111000 ' Vref from FVRb2, DAC1out2 (RA2). DAC1out1 (RA0).
TRISA = 0
b[0]=128
b[1]=192
b[2]=255
b[3]=192
b[4]=128
b[5]=40
b[6]=0
b[7]=40
First:
a=7
while a
DAC1CON1 = b[a]
pause 5 ' Let the DMM settle.
a=a-1
wend
goto first
end
Bookmarks