I am using a PIC16F876 as a slave and sometimes during I2C communications it freezes up and doesn't respond to any commands from the Master(PIC16F877). If I reset the power it comes back online. Is there a way that I can reset the PIC or the interrupt without resetting the Power.
thanks
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
Posted: Fri May 05, 2006 11:08 am
The interrupt is cleared whenever you read SSPBUF. Make sure that everytime the interrupt is entered that you have something like: var = SSPBUF; so that it is cleared. You will, also, want to check to see if the SSPOV bit is set. This means that an over-flow situation has happened and the Slave will not respond correctly until it is cleared.
There could be a matter of timing as well. If your Master is sending i2c commands faster than the Slave can address the interrupt then it could lock up. Try inserting delays between each i2c command and see what happens. On one of my projects I was sending an i2c_stop() command before the Slave had time to service the interrupt and it didn't want to cooperate so I had to insert a delay before the stop command and the Slave started working.
Ronald
vik
Joined: 28 Apr 2006 Posts: 3
Posted: Fri May 05, 2006 2:30 pm
Does anyone know how to enable and disable the I2C communication using the built in function provided by CCS compiler
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum