Please login or register.

Login with username, password and session length

Author Topic: Code 0xA5 (165) question..  (Read 15213 times)

ZarkWizard

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 2
Code 0xA5 (165) question..
« on: September 02, 2008, 07:56:07 AM »

Hi All,

I finally got around to working on trying to code an interface for my CM11A.  One of the things I noticed is the interface keeps polling me with the 0xA5 code noting that power went out and it has no time.

The bit layout for the time is :
The PC must then respond with the following transmission

Bit range   Description
55 to 48   timer download header (0x9b)
47 to 40   Current time (seconds)
39 to 32   Current time (minutes ranging from 0 to 119)
31 to 23   Current time (hours/2, ranging from 0 to 11)
23 to 16   Current year day (bits 0 to 7)
15   Current year day (bit 8)
14 to 8      Day mask (SMTWTFS)
7 to 4      Monitored house code
3      Reserved
2      Battery timer clear flag
1      Monitored status clear flag
0      Timer purge flag


I don't get bits 7-4.  Also when would you use bits 2 - 0.  Does the Timer purge flag remove macro timers?  I would assume you set 2 when you set the time.  I have no idea what bit 1 does.

Any clarification would be greatly appreciated.

Thanks.


« Last Edit: September 02, 2008, 08:00:49 AM by ZarkWizard »
Logged

Charles Sullivan

  • Hero Member
  • *****
  • Helpful Post Rating: 94
  • Posts: 1565
    • HEYU - X10 Automation for Linux, Unix, and Mac OSX
Re: Code 0xA5 (165) question..
« Reply #1 on: September 02, 2008, 08:21:42 AM »

The CM11A has internal registers which store the state of modules on a single housecode.  Bits 7-4 let you program which housecode to use.

You would set the Battery timer clear flag initially, and then only when when you change the battery in the CM11A.
The Timer purge flag clears timers with a delay which has started but not yet executed.
The Monitored status clear flag clears the above mentioned internal registers.

Note that the CM11A Protocol document on the X10 website lists bits 0-2 incorrectly.  For a corrected copy of this document, see http://www.heyu.org/docs/protocol.txt

Logged
Yesterday it worked.
Today it doesn't work.
X10 on Windows is like that.

HEYU - X10 Automation for Linux, Unix, and Mac OS X     http://www.heyu.org

ZarkWizard

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 2
Re: Code 0xA5 (165) question..
« Reply #2 on: September 02, 2008, 10:02:19 AM »

Thanks for the updated docs.  I am sure they will help with writing the interface.

Although I am still curious about the house code...

Are there multiple clocks to be set up for each house code?  eg A-P?  Do I have to set the clock for every house code?    If I read your message right it would seem to be the case. 

So if I wanted to set the clock for house code A, and the time and date are : Tues Sept 2 2008 : 10:15:33am I'd be looking at something like :

Sending the characters representing:
0x9b     
0x21  (33 seconds)
0x0f  (15 min, why does it say up to 119 min?)
0x0A (10 hour (am))
0xF6 (Sept 2nd 246th day this year - including leap)
0x00 (carry bit for days 256-365(6)  1 = Day Byte + 255)
0x04 (For Tues assuming bit flags == the day  1=Sun, 2=Mon, 4=Tues, 8=Wed, 16=Thurs, 32=Fri, 64=Sat)
0x67 (Bit settings based on House Code A + Reserved = 0, Timer Purge = 1, Batt Clear = 1, Monitor Stat Clear = 1  [Binary 01100111])

So I would basically send the above sequence of 8 bytes to set the time for House Code A, and do you have to repeat that for House Codes B-P?

Thanks for the assistance.

Logged

Charles Sullivan

  • Hero Member
  • *****
  • Helpful Post Rating: 94
  • Posts: 1565
    • HEYU - X10 Automation for Linux, Unix, and Mac OSX
Re: Code 0xA5 (165) question..
« Reply #3 on: September 02, 2008, 10:02:28 PM »

Thanks for the updated docs.  I am sure they will help with writing the interface.

Although I am still curious about the house code...

Are there multiple clocks to be set up for each house code?  eg A-P?  Do I have to set the clock for every house code?    If I read your message right it would seem to be the case. 
No, there's only one clock.  The CM11A internal registers can store the state for only a single housecode.  The CM11A can receive signals from all housecodes but except for the monitored housecode these have to be processed by your PC when received.

Quote
So if I wanted to set the clock for house code A, and the time and date are : Tues Sept 2 2008 : 10:15:33am I'd be looking at something like :

Sending the characters representing:
0x9b     
0x21  (33 seconds)
0x0f  (15 min, why does it say up to 119 min?)
0x0A (10 hour (am))
Byte 3 is the hours/2 ( = 5 ) and byte 2 is the remainder minutes ( = 15 min).  (If the time were to be 11:15:33AM, Byte 3 would be 5 and byte 2 would be 75 min.)

Quote
0xF6 (Sept 2nd 246th day this year - including leap)
The day count starts with Jan 1 = 0, so Sep 2, 2008 would be day 245.

Quote
0x00 (carry bit for days 256-365(6)  1 = Day Byte + 255)
0x04 (For Tues assuming bit flags == the day  1=Sun, 2=Mon, 4=Tues, 8=Wed, 16=Thurs, 32=Fri, 64=Sat)
There's only one byte here.  The MSB of the day count is the high bit in the weekday bitmap byte.

Quote
0x67 (Bit settings based on House Code A + Reserved = 0, Timer Purge = 1, Batt Clear = 1, Monitor Stat Clear = 1  [Binary 01100111])
That's correct.

Quote
So I would basically send the above sequence of 8 bytes to set the time for House Code A, and do you have to repeat that for House Codes B-P?
No, there's only one clock, as described above.  And there are only 7 bytes to send.

The CM11A will respond by returning the 8-bit checksum of bytes 1 through 6.  You should then send 0x00 and wait for the CM11A to respond with 0x55 before sending further commands.

Logged
Yesterday it worked.
Today it doesn't work.
X10 on Windows is like that.

HEYU - X10 Automation for Linux, Unix, and Mac OS X     http://www.heyu.org
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.