SPI Trouble

I'm new with Arduino and I'm trying to interface an Arduino Mega using SPI with a digital potentiometer. I'm using the code found using the SPIDigitalPot tutorial from Arduino's website.It seems that I can send one byte of data and then it fails after that. Also it doesn't seem to like me setting up the SPCR to 01010011, The master bit (fourth from the left) seems to cause the problem. I've modified the code slightly to determine where the problem is:

#define DATAOUT 11//MOSI
#define DATAIN 12//MISO - not used, but part of builtin SPI
#define SPICLOCK  13//sck
#define SLAVESELECT 10//ss

byte pot=0;
byte resistance=0;

void spi_transfer(volatile char data)
{
  SPDR = data;
  Serial.println(data,HEX);
  Serial.println("sent");  // Start the transmission
  Serial.println(SPSR,BIN);
  Serial.println(SPIF,BIN);
  while (!(SPSR & (1<<SPIF)))     // Wait the end of the transmission
  {  //Serial.println(SPSR);
//     Serial.println(SPIF);
  }
                   // return the received byte
}

void setup()
{
  Serial.begin(9600);
  byte i;
  byte clr;
  pinMode(DATAOUT, OUTPUT);
  pinMode(DATAIN, INPUT);
  pinMode(SPICLOCK,OUTPUT);
  pinMode(SLAVESELECT,OUTPUT);
  digitalWrite(SLAVESELECT,HIGH); //disable device
  // SPCR = 01010000
  //interrupt disabled,spi enabled,msb 1st,master,clk low when idle,
  //sample on leading edge of clk,system clock/4 (fastest)
  
  clr=SPSR;
  delay(10);
  clr=SPDR;
  delay(10);
  Serial.print("SPCR is ");
  Serial.println(SPCR,BIN);
  SPCR = (0<<7)|(1<<6)|(0<<5)|(1<<4)|(0<<3)|(0<<2)|(0<<1)|(0<<0);
  delay(10);

  Serial.print("SPCR is ");
  Serial.println(SPCR,BIN);
  for (i=0;i<6;i++)
  {
    write_pot(i,255);
  }
}

byte write_pot(int address, int value)
{
  digitalWrite(SLAVESELECT,LOW);
  //2 byte opcode
  //Serial.println(address*256+value);
  spi_transfer(address);//*256+value);
  spi_transfer(value);
  digitalWrite(SLAVESELECT,HIGH); //release chip, signal end transfer
}

void loop()
{
     write_pot(pot,resistance);
     delay(10);
     resistance++;
     if (resistance==255)
     {
       pot++;
     }
     if (pot==6)
     {
       pot=0;
     }
}

The output I got was this:
SPCR is 0
SPCR is 1000000
0
sent
10000000
111
FFFFFFFF
sent
0
111

Any help would be greatly appreciated!