SPI interface with other board_AVR_ESK1100 or among Arduino itself

Other Slave codes are:

#include <SPI.h>
#define MAX_BYTES 4  // is there 4 bytes? if not change this and the arrays.

byte cmd_04_data[MAX_BYTES] = {1,2,3,4}; // you fill in the numbers 
byte cmd_06_data[MAX_BYTES] = {5,6,7,8};
byte * data_ptr;
int byte_count = 0;
void setup (void)
{
  
  // have to send on master in, *slave out*
  pinMode(MISO, OUTPUT);
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode (SPI_MODE2);
  SPI.setClockDivider(SPI_CLOCK_DIV64) ;

  // turn on SPI in slave mode
  SPCR |= _BV(SPE);

  // turn on interrupts
  SPCR |= _BV(SPIE);
  
 // disable timer interrupts
  TIMSK0 = 0;
  
}
ISR (SPI_STC_vect) {
  byte c = SPDR;
  if (byte_count == 0) {
      // set a pointer to one or other array based on the byte just received
      data_ptr = (c == 0x04) ? cmd_04_data : cmd_06_data; 
  }
  SPDR = *(data_ptr + byte_count);
  byte_count++;   
  if (byte_count = MAX_BYTES) byte_count = 0;
}  
void loop (void)
{
 
}  // end of loop
byte response_data[] = {-1,-1,-1,-1,'4',-1,'6',-1,'8',-1,'A'}; 

void setup (void) {
  
  pinMode(MISO, OUTPUT); // have to send on master in, *slave out*
  SPCR |= _BV(SPE);   // turn on SPI in slave mode
  SPCR |= _BV(SPIE);  // turn on interrupts
 
}  

void loop () {}

ISR (SPI_STC_vect) {
  byte command = SPDR;

  SPDR = response_data[command];

}