Re: MCC I2C Restart Condition PIC16F1615
Yes, what I have used the I2C driver generated by MCC,
the R/W bit is handled by the API functions I2C_MasterWrite(...) and I2C_MasterRead()
Be aware that the SlaveAddress argument to both these functions are strict 7 bit address without R/W bit in pos<0>,
that make the valid range of addresses are 0 to 127, or more strictly 8 thru 119 considering reserved addresses.
( unless the generated code have been altered.)
What is the contents of MSG_STATUS after each function have returned?
The code generated by MCC may be is a interrupt driver with a queue of tasks,
depending on what settings was selected in MCC when the code was generated.
I2C is a slow protocol, so calling these functions in a fast loop will soon fill the queue to max.
At least if you want to use the values received by I2C_MasterRead(),
you are supposed to test the value placed in the variable MSG_STATUS,
and wait until (MSG_STATUS == I2C_MESSAGE_COMPLETE).
Besides, I think there is a weakness in the API that make it possible to overwrite transfer request packets,
if you call the same I2C_MasterWrite() function before the previous transfer started by the same call was completed.
The interrupt transfer machine in the MCC generated driver is intended to make combined/chained
I2C operations possible, like Start-Write-Restart-Read-Stop, but the API to use that, is kind of awkward in my opinion. And as ric explained, usually not nessesary.