# SPI (master) for PIC18F6680 (10Mhz 4xPLL)

#### weeb0

Joined Jun 13, 2005
5
Hi,

I have a questions regarding the connection to device (DAC) with the SPI protocol.

Often, I have to write to the device 2 times to get the correct Vout voltage of the DAC.

I use the following code: (Read the comments to know more about my question)

The SSPCON1 is as follow :
Rich (BB code):
    SSPCON1           = 0x02;
SSPCON1bits.CKP   = 1;
SSPSTATbits.SMP   = 0;
SSPSTATbits.CKE   = 0;
SSPSTATbits.SSPEN = 0;
The device is a TI D A C 7 6 1 5.

Thank your for your help, I'm desesperated. lol