After you write to the SSPBUF if you wait for SSPIF instead of BF then ACKSTAT will be valid.
After you write to the SSPBUF if you wait for SSPIF instead of BF then ACKSTAT will be valid.
great stuff H & T thanks for the info
i need to learn more about handling the MSSP hardware directly as you are showing
T- I tried waiting for the SSP1IF interrupt, but it never happened! The pic spec indicates that you clear it after the start condition is complete (SEN = 1) and you have written to SSP1BUF (PIC18F87K90 Family figure 21-23), but maybe I have to clear it before writing to the buffer.
D - I prefer to talk directly to the MSSP module because I2CWRITE wouldn't let me send just an address and look for a NACK.
Hmm. After you initiate the START (SEN=1) and then wait for SEN to go low (SEN=0) you should be able to clear SSPIF before you write to the SSPBUF.I tried waiting for the SSP1IF interrupt, but it never happened!
If you look at that figure once you write to the SSPBUF you'll see BF being asserted on the 8th clock, but SSPIF isn't asserted until the 9th after the ACK.
Bookmarks