Thanks for the files tacbanon.
Well, this code for the slaves will allow it to read from both devices.
Code:
main:
IF SSPCON1.6 THEN SSPCON1.6 = 0
goto main
i2c_int_handler:
IF i2c_read then
IF i2c_buffer_full=0 THEN
SSPBUF=i2c_data[i2c_data_index]
i2c_data_index=i2c_data_index+1
ELSE
dummy = SSPBUF
ENDIF
ELSE
i2c_data_index=0
ENDIF
i2c_release_scl=1
@ INT_RETURN
But it's still not right. And is not a complete slave.
According to AN734 there are 5 states to maintain. 6 including the ERROR state.
Your original code only handles 1 state, and this modification only does 2 states.
I think by adding the other 4 states, it will get rid of the buffer overflows, but I'm not absolutely sure.
I'm going to convert AN734 state machine to PBP and see what happens.
May take me awhile.
Bookmarks