When the PIC comes up: if (Time >= DallasStartTime && Time < DallasEndTime) turn_on_pump(); else turn_off_pump(); then enter your loop checking for the start/stop times Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) ----- Original Message ----- From: Francois Robbertze To: Sent: Thursday, March 29, 2001 2:11 AM Subject: Re: [PIC]: Timer Routine > Step1. > > Use a flag bit. If it's clear and the time is >= Dallas Start Time, then > > turn the power ON. If it's set, then ignore the Dallas start time in this > > case. > > > Step2. > > If it's set and the time is >= Dallas Stop Time, then turn power OFF. If > > it's clear already, then ignore the Dallas stop time. > > > > --Andrew > > What if the time > Stop Time and the FlagBit is cleared (Power OFF)? > > It will run Step1 because the FlagBit is cleared and the time >= Start Time. > The FlagBit will be set and the power turned ON... > Now the FlagBit is set and the time >= Stop Time. Thus Step2 gets executed > which clear the FlagBit again and turn the power OFF... > > This ON/OFF routine will now do this forever - - - - - - - or at least till > 24H00 (If my minutes Time is set on 0)until the hours gets smallet that the > Start Time again.(my code only compare the hours and minutes so the pump can > start/stop on a daily basis) > > Regards > > Francois > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.