Announcement

Collapse
No announcement yet.

Controlling an X10 device using DTR/RTS pins directly

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Controlling an X10 device using DTR/RTS pins directly

    Not sure if this is the best place to ask this, but can't find a whole lot of places on the web specific to my problem. I need to create a program using VC++ that uses the DTR/RTS pins directly to turn an X10 device off/on. I have the com port setup properly and can toggle the DTR/RTS pins as needed, but I am not sure if I am toggling them correctly. I am using a CM17a firecracker device. The following manaul is what I am using to go by:
    X10 - Firecracker manual

    I am kinda confused on the wait states. Do I need to set the DTR/RTS pins high(ie. 'Standby' mode) for the 'wait' states X10 lists in the timing diagram or are the wait states considered as a 'wait' done by a timer/Sleep() function?

    Here is the array I created for the header data:
    DWORD RTSH[]={ CLRRTS, SETRTS, SETRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS};
    DWORD DTRH[]={ CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR};

    16 bits plus actual wait states (SETRTS/SETDTR) are done by setting the bits high. Is this the proper way to do the 'wait'?

    Here is what I did for the header data minus the 'waits' and didn't help any(not sure which way is correct??):
    DWORD RTSH[]={ CLRRTS, SETRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, CLRRTS};
    DWORD DTRH[]={ CLRDTR, CLRDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR};

    The same method is continued for the Data segment and footer. I can not make either method work. I can assure you the RTS/DTR bits are being set in my program as indicated above in the arrays. I have hooked up a RS-232 Loopback tester that has LEDs for each pin. Stepping through the code shows the pin settings are working fine.

    What am I missing with my pin setting/clearing?

    Sorry for the long winded post and hope it wasn't too confusing. Hard to describe the problem without the examples and description of what I am doing. Just need an 'A1' X10 device to turn off and on with a CM17a using the DTR/RTS pins directly.

    Thanks for the time

    --
    DT

    #2
    The below sites may have some info. As the firecracker is powered by the serial port, you will need to have the proper pins high to keep it powered on. I've been trying to find a way to independently control the TxD, DRT, and RTS pins to be able to control relays and maybe a cmos latching chip. Not quite as easy in windows as in dos.

    http://www.ubasics.com/adam/electronics/cm17.shtml
    http://mscm17a.sourceforge.net/

    Comment


      #3
      Thanks for the links.

      Can you make the cm17a.exe file work at the
      http://www.ubasics.com/adam/electronics/cm17.shtml address?

      I have tried the code in VC++ and the .exe file from a command prompt and both ways the code executes, displays the format information for entering x10 command. Then it terminates. Never gives me the opportunity to enter a command. Terminates before then.

      The cm17a.exe program looks to be similar to the way I was attempting to do mine except they have setup their array structures a little different. If I could get this one to work and step through it to see the actual DTR/RTS arrays going out, I believe I could figure out what is wrong with my program.

      Thanks again

      --
      DT

      Comment


        #4
        Got it to work. Had a screw up in my for() loops. Was missing a bit.

        Anyway, it works now and if anybody is interested in how I did it, feel free to e-mail me or post here. It is not pretty code. Very straight forward way of doing it, but that is what the professor was wanting. [img]/infopop/emoticons/icon_smile.gif[/img] He wanted us to actually take and set/clear each necessary pin to turn something off and on.

        Thanks again zoomkat for the links. I spotted my problem from looking at the cm17a.exe program.

        --
        DT

        Comment


          #5
          Below is the code listing from the article "Control Lights, a Burgler Alarm, and Appliances Using the Computer's Serial Port" in the November Nuts&volts magazine by Ray Green. It is for GWbasic and older computers, but might be used with C or assembly. I don't know if the MS Comm module in VB would allow access to the hardware addresses. The article had the schematics for the setup, which were pretty simple. You might get some ideas from the file.

          ftp://nutsvolts.com/seriport.bas

          Comment

          Working...
          X