Joined: 30 Oct 2003 Posts: 209 Location: Norfolk, England
i2c_start not starting!
Posted: Sun Apr 30, 2006 2:03 pm
Hi,
I am having a spot of bother with some i2c code.
I am getting stuck in i2c_start(); I never get to my next line which is a i2c_write with the address! I am using the hardware i2c MSSP master mode. The code it's stuck in is:
01C8: BSF FC5.0
01CA: BTFSC FC5.0
01CC: BRA 01CA
FC5.0 is "Initiate Start condition on SDA and SCL pins. Automatically cleared by hardware"
in my case the hardware isn't automatically clearing it! Even with nothing connected to the i2c liens only 3k pull-ups it still doesn't get cleared.
Am I missing something?
P.S. PIC is 18F2520
Ttelmah Guest
Posted: Sun Apr 30, 2006 2:54 pm
Have you looked at the errata sheet for the chip.
There is a problem if an I2C_START is repeatedly sent. In this circumstance the bit will not clear automatically, and will hang the code...
Send an I2C_STOP, before sending any I2C_START command, and it should prevent the problem.
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