Home > categories > Electrical Equipment & Supplies > Relays > The program flow of single - chip control relay timer switch
Question:

The program flow of single - chip control relay timer switch

Is it necessary to set a condition loop to detect the current time if set to the opening hours <= current hours <set off hours && set the opening minutes <= current minutes <set off minutes to turn on the relay otherwise turn off the relay? The What is the current interval for this scan?

Answer:

Clock chips are generally interrupt output, such as DS12B887, every second has an interrupt output, use this signal can do what you want to do.
Do not need it, just set the timer interrupt on it
On the main program has been refreshed Pay attention to judge when to separate If ((openhour <= hour) && (hour <closehour)) {If ((openmin <= min) && (min <closemin)) Out = 0; Else out = 1; } Else out = 1; Your time is done with DS1302 it

Share to: