Joined: 01 Jun 2004 Posts: 39 Location: Trois-Rivières
does I2C functions handle errors?
Posted: Tue Jun 01, 2004 3:44 pm
Hi,
I'm about to implement an I2C bus between two PIC18F452. Since this communication is critical to the system, I want to be able to know if the slave ACKs the data transfers. There's no documentation on this issue in CCS compiler... I just want to know what i2c_write() will do in this situation and if I can still read the ACKSTAT bit after the call to i2c_write().
Thanks _________________ Alex
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
Posted: Tue Jun 01, 2004 3:53 pm
If you will examine the help file it states that the i2c_write() function returns the ACK bit. 0 means ACK and 1 means NO ACK. So, if you had a statement that read:
check_ack = i2c_write(address);
or
if(!i2c_write(address))// enters 'if' statement if ACK'd
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