I have my sprinklers running on a PIC-MAXI-WEB with original Microchip code modified by Jorge Amodio and additional hacks by myself. Recently there have been issues with the sprinklers not turning off so I wanted to modify the code to ensure that they are only turned on if everything checks out. The Valid_Clock flag is now checked before enabling the sprinklers. This works ok but the code below never sets it back to invalid once it was set. I was trying to decide on the ideal spot to insert Valid_Clock =3D 0 and noticed that the end of some CASE statements did not either increment the state machine and/or include a break statement. See code below. Do you think this was intentional or an oversight.? If intentional, why? As the code still appears to work OK, perhaps it was tested and then left at that. I was planning to insert Valid_Clock =3D0 after smSNTP--; (see Below) Does that seem ideal? I would usually just modify, flash and debug but I think I have used about 70/100 program flash cycles. Justin code snippet case SNTP_REQUEST: // Send SNTP request, NTP Version 4, Mode Client if (!UDPIsPutReady(s)) break; UDPPut(0x23); for ( i =3D 1; i < 48 ; i++ ) UDPPut(0x00); UDPFlush(); StartTime =3D TickGet(); smSNTP++; break; //*****This looks normal case SNTP_TIMEOUT: // Check if we have any data in the socket if(!UDPIsGetReady(s)) { if(TickGet() - StartTime > SNTP_REQ_TIMEOUT) { smSNTP--; //*****Planning to add Clock_Valid =3D 0 here } break; } //*****No break or smSNTP++ here; case SNTP_REPLY: // We are only interested in the Transmit timestamp seconds // which is a 32 bit value (big indian) starting at offset 40 for ( i =3D 0 ; i < 40 ; i ++ ) UDPGet(&TX_Timestamp.v[0]); for ( i =3D 0 ; i < 4 ; i++ ) UDPGet(&TX_Timestamp.v[i]); UDPDiscard(); UDPClose(s); smSNTP++; //*****No Break here case SNTP_DONE: TX_Timestamp.Val =3D swapl(TX_Timestamp.Val); // Adjust for SNTP counter rollover and local tick counter // start time if ( TX_Timestamp.v[3] & 0x80 ) TX_Timestamp.Val -=3D 3155673600ul; else TX_Timestamp.Val +=3D 1139207298ul; // Update local tick counter SetTimeTick(TX_Timestamp.Val); Valid_Clock =3D 1; SNTP_LastUpdate =3D TX_Timestamp.Val; smSNTP =3D SNTP_IDLE; --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .