The code simulated just fine.
I think the issue is that it is only run once so s/he like missed capturing it right after power on.
SSP1BUF = x; //
while(!SSP1STATbits.BF);
This is the most efficient approach in terms of code / coding, but least efficient in terms of time: It waits until the transmission is over, which negates the purpose of having the buffer.
A more efficient approach is to use an interrupt; or to test the buffer full flag, load the buffer and exit. So the mcu can do other stuff when the spi module is shifting out the data. Very important if the spi transmission speed is low.
Unfortunately the way the spi module is set up, that kind of approach is not as straight forward is it sounds, for this (family) of chips.
The newer chips, like PIC24F, are much nicer in this regard: you can do seamless transmission there, via either interrupt or polling.