I have a PIC 16F876A running at 4 Mhz, interfaced via I2C, to a PIC MCP23016 ( TP @ 1 Mhz )
The SCL (portc.3) & SDA(portc.4) lines are pulled to Vcc via 4.7K
Variables were used for the control, address, and data portions of the I2CRead statement.
I was successful at setting up and using the MCP as an 8/16 bit output device as well as an 8/16 bit input device.
I did run into an anomaly when using it as an input device.
The bits for the two registers GP0 and GP1 were read back from the MCP but bit D7 was missing from the first register that was read. A scope reading revealed that the first SCL clock pulse #1 after the internal read was missing or shortened to a glitch. ( see PIC data sheet DS20090B, FIG 1.7 ).
By reducing the Cext to 15 pf from the recommended 33 pf ( ie. increasing the internal MCP clock to 2 Mhz) the # 1 clock pulse was restored. Even better results occured when I used only the stray capacitance of the bread board to increase TP to 4 Mhz.
It would appear that the MCP is holding the SCL line down long enough to distort or eliminate SCL pulse #1. By increasing the internal MCP clock speed, the MCP processes the data faster reducing the hold down time for SCL?
This would seem to be a dubious fix for this problem.
I'm hoping one of the forum members has run into this problem and can suggest a few more things for me to try or check.
thank you in advance,
TWSK
Bookmarks