AD5791 DAC-Arduino Issues

Hey, I've been trying to communicate with the AD5791 DAC using the Arduino duemilanove, but all attempts fail to change the voltage output on the DAC...

I know this a long shot, but I was wondering if anyone had done this before and could help...

-DataSheet for DAC is at: AD5791 Datasheet and Product Info | Analog Devices

Code:

// DAC Data Transfer
#define DATAOUT 11 // DIN
#define SPICLOCK 13 // SCLK

long AD5791_DATA_REGISTER = 0x100000; //data register mask

int syncPin = 10;
long dac_code = 0x000CC0;
long data = AD5791_DATA_REGISTER | dac_code;

// Setup SPI Interface code BEGIN ///////////////////////////////////////////
void setup()
{
byte clr;
pinMode(DATAOUT, OUTPUT);
pinMode(SPICLOCK,OUTPUT);
pinMode(syncPin,OUTPUT);

digitalWrite(syncPin,HIGH); //disable device

//The SPI control register (SPCR) has 8 bits, each of which control a particular SPI setting.

// SPCR
// | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |0000000000000000000
// | SPIE | SPE | DORD | MSTR | CPOL | CPHA | SPR1 | SPR0 |

// SPIE - Enables the SPI interrupt when 1
// SPE - Enables the SPI when 1
// DORD - Sends data least Significant Bit First when 1, most Significant Bit first when 0
// MSTR - Sets the Arduino in master mode when 1, slave mode when 0
// CPOL - Sets the data clock to be idle when high if set to 1, idle when low if set to 0
// CPHA - Samples data on the falling edge of the data clock when 1, rising edge when 0'
// SPR1 and SPR0 - Sets the SPI speed, 00 is fastest (4MHz) 11 is slowest (250KHz)

SPCR = B01010100;
clr=SPSR;
clr=SPDR;
delay(10);

Serial.begin(9600);

//Write to Control Register
/* digitalWrite(syncPin,LOW);
spi_transfer(0x20);
spi_transfer(0x00);
spi_transfer(0x20);
digitalWrite(syncPin,HIGH);

*/

}

//So now we can write a function SetVoltage(int) that will change the DAC output.
/////////////////////////////////////////////////////////////////////
// DAC SPI Interface
char spi_transfer(volatile char data)
{
SPDR = data; // Start the transmission
while (!(SPSR & (1<<SPIF))){}; // Wait the end of the transmission
return SPDR; // return the received byte
}

/////////////////////////////////////////////////////////////////////
// Set the voltage on the 20-bit DAC
byte SetVoltage()
{
//Read from Control Register/
/* spi_transfer(0x00);
digitalWrite(syncPin,LOW);
spi_transfer(B10100000);
spi_transfer(B00000000);
spi_transfer(B00000000);
digitalWrite(syncPin,HIGH); //release chip, signal end transfer
spi_transfer(0x00);

*/

spi_transfer(0x00);
digitalWrite(syncPin,LOW);
spi_transfer(data>>16);
spi_transfer(data>>8);
spi_transfer(data);
digitalWrite(syncPin,HIGH); //release chip, signal end transfer
spi_transfer(0x00);

}

void loop()
{
SetVoltage();
delay(500);
}

** I have commented out my attempts at reading/writing from/to the DAC's control register since no data is returned on the MISO line**

**Thanks for any and all suggestions/comments

I was Initially having problems understanding the SPI, but I am fine with that now. I guess that was what my question was directed toward. Now, I'm just having communication issues of the AD5791 side, but here's not the place to ask questions about the DAC.
Thanks

On the AD5791, before you can update the DAC, you need to enable the output. On power-up, the output is clamped to GND. You need to write to the control register to enable the DAC output, which is done by disabling the OPGND and OPTRI control bits.

Also, if you're just using SPI to update the DAC, you'll need to keep the LDACB pin held low.