ADICON Support Forum Applied Digital, Inc.
Page 1 of 1 1
Topic Options
#19903 - 05/09/08 05:57 PM How to run a 48 hour timer?
Ray Eden Offline
journeyman


Registered: 01/09/03
Posts: 67
Loc: Bogota, NJ
To make a long story short, I am moving my lawn sprinklers over to my Ocelot. The sprinkler sequence works fine using the relays in the SECU16 to trigger external relays to power the sprinkler valves with 24vac. My problem lies with my rain sensor. It's wired through a supervised port and when it opens it sets a variable to "1". When it closes, and that variable is set to "1", I want don't want the sprinklers to start their sequence for "48" hours but unfortunately I can only seem to set a timer for a maximum of "41728" seconds not the "172800" that I would like.

Is there a way around this other than incrementing a variable every "6" hours or so?
_________________________
I live in my own little world. But it's OK. They know me here.

Top
#19904 - 05/09/08 06:34 PM Re: How to run a 48 hour timer? [Re: Ray Eden]
John Warner Offline
old hand
*****

Registered: 01/09/03
Posts: 817
Loc: Port Perry, Ontario, Canada
This should work. Adding 32768 to a variable toggles it from 0 to 32768 and back. I use this to determine odd weeks for recycling.

The variable used (34 in example) should be one that is above the value in parameter 22 so it is not reset to 0 on power up.

IF Time of Day becomes = 01:00 // 1:00 AM
THEN Variable #34 + 32768 // Toggle between 0 and 32768
IF Time of Day becomes = 12:00 // Noon ?
AND Variable #34 is = 0 // And is an odd day
THEN Module #1 -SECU16 Relay #8 Turn ON // Turn on sprinkler

Thanks to Guy for this tip!


Edited by John Warner (05/09/08 06:34 PM)

Top
#19905 - 05/09/08 07:06 PM Re: How to run a 48 hour timer? [Re: John Warner]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
What I think what Ray wants to do is count a 48 hour time period (activate something 48 hours after the trigger). A timer can normally count up to 65535 which is about 18 hours. It is not a straightforward task to count out 48 hours. Incrementing a variable is probably still the simplest way, such as:

IF (rain is detected...)
THEN Variable #1 = 1 //set increment flag to 1 (nonzero = running)
THEN Timer #1 = 1 //and start timer

IF Timer #1 becomes > 43200 //after 12 hours
AND Variable #1 is > 0 //and flag is in "running" mode
THEN Variable #1 + 1 //increment flag
THEN Timer #1 = 1 //and restart timer

IF Variable #1 becomes = 5 //if it just incremented to 5
THEN Variable #1 = 0 //reset flag to 0
THEN Timer #1 = 0 //stop timer
THEN (do whatever you wanted 48 hours later)


So when the timer is first running the flas is set to 1. Twelve hours later it increments to 2 and restarts the timer. After 48 hours, it increments from 4 to 5 and the routine right after the increment catches this and stops the routine (and does what you wanted after 48 hours).
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#19907 - 05/09/08 08:24 PM Re: How to run a 48 hour timer? [Re: Guy Lavoie]
Ray Eden Offline
journeyman


Registered: 01/09/03
Posts: 67
Loc: Bogota, NJ
Thanks Guy, that's exactly what I'm looking for. Sometimes I encounter a "brain fart" and can't see the obvious. Where would this board be without you. Thanks again!
_________________________
I live in my own little world. But it's OK. They know me here.

Top
Page 1 of 1 1


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie 
Hop to:
Who's Online
0 registered and 26 anonymous users online.
Recent Posts
how to post an icon
by manu
02/03/12 03:40 AM
Command Pair
by kuro
02/01/12 12:49 AM
Does anyone have a copy of the latest TSE?
by sevenzenith1
01/30/12 05:17 AM
Have HAL2000 do the work or the Ocelot?
by khem
01/28/12 02:49 PM
Ocelot + Powermid = Fail
by Guy Lavoie
01/27/12 03:37 PM
Shout Box

Newest Members
dfgg, manu, kuro, sevenzenith1, chuck214
2748 Registered Users
Forum Stats
2747 Members
19 Forums
3835 Topics
22711 Posts

Max Online: 67 @ 08/16/11 03:08 PM
February
Su M Tu W Th F Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29