Just had my first attempt dabbling with SPI this evening - fail!

I'm trying to control a AD5206 (six digital pots in the one IC package - http://www.analog.com/static/importe...D5204_5206.pdf)

To test that the wiper on the nominated pot moves I've put 5V on the High side of the internal pot6 pin, & 0V on the low side of pot6 pin. I'm trying to set pot 6's wiper to the midway point (it's a 256 position pot, so I'm sending a value of 127) - but the wiper is not going to 2.5V ....it just sits at 5V.

I've try to join all the 'SPI' elements together (as taken from several threads!). The only bit I'm not totally sure about (& it's pretty fundamental!) is how to send just 11 bits to the AD5206 (the format is three bits to select which of the 6 internal digital pots you want the wiper to move, then send the data to actually control the wiper (3 'variable resistor select' bits + 8 databits so 11 bits in total).

Any ideas....

Code:
@ __CONFIG _FCMEN_OFF & _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF & _IESO_OFF & _BOR_OFF & _PWRTE_OFF

'16F690 Pin Connections....
' PIN# NAME     USE & CONNECTION
'  1   Vdd      +5VDC power supply   
'  9   RC7      SDO (serial Data out)
'  10  RB7      HSEROUT pIN
'  11  RB6      SPI Clock out
'  13  RB4      SDI (serial Data In)
'  16  RCO      CS Chip Select (to pin 3 on AD5206)   output           
'  20  Vss      Ground
'*************************************************************************************
DEFINE  OSC 8          ' set Oscillator at 8Mhz.
DEFINE  NO_CLRWDT 1   ' PBP doesn't clear WDT automatically
DEFINE HSER_SPBRG 25   'HSEROUT Stuff.
DEFINE HSER_TXSTA 24h  'HSEROUT Stuff.
DEFINE HSER_CLROERR 1  'HSEROUT Stuff.

txsta = %10100100       'setup the tx register
RCSTA.7 = 1             'Enable RB7 for TX USART
INTCON.0 = 0            'clears the RABIF Flag (to 0), COULD be 1 on reset (unique to F690)
ANSEL      = 0          'disable AtoD.
ANSELH     = 0          'disable AtoD.

OPTION_REG = %00000111  'enable weak pullups.
WPUB     = %00010000   'enable weak pullups on the SDI RB4 (input from digital pot)

'------SPI setup
SSPEN VAR SSPCON.5   ' SSP Enable bit
CKP   VAR SSPCON.4   ' Clock Polarity Select
SMP   VAR SSPSTAT.7  ' Data input sample phase
CKE   VAR SSPSTAT.6  ' Clock Edge Select bit
SSPIF VAR PIR1.3     ' SPI interrupt flag

SSPCON.5=1 'enable SSP 
SSPCON.4=1 'Clock idles high bit name CKP
SSPCON.3=0 ' bit 3 to 0 indicate clock speed. bit 0 set means clock = OSC/16 = 1.25 MHz
SSPCON.2=0
SSPCON.1=0
SSPCON.0=1
SSPSTAT.7=1 ' SPI Master mode 
SSPSTAT.6=0 ' data transmitted on rising edge of SCK

SCK     var PortB.6  'clock pin
CS      var PORTC.0     'chip select
SDI     var PortB.4    'data in
SDO     var PortC.7      'data out
AD5206  var word    'word used to send 3 control bits  + 8 data bits

TrisC.0 = 0    'Chip Select (CS) 
TrisB.6 = 0    'SPI Clock Out
TrisB.7 = 0    'Debug Out

' AD5206 Variable resistor select 'Control' bits as as follows....
'000 Select Variable resistor1
'001 Select Variable resistor2
'010 Select Variable resistor3
'011 Select Variable resistor4
'100 Select Variable resistor5
'101 Select Variable resistor6

AD5206 = %00001010111111   'upper byte = select Variable Resistor 6 (ref the table above) , lower byte = set VR6 wiper value to midway

high CS 

' CODE TO CONTROL SPI POTENTIOMETER AD5206

Main:
    gosub WriteSPI
    pause 1000
    goto Main

WriteSPI:
    LOW CS                            
    Shiftout SDO, SCk, 1, [AD5206 \11] ' not sure about this bit!!
    high cs
    RETURN                       

end