spi programming
Oh..thanks a lot for your reply and the link..So, basically, I need to do a dummy read to clear the SSPBUFF before I can do the next transmit? Also, regarding the need to check the buffer status before trnsmitting the next byte, I am confused about which bit i need to check. Is it WCOL or SSPOV.
---------------------------------------------------------------------------------------
Here is an excerpt from the PIC16F877 datasheet regarding the 2 bits:
WCOL: (Master Mode) 1 = A write to SSPBUF was attempted while the I2C conditions were not invalid
0 = No collision
SSPOV: (SPI Mode) 1 = A new byte is received while the SSPUF holds previous data. Data in SSPSR is lost on overflow. In Slave mode, the user must read the SSPBUF, even if only transmitting data, to avoid overflows. In Master mode, the overflow bit is not set, since each operation is initiated by writing to the SSPBUF register. (Must be cleared in software).
0 = No overflow
---------------------------------------------------------------------------------------
From the link given by Phil, I understand the need to do a dummy read after each transmit. But how do I know when the transmit is done before I can actually perform the dummy read?
Thank you for your kind help!