>-----Original Message----- >From: Jinx [mailto:joecolquitt@CLEAR.NET.NZ] >Sent: 22 June 2004 10:28 >To: PICLIST@MITVMA.MIT.EDU >Subject: Re: [PIC:] I2C woes > > >I think I may have found the problem. Being the persistent >type and double-checking that the IC is still alive I prodded >around with the scope and found that Reset was low, even >though it has a pullup. There was the minutest solder bridge >to 0V under some flux. Man, I had to look hard for it, but >it's gone now and the code flow has improved markedly. Well, >it would do wouldn't it ? > >Now, Ken, should I still trust myself after working all day >with a chip that's been in flipping reset ? 8-O > >BTW, if anyone does still see room for improvement in the >posted code that would be appreciated If you look at the timing diagrams for master mode transmission, the RW bit is only cleared after the ACK bit has been clocked in. Therefore the loop waiting for the the ACKSTAT bit to become set is not required, the ACKSTAT bit is valid as soon as RW has cleared. In fact this loop will cause the code to hang if the slave does not ACK your request, as you have noticed. Also, you have an 18F part but you are doing bit operations on the PORTx register instead of the LATx register (I know it's only for debugging, but debugging your debugging code is quite frustrating IME...). Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= Any questions about Bookham's E-Mail service should be directed to postmaster@bookham.com. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.