Hi,
I've been trying to drive a TLV5618 12bit serial DAC from Arduino, and the IC does not seem to be responding correctly. I attached the output pin to the analog in 0 of the Arduino and got the following results:
1100000000000000
0
1100001111101000
0
1100011111010000
483
1100111110100000
484
As you can see the DAC output is not changing in proportion to the values being passed in (the first 4 bits are control bits)
Chip Datasheet:
http://www.datasheets.org.uk/pdf/3412926.pdf
My code looks like this:
void SetVoltage(short Voltage)
{
// 1, 1, 0, 0, <D11..D0>
// MSB..LSB
// Add the 4 control bits
Voltage = Voltage | 49152;
b1 = Voltage;
b2 = Voltage >> 8;
// Drop the CS pin
digitalWrite(CS, LOW);
// Push byte1
// shift out highbyte
shiftOut(DOUT, SCLK, MSBFIRST, b2);
// shift out lowbyte
shiftOut(DOUT, SCLK, MSBFIRST, b1);
// Raise CS pin
digitalWrite(CS, HIGH);
Serial.println(b2 , BIN);
Serial.println(b1 , BIN);
}
Does anyone know what I'm doing wrong?
(Vref is as close to 2.048v as I can get it.)
Steve