Hello and welcome to the forum.
To read SPDR, I would suggest you do either of the following -
Assign the value of SPDR to a byte variable
temp = SPDR;
or return the value of SPDR on exit from a function
return SPDR;
Note that SPSCR is read within the following line, so nothing further is necessary -
while (SPSCR_SPRF==0);
A SPI function might be as follows -
byte SPI_trans(byte DataOut)
{
while (SPSCR_SPTE==0); // Wait for transmit data register empty
SPDR = DataOut; // Send byte value
while (SPSCR_SPRF==0); // Wait for SPI receive flag
return SPDR; // Return received value
}
Regards,
Mac