SPI TRANSFER

Is it possible that if i send 2 data through spi, i will received them on my slave and save them into 2 different variables?

ISR (SPI_STC_vect){             //Inerrrput routine function 
  Slavereceived = SPDR;         // Value received from master if store in variable slavereceived
  Slavereceived2 = SPDR;
  received = true; 
  EEPROM.update(0,Slavereceived);//Sets received as True
  EEPROM.update(1,Slavereceived2);
  resetFunc();
}

HARVEYYYYY:
Is it possible that if i send 2 data through spi, i will received them on my slave and save them into 2 different variables?

ISR (SPI_STC_vect){             //Inerrrput routine function 

Slavereceived = SPDR;        // Value received from master if store in variable slavereceived
  Slavereceived2 = SPDR;
  received = true;
  EEPROM.update(0,Slavereceived);//Sets received as True
  EEPROM.update(1,Slavereceived2);
  resetFunc();
}

That’s not how it works I afraid.

Have a look as Nick Gammon’s tutorial for SPI Gammon Forum : Electronics : Microprocessors : SPI - Serial Peripheral Interface - for Arduino.

hope that helps…

ISR (SPI_STC_vect){             //Inerrrput routine function
  Slavereceived[i] = SPDR;         // Value received from master if store in variable slavereceived
  //Slavereceived2 = SPDR;
  i++;
  received = true;
  EEPROM.update(0,Slavereceived[i]);//Sets received as True
  //EEPROM.update(1,Slavereceived2);
  resetFunc();
}

Hi Golam Mostafa, i would like to save them on different eeprom address is it possible that i would put it like this EEPROM.update([i],Slavereceived[i]);? Btw thanks for you help

GolamMostafa:

ISR (SPI_STC_vect){             //Inerrrput routine function

Slavereceived[i] = SPDR;         // Value received from master if store in variable slavereceived
 //Slavereceived2 = SPDR;
 i++;
 received = true;
 EEPROM.update(0,Slavereceived[i]);//Sets received as True
 //EEPROM.update(1,Slavereceived2);
 resetFunc();
}

invalid types 'byte {aka unsigned char}[int]' for array subscript.This was the error i get.

ISR (SPI_STC_vect){             //Inerrrput routine function
  Slavereceived[i] = SPDR;         // Value received from master if store in variable slavereceived
  //Slavereceived2 = SPDR;
  i++;
  received = true;
  EEPROM.update(0,Slavereceived[i]);//Sets received as True
  //EEPROM.update(1,Slavereceived2);
  resetFunc();
}

harveyyyyy:
invalid types 'byte {aka unsigned char}[int]' for array subscript.This was the error i get.

You need to declare the array at the appropriate place of the sketch.

GolamMostafa:
You need to declare the array at the appropriate place of the sketch.

Hello Golam do you think it wont mess up my data because i will be sending a byte data (e.g. 34) then the receiver will be a char array?Thank you