In the recent discussion regarding I2C slave during which I said I had never needed to use the start and stop interrupts. Typicaly, I now need to implement a host timeout from the first start condition. Implementing a spare timer to achieve this is not difficult, but after a thorough read of the datasheet I'm wondering if there is a way I can unambiguously detect that a START interrupt has occurred from the SSPSTAT register. The START bit in SSPSPAT will be set, but this remains set until a stop bit is sent. The DA bit is invalid at this stage, since no data has been received or sent, as is the RW bit. The only way I can think of doing this is to have a bit variable that I initialise to zero at reset, and compare to the START bit in SSPSTAT: E.g. void interrupt(void) { static bit prevStart = 0; // state of START bit in previous interrupt if(SSPIF && SSPIE) // is this an MSSP interrupt? { SSPIF = 0; // clear interrupt flag if( (START == 1) && (prevStart == 0) ) // interrupt caused by start? { // start timer etc. } else { // normal comms handler } prevStart = START; } } Is this a reasonable plan? Is there a way of unambiguously detecting wether an interrupt was caused by a a START condition just by looking at the MSSP status register? Cheers 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#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body