main.c
unsigned char writeSPI( unsigned char b)
{
 SPI2BUF=b; // write to buffer for TX
 while( !SPI2STATbits.SPIRBF); // wait transfer complete
 return SPI2BUF; // read the received value
}
// send one byte of data and receive one back at the same time
send one byte of data and receive one back at the same time
send one byte of data and receive one back at the same time
unsigned char writeSPI( unsigned char b)
{
 SPI2BUF=b; 
 while( !SPI2STATbits.SPIRBF); 
 return SPI2BUF; 
}
unsigned char writeSPI ( unsigned char b ) { SPI2BUF = b ; while ( ! SPI2STATbits . SPIRBF ) ; return SPI2BUF ; }
send one byte of data and receive one back at the same time
send one byte of data and receive one back at the same time
// write to buffer for TX // wait transfer complete // read the received value