milan.rajik
Banned
According to my code
data to be sent out is placed in SSPBUF and it automatically starts getting out 1 bit at a time with MSB first out. Also data from SDI is filled from bit 0 of SSPBUF simultaneously. After all 8 bits are transferred out BF bit is set and it comes out of the while loop. Then BF flag is cleared and the data which was received in SSPBUF is copied to inByte and the function returns the inByte.
Code C - [expand] 1 2 3 4 5 6 7 SSPBUF = SPIData; while(!SSPSTAT.BF); SSPSTAT.BF = 0; inByte = SSPBUF; return inByte;
data to be sent out is placed in SSPBUF and it automatically starts getting out 1 bit at a time with MSB first out. Also data from SDI is filled from bit 0 of SSPBUF simultaneously. After all 8 bits are transferred out BF bit is set and it comes out of the while loop. Then BF flag is cleared and the data which was received in SSPBUF is copied to inByte and the function returns the inByte.