Help on AD5781


I've to make working an AD5781 with a Spartan 6 FPGA. I'd like to control it using a simple VHDL driver and not a hudge SPI one but the dac doesn't work. I put a part of my vhdl driver as you can take a look and tell me what's wrong. Thanks in advance.

-- Data_to_send is "0" & "001" & "011111111110111000" & "11" (23 downto 0)

-- Sclk_temp is at 100KHz

sending_data : process(Data_to_send, Sclk_temp)

variable i : integer :=23;



CLR  <= '1';

LDAC <= '0';

Sclk <= Sclk_temp;

if rising_edge(Sclk_temp) then


    if i>=0 then

    Sync <= '0';

    SDin <= data_to_send(i);

    end if;




        if i<-1 then

        Sync <= '1';

            if i<-2 then


            end if;


        end if;


end if;


end process sending_data;