Hi. I have the following function to read and write a byte via SPI, and works very well: CSLCD__0;
while(!SPI4STATbits.SPITBE); // Wait for TX buffer to be empty
SPI4BUF = (int)(Data); // write to buffer for TX
while(!SPI4STATbits.SPIRBF);<..
while(!SPI4STATbits.SPITBE); // Wait for TX buffer to be empty
SPI4BUF = (int)(Data); // write to buffer for TX
while(!SPI4STATbits.SPIRBF);<..