A few questions on DAC's and Shiftout

I'm using a DAC and Arduino's shift out, but I'm having a few issues. Here's the DAC: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=LTC1446CN8%23PBF-ND

As far as I can tell it's working because I am getting voltage out of it. However, I can't seem to get the delay to work because the voltage is constant and not delaying. Here is my script:

int clockPin = 8;
int dataPin = 9;
int latchPin = 10;
int data = 250;

void setup ()
      {
            pinMode (clockPin, OUTPUT);
            pinMode (dataPin, OUTPUT);
            pinMode (latchPin, OUTPUT);
      }

void loop ()
      {
            digitalWrite (latchPin, LOW);
            shiftOut(dataPin, clockPin, MSBFIRST, data);
            digitalWrite (latchPin, HIGH);
            delay (1000);
      }

I know the code is partially working because when I change the value for my data variable it changes the voltage. Also, this is loosely based on the shiftOut tutorial here. Would something like this work better?:

int clockPin = 8;
int dataPin = 9;
int latchPin = 10;
int data = 250;

void setup ()
      {
            pinMode (clockPin, OUTPUT);
            pinMode (dataPin, OUTPUT);
            pinMode (latchPin, OUTPUT);
                digitalWrite (latchPin, LOW);
      }

void loop ()
      {
            shiftOut(dataPin, clockPin, MSBFIRST, data);
            digitalWrite (latchPin, HIGH);
                digitalWrite (latchPin, LOW);
            delay (1000);
      }

I'm thinking the first script didn't let the latch pin go low before the delay, so it was still high throughout the delay. I can't test it yet (hard at work...ya know?), but I will later. Just thought I'd get some other eyes looking at it before I tested my theroy. :slight_smile:

Im not sure what you want to do, but Im assuming there is a shiftregister in there somewhere? The delay() dont affect that in any way, the shiftregisters output will be what it was last set to, and thus constant.

Maybe this was more what you were trying?

int clockPin = 8;
int dataPin = 9;
int latchPin = 10;
int data = 250;

void setup ()
      {
            pinMode (clockPin, OUTPUT);
            pinMode (dataPin, OUTPUT);
            pinMode (latchPin, OUTPUT);
      }

void loop ()
      {
            digitalWrite (latchPin, LOW);
            shiftOut(dataPin, clockPin, MSBFIRST, data);
            digitalWrite (latchPin, HIGH);
            delay (1000);
            digitalWrite (latchPin, LOW);
            shiftOut(dataPin, clockPin, MSBFIRST, 0x00);
            digitalWrite (latchPin, HIGH);
            delay (1000);
      }

Yes, there is a shift register in the chip. I thought that when the latch pin went low it kept the shift register from sending out data.

I'm sending out analog voltage to a voltage controlled synthesizer. I would simply like the voltage to be sent, stop sending, delay 1000 and repeat. Just like the simple LED blink program, but instead of blinking an LED I want to trigger analog voltages on and off.

I think your script may work as I neglected to stop the data from being sent through the register (I'm assuming the 0x00 does that). Thank you.

I am using a TI TLV5618 which looks similar to the
DAC you are using. See the application hint
at -- Loading...

(* jcl *)


www: http://www.wiblocks.com
twitter: http://twitter.com/wiblocks
blog: http://luciani.org

I thought that when the latch pin went low it kept the shift register from sending out data.

That's usually the other way around, the latch pin locks the output to the last received data, regardless of receiving new data. Some shiftregisters might have an output enable that does what you want (usually tri-state I would think), or a reset input to clear it. I dont know about the DAC you are using.

That did the trick raron. Thanks again man.