Arduino Ethernet board + SPI device

Hi,

I would like to add slave SPI device to my Arduino Ethernet board.

My plan is to use regular pins for SPI communication - 11, 12 and 13 then to divide pin 10 as CS for Ethernet and pin 9 for additional SPI device. So the code should look like this:

#include "SPI.h"

const int ssForJennic = 9;
const int ssForEthernet = 10;

void setup(){
  pinMode(ssForJennic,OUTPUT); 
  pinMode(ssForEthernet, OUTPUT); 
  SPI.begin(); 
  SPI.setBitOrder(MSBFIRST);
}

void sendDataToJennic(int data){ 
  digitalWrite(ssForEthernet,HIGH);
  digitalWrite(ssForJennic, LOW);
  SPI.transfer(data); 
  digitalWrite(ssForJennic,HIGH);  
}

void loop(){
}

..but it refuses to work, so the question is: Is it possible to disable communication with Ethernet just big setting pin 10?

  pinMode(ssForEthernet, OUTPUT); //disable communication with Ethernet

That is NOT what that statement does.

Is it possible to disable communication with Ethernet just big setting pin 10?

Yes, by setting it's STATE to HIGH or LOW, you can enable or disable communication with the Ethernet shield.

Yes, you're right. Wrong comment.

There is no need to police the ethernet chip select pin once you begin ethernet. The library code enables the chip when it communicates with it and then disables it afterwards. All you have to do is, as PaulS pointed out, write HIGH to your additional SPI chip select in setup() until you want to use it, then write LOW and use it.