ADC to DAC
dynoport
Posts: 7
Hello,
I have an 8 bit ADC (0831) connected to a BS2 monitoring the location (steps) of the 10K Pot. I am trying to now incorperate a DAC 12 bit (AD667KN), hoping to output a scaled value of 0-10+Volts. How (or) can I connect the the AD667KN to achieve 0-10 volts? Any suggestions?
I have an 8 bit ADC (0831) connected to a BS2 monitoring the location (steps) of the 10K Pot. I am trying to now incorperate a DAC 12 bit (AD667KN), hoping to output a scaled value of 0-10+Volts. How (or) can I connect the the AD667KN to achieve 0-10 volts? Any suggestions?
Comments
I will include a link to the datasheet. Although I have backed up a few steps as I was not clear on the whole DAC things (not that I have it all down yet either). I am working through Chapter #4: Basic Digital to Analog Conversion
BUILD A RESISTIVE LADDER NETWORK using the Homework board (BS2)
After completing the analog to digital portion and the digital to analog ( 4-bit R-2R DAC). After completing the Chapter I wanted to use a potentiometer to send a signal to the ADC and then use the resistive ladder DAC to create an analog output 0-3V. At this time I have given up on the 12 bit converter (for now). Unless its easier than the R-2R-DAC ladder.
How do I setup the the bs2 to complete this task?
DAC datasheet http://pdf1.alldatasheet.com/datasheet-pdf/view/48134/AD/AD667KN.htmldatasheet.pdf
' {$STAMP BS2}
' {$PBASIC 2.5}
'[Declarations]
adcBits VAR Byte
v VAR Byte
r VAR Byte
v2 VAR Byte
v3 VAR Byte
n VAR Nib
'[Initialization]
CS PIN 0
CLK PIN 1
DataOutput PIN 2
DEBUG CLS 'Start display.
DEBUG CLS, "DAC Nibble Values", CR
DEBUG "Decimal Binary DVM", CR
' [Main Routine]
FOR n=0 TO 15
GOSUB DAC
GOSUB ADC_Data
GOSUB Calc_Volts
GOSUB Display
NEXT
STOP
'[Subroutines]
DAC:
DIRB = 15
OUTB = n
RETURN
ADC_DATA:
LOW CLK
LOW CS
PULSOUT CLK, 210
SHIFTIN DataOutput,CLK,MSBPOST,[adcBits\8]
HIGH CS
RETURN
Calc_Volts:
v=5*adcBits/255
r=5*adcBits//255
v2=100*r/255
v3=100*r//255
v3=10*v3/255
IF (v3>=5) THEN v2=v2+1
IF (v2>=100) THEN
v=v+1
v2=0
ENDIF
RETURN
Display:
DEBUG DEC2 n, " ", BIN4 n, " "
DEBUG DEC1 v, ".", DEC2 v2, " Volts", CR
IF (IN15= 1) THEN
DEBUG HOME,CR, "Decimal value to DAC: ", DEC3 n
DEBUG ",8-bit binary value,",BIN8 adcBits
DEBUG ",Decimal value,",DEC3 adcBits
DEBUG ",DVM Reading,"
DEBUG DEC1 v, ".", DEC2 v2, ",Volts!",CR
ELSE
RETURN
ENDIF
RETURN
I have now changed from a 4 bit to an 8 bit R2R ladder (see the diagram) but when I run a sweep of the 255 bits the value keeps counting to full scale way before the last bit. I changed the VAR from nib to byte, and the sweep from DIRB (P4-7) to DIRH (P8-15) using OUTH but the problem still exists. I have supplied the code that I am using. Stamp Code.txt
Can someone tell me why this code does not work to sweep through and why the voltage output of the ladder DAC repeats and does not step correctly.
Thanks
I would suggest you remove the 2k resistor and the op-amp. Then using a volt meter, measure the voltage you get at the top of the ladder as you change the input values. It should swing from 0v with 00h in to 5v with FFh in. If so, your ladder network is okay. If not, then you may have a resistor swapped somewhere along the network. Once you have that working, you could connect it directly into the ADC0831 because that is a high-impeadence input and will not load down the network.
Thanks for the help. It worked. The only thing I see is the 5V on the ADC is 3.166V on the DAC output. I assume the resistor ladder reduced the voltage?! 0V=0V The ladder steps and does not repeat a voltage earlier than step 255. The pot movement creates stable output readings on the DVM.:thumb:
Here is the code I had to use and a schematic.Stamp code2.txt
Is the buffer op amp needed to buffer the DAC output to a data logger?
If your data logger has a high impedance input, you shouldn't need the op amp buffer.
I am fairly certain about the DB0-DB11 connections to an 8 bit system but I am not sure how to setup or interpret the A0-A3 from the datasheet. La-mien's terms.
In addition to that Sum JCT and BIP Off.
The goal is to replace the R2R ladder with the DAC chip, with an output of 0-5V.
Thanks in advance for all the help.