Developing my own X10 Controller Software

Started by sarahlj16, February 10, 2010, 10:19:31 AM

Previous topic - Next topic

Charles Sullivan


It's possible that sending the 0x9b to stop the 0xa5 poll isn't sufficient if the CM11A clock isn't already set to a valid (although incorrect) date and time.

Let's try sending a valid time update:
  send  0x9b 0x2e 0x06 0x09 0x3e 0x01 0x00   (7 bytes, representing Sunday, Day 062, 18:06:46 - see protocol section 8)
  read back checksum  (0x7c - the sum of the 6 bytes following the 0x9b)
  send 0x00
  read back 0x55

Then try sending your commands again.

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

halju

im getting the check sum 0x7c but still not getting the 0x55 after i send 0x00  B:(

Charles Sullivan

Quote from: halju on February 21, 2010, 07:42:13 PM
im getting the check sum 0x7c but still not getting the 0x55 after i send 0x00  B:(

When you;
   send 0x04,0x66
   receive 0x6a
   send 0x00

The 0x55 won't be returned until after the X10 transmission is completed, which will take about 0.7 seconds.  Your read function may be timing out before then.  If your read function is not a blocking read (i.e., it sits and waits for a byte to be available) with an adjustable timeout, try reading up to 10 times with a 0.1 second delay between tries.
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

halju

I'll extend the read time. What about sending the 0x00? Is there a time i should wait in between reading the checksum?
Like you said send the 0x9b then wait about 1-2 seconds
then send 0x04 0x66 and i receive the 0x6a about 1-2 milliseconds later
what is the time guidelines i should use when sending the 0x00? I'm using a homemade program similar to hyper-terminal, I almost think I'm not sending the 0x00 fast enough. it usually takes me 2-3 seconds to send the 0x00. is this to long?

also thanks for all your help so far, i really appreciate it

pconroy

The other thing you can do - I think - is loop a few times.

Send an 0x00.
Wait for an 0x55.
If you don't get it - sleep a smidge (or delay) and then loop again.

Make sure you code a loop exit...  :)


Also - if you're just trying to get things working - go ahead and put some lengthy delays in your code. Sleep a second or two.
Once you're happy your sending the right bytes, calculating the checksums, etc - then you can start trimming them down.

That's what I'd do.


I don't know if you can do this in your programming language - but I found it easier (for me at least) to dedicate a thread to servicing the port.
Input is thrown into a circular buffer as it comes in.  My other threads can pick it out at their leisure.  I really did this because my Powerlinc serial controller seems fond of sending garbage and I was tired of weeding thru it.  It's made my CM11A stuff easier, for me at least.

Just a thought.

halju

Thank you everyone!!!! i was able to get it working!
thanks!!

Charles Sullivan

Quote from: halju on February 22, 2010, 09:26:59 PM
Thank you everyone!!!! i was able to get it working!
thanks!!

:)%
Please enlighten us as to what you did differently to get it working.
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

SMF spam blocked by CleanTalk