ADICON Support Forum Applied Digital, Inc.
Page 1 of 1 1
Topic Options
#21429 - 10/12/09 04:45 PM Glitch with "Time of Day" code in my program
GaryA Offline
newbie


Registered: 10/12/09
Posts: 3
I'm a newbie to the Ocelot/X-10 programming world here in Australia. I have had some success with my C-Max program but have failed to get the "Time of Day" function to work. Some details up front:
1) Australia power supply operates under 240 Volts / 50 Hz. I bought my Ocelot in USA and Ocelot inside the box bears the number 58,
2)Firmware V8.31/58, Application V3.18, Code Editor V2.00e5
3) The following code operates fine apart from lines 10 to 12:
0001 - IF Module #1 -SECU16-I Input #0 Turns ON //
0002 - THEN X-10 House B / Unit 6, Turn ON //
0003 - THEN Timer #1 = 1 //
0004 - IF Timer #1 becomes > 5 //
0005 - THEN X-10 House B / Unit 14, Turn ON //
0006 - THEN Ocelot, Zone 0 IR IR #1 //
0007 - THEN Module #3 -SECU16-IR, IR Zone #9 IR IR #1 //
0008 - THEN Timer #1 = 0 //
0009 - //
0010 - IF Time of Day is > 20:00 //
0011 - AND Time of Day is < 22:00 //
0012 - THEN X-10 House B / Unit 14, Turn OFF //
0013 - //
0014 - //
0015 - IF Module #2 -BOBCAT-T is < 256 //
0016 - THEN Variable #1 = Data for Module# 2 //
0017 - THEN Variable #1 + 80 //
0018 - THEN Variable #1 - 32 //
0019 - THEN Variable #1 * 5 //
0020 - THEN Variable #1 / 9 //
0021 - THEN Variable #1 - 100 //
0022 - THEN Variable #2 = Variable #1 //
0023 - //
0024 - End Program //

Can anybody offer help? It will be much appreciated.
PS: My computer is in time mode with AM and PM format (not military)

Top
#21430 - 10/12/09 05:42 PM Re: Glitch with "Time of Day" code in my program [Re: GaryA]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
Currently the problem with lines 10 to 12 is that they both test static conditions, which means that the Ocelot would probably be sending a continuous series of B/14 OFF command pairs. The Ocelot might even appear to lock up.

You didn't exactly say what you want to program to do, but if your intent is simply to turn off B/14 as soon as it is 8 PM, then you would just need to do:

0010 - IF Time of Day becomes > 20:00 //
0011 - THEN X-10 House B / Unit 14, Turn OFF //
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#21432 - 10/12/09 11:27 PM Re: Glitch with "Time of Day" code in my program [Re: Guy Lavoie]
GaryA Offline
newbie


Registered: 10/12/09
Posts: 3
Thanks for a speedy reply. I will experiment with your code tonight, BUT, my problem is also that my C-MAX Editor does not allow me a choice of "becomes > 20:00", but rather will only allow "becomes = 20:00". Why is that the case? Can I turn off the Control Wizard and enter code manually??
Yes, I am only trying to turn a light on or off to experiment with this piece of code that I cannot get to work. Also my sunrise/sunset time code does not work.
I am hoping to operate my house lighting system to function at different modes depending on time of day - so desperately need this piece of code to work.

Top
#21433 - 10/13/09 05:24 AM Re: Glitch with "Time of Day" code in my program [Re: GaryA]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
That's my mistake...from copying your initial code section and modifying it in my post. I should have put an "=" sign. Sorry about that! Having a "becomes >" for Time of Day would be redundant, since you could code "becomes > 20:00" simply as "becomes = 20:01".

Is the time correctly set in the Ocelot, and do timers work ok? If so, then statements such as "IF Time of Day becomes = 20:00" should work. Try it by coding it for just a few minutes later then the current time.

You can use AND statements to do fancier things such as allow triggers to only work during certain time intervals, such as a motion detector on a SECU16 input to turn on a X10 light for 1 minute if triggered between two time of day values.

IF Module #1 -SECU16-I Input #5 Turns ON //
AND Time of Day is > sunset //
AND Time of Day is < 23:30 //
THEN X-10 House A / Unit 1, Turn ON //
THEN Timer #2 = 1

IF Timer #2 becomes > 60 //after 1 minute
THEN X-10 House A / Unit 1, Turn OFF // turn off
THEN Timer #2 = 0
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#21436 - 10/13/09 09:16 PM Re: Glitch with "Time of Day" code in my program [Re: Guy Lavoie]
GaryA Offline
newbie


Registered: 10/12/09
Posts: 3
Thanks Guy for your help.
After you verified that the code should work I set about looking at other problems. You are right the problem was an INCORRECT time in the Ocelot. The Ocelot time was lagging by 8 hours, so each time I did a test for a time in a few minutes, I never got the expected result. Now that the Ocelot's time is equal to the Computer's time (real time) I get a favourable result with the code "Time of Day".
That begs the question - Why did my Ocelot fall behind in time by 8 hours (Exactly 8 hours to the second). Is there a battery inside the Ocelot that needs changing regularly?
Or maybe I have just discovered the reason while typing this message. I recall messing around with the "Comms Setup - Time Zone" to get my sunrise and sunset to mimmick correctly. I actually changed the Time Zone offset - Could explain the 8 hour diffeerence.
I'm enjoying the learning experience and really appreciate your prompt assistance.
Thanks a lot.

Top
Page 1 of 1 1


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie 
Hop to:
Who's Online
1 registered (kuro) and 21 anonymous users online.
Recent Posts
Basic Ocelot/IR-100 Question
by kuro
02/09/12 04:16 PM
SECU16IR Output Connecting To A Xantech Connecting Block
by Jean-Marie
02/09/12 08:36 AM
SECU16IR Output Connecting To A Xantech Connecting Block
by Jean-Marie
02/09/12 08:34 AM
how to post an icon
by manu
02/03/12 03:40 AM
Command Pair
by kuro
02/01/12 12:49 AM
Shout Box

Newest Members
feshh, manu, kuro, chuck214, Funkhauser
2747 Registered Users
Forum Stats
2747 Members
19 Forums
3837 Topics
22714 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