Please login or register.

Login with username, password and session length
Advanced search  

News:

The X10Hub (PiX10Hub) is here! Created by the Community, for the Community.:)% #:)

Author Topic: CM11a with VB 2005  (Read 26948 times)

Stevena

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 7
CM11a with VB 2005
« on: February 18, 2007, 06:06:12 PM »

I am a novice programmer and am trying to send commands to the cm11a. I can send commands and get it to respond but I'm sure I am sending the addresses and command incorrectly because modules aren't triggered. I don't understand the protocol or how to use it with VB. Can someone provide me with a sample code for this. A simple sample should make it clear to me.

Thanks
Logged

Brian H

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 288
  • Posts: 12639
Re: CM11a with VB 2005
« Reply #1 on: February 19, 2007, 12:16:05 PM »

Have you downloaded the CM11 protocol information from the X10 web site as a start?
Logged

Stevena

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 7
Re: CM11a with VB 2005
« Reply #2 on: February 22, 2007, 01:01:08 PM »

Yes, I have it but I don't quite understand it. How do you get from 01100110 to 0x04,0x66 for A1. Do you send that as a string? I get back 165 or A6 in hex
Logged

Charles Sullivan

  • Hero Member
  • *****
  • Helpful Post Rating: 93
  • Posts: 1565
    • HEYU - X10 Automation for Linux, Unix, and Mac OSX
Re: CM11a with VB 2005
« Reply #3 on: February 22, 2007, 05:21:54 PM »

Yes, I have it but I don't quite understand it. How do you get from 01100110 to 0x04,0x66 for A1. Do you send that as a string? I get back 165 or A6 in hex

I don't do VB so can't give programming instructions.  But the 01100110 is the address byte, 0x66, for A1.  The 0x04 is the "header" byte which tells the CM11A the following byte is an address like A1 rather than a function like A-On.

You would write this to the CM11A as a string of two pure binary bytes, i.e., (04)(66).  You should then read back from the CM11A a binary byte representing the 8-bit checksum of the bytes you wrote, i.e. (0x04 + 0x66) & 0xFF  = 0x6A.

If the checksum is correct, write a single byte of 0x00 to tell the CM11A to transmit the address over the power line.  When the CM11A has successfully completed the transmission, you will read the byte 0x55 from the CM11A indicating it is ready to receive the next command, which could be another address on the same housecode or a function.

Except for Dim, Bright, and Extended Code functions, the header byte for functions is 0x06.  So that for A-On you would send the string (06)(62); for A-Off the string is (06)(63).

Good luck.


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

Stevena

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 7
Re: CM11a with VB 2005
« Reply #4 on: February 22, 2007, 07:13:47 PM »

Thanks, it's a little more clear now, I'll give it another try.
Logged

Stevena

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 7
Re: CM11a with VB 2005
« Reply #5 on: February 25, 2007, 04:15:34 PM »

Still no luck. The cm11a always sends back a string of 165.
Logged

Charles Sullivan

  • Hero Member
  • *****
  • Helpful Post Rating: 93
  • Posts: 1565
    • HEYU - X10 Automation for Linux, Unix, and Mac OSX
Re: CM11a with VB 2005
« Reply #6 on: February 25, 2007, 05:13:26 PM »

Still no luck. The cm11a always sends back a string of 165.

Ahah!  You had me confused there for a while.  165 = 0xA5, not 0xA6.

When the CM11A is first powered up, or if there's any momentary interruption of AC power, it will poll the PC with a continuous stream of 0xA5 once a second, which is its request for a clock update from the PC.   Until that request is satisfied it will accept no other commands.

You can satisfy this request by sending a single byte of 0x9B and waiting for a second or so.  This doesn't set the clock but will stop the polling.  Once you've gotten in a little deeper you can work up the VB code for actually setting the clock (per section 8 of the X10 protocol document).

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

Stevena

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 7
Re: CM11a with VB 2005
« Reply #7 on: March 01, 2007, 01:29:47 AM »

Thanks Charles, I'll see if this gets me a little farther.
Logged

Stevena

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 7
Re: CM11a with VB 2005
« Reply #8 on: March 01, 2007, 01:55:32 AM »

Ok maybe I don't understand. How exactly do I send 9B. I've been trying to send the 04 and 66 in two seperate string pairs. I'm sure I'm doing this wrong too.
Logged

Charles Sullivan

  • Hero Member
  • *****
  • Helpful Post Rating: 93
  • Posts: 1565
    • HEYU - X10 Automation for Linux, Unix, and Mac OSX
Re: CM11a with VB 2005
« Reply #9 on: March 01, 2007, 08:23:39 AM »

Ok maybe I don't understand. How exactly do I send 9B. I've been trying to send the 04 and 66 in two seperate string pairs. I'm sure I'm doing this wrong too.

This is a Visual Basic  programming question and I have no knowledge whatsoever of that language.  Sorry.

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

pegas

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 1
Re: CM11a with VB 2005
« Reply #10 on: March 07, 2007, 12:01:03 AM »

If you still need to see how to handle hexa vanues in VB, post the code snippet here, I might be able to fix it. ;D
Logged
 

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