View Full Version : Interfacing with an LTC1451

01-15-2009, 05:02 AM
Ok, I am trying to interface with the LTC1451 12 bit DAC. I am using a modified version of the AD8803 code from the OBEX.

The only code that was changed was the demo code, AD8803_Demo, to cycle from values of 0 to 4096, and the AD8803.spin code, where I have replaced the bit size with 12 instead of 8. I have also removed the DACaddress variable, since the LTC1451 is a single DAC, not an octal.

Here is a copy of the Demo code, and below that is the modified AD8803.spin code:


_XINFREQ = 5_000_000

CS = 3
SDI = 2
CLK = 1

DAC: "LT1451"

byte DACaddress,DACvalue

PUB Demo | x

repeat x from 1 to 4096
DACvalue := x


dira[CS] := 1 'Make CS pin an output
dira[SDI] := 1 'Make SDI pin an output
dira[CLK] := 1 'Make CLK pin an output

outa[CS] := 0 'Bring CS low
outa[CLK] := 0 'Bring CLK low ; load AD8803 data

SendData(SDI,CLK,12,DACvalue) 'Select Value

outa[CS] := 1 'Bring CS high ; latch AD8803 data

PRI SendData(SDI,CLK,Bits,Data)|temp 'Send DATA MSB first

temp := 1 << ( Bits - 1 )
repeat Bits
outa[SDI] := (Data & temp)/temp 'Set bit value
outa[CLK] := 1 'Clock bit
outa[CLK] := 0 'Clock bit
temp := temp / 2

I connected a scope to the CLK, CS, and SDI inputs, and noted that the Prop counts up to the 8th bit, then restarts the cycle. It does not go to the 12th bit.

I am wondering, since it looks as though the AD8803.spin code is independent to the bit width, why it would do this?

01-15-2009, 05:53 AM
Duh, the variable's a byte.

Beau Schwabe
01-15-2009, 05:55 AM
tdeyle (http://forums.parallax.com/member.php?u=49521),

You need to re-define DACvalue as a word

This section of code ...

byte DACaddress,DACvalue

...should read

word DACvalue

Note: You canĚremove DACaddress since you don't use it in your case.

Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Beau Schwabe
01-15-2009, 05:55 AM
Yoy beat me to it! http://forums.parallax.com/images/smilies/smilewinkgrin.gif

Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

01-15-2009, 07:15 AM
Ya, the last few posts where I have posted questions, I ended up figuring them out afterwards!

I think I was more caught up in figuring out how to communicate with the DAC (I am not too good with serial communications), that I overlooked that bit!