Results 1 to 40 of 86

Thread: [RESOLVED] No Mscomm receive USB 16 Channel Relay Module - RS232 Controlled

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    651

    Resolved [RESOLVED] No Mscomm receive USB 16 Channel Relay Module - RS232 Controlled

    This will be a tough one.
    Mainly due to the fact not many people have this hardware

    http://cgi.ebay.ca/ws/eBayISAPI.dll?...m=180537743599

    I have made a simple app to control relays, this part works,
    sending 01+// turns relay 1 ON 01-// turns relay 1 OFF

    my problems is sending
    ask// should send me a 2 byte reply
    Example:

    * answer 1: 00 -> relays from 1 to 16 are OFF.
    * answer 2: 255(dec) 255(dec) -> relays from 1 to 16 are ON.
    * answer 3: 81(dec) 81(dec) -> Relays 1,8,9,16 - ON, the rest are OFF.
    But no matter what I try I can not get the reply.

    I attach my app, hopefully (probably) a simple error I have overlooked.

    Code is a bit messy as I have been cutting and chopping to get it too work.

    here is the info on commands (from the ebay page)
    Code:
        * Communication parameters - 8 Data, 1 Stop, No Parity, Baud Rate - 9600 bps
        * Command for receiving the relays status:
              o Send "ask//".
              o The answer is two bytes - byte 1 and byte 2. Byte 1 represents relays from 1 to 8. MSB of byte 1 is Relay 1 and LSB of byte 1 is Relay 8. Byte 2 represents relays from 9 to 16. MSB of byte 2 is Relay 10 and LSB of byte 2 is Relay 16.
              o Example:
                    + answer 1: 00 -> relays from 1 to 16 are OFF.
                    + answer 2: 255(dec) 255(dec) -> relays from 1 to 16 are ON.
                    + answer 3: 81(dec) 81(dec) -> Relays 1,8,9,16 - ON, the rest are OFF.
        * Commands for single relay setting:
              o "01+//" - Relay 1 is switched ON
              o "01-//" - Relay 1 is switched OFF
              o "02+//" - Relay 2 is switched ON
              o "02-//" - Relay 2 is switched OFF
              o ......
              o ......
              o "16+//" - Relay 16 is switched ON
              o "16-//" - Relay 16 is switched OFF
        * Commands for all relays setting:
              o "on//" - All relays are switched ON
              o "off//" - All relays are switched OFF
        * Command for many relays setting
          Send sequentially:
          "x" - as a char
          a - as HEX number. a[0;FF]. This number correspondends with relays from 1 to 8. The MSB is relay 1.
          b - as HEX number. b[0;FF]. This number correspondends with relays from 9 to 16. The MSB is relay 9.
          "/" - as a char. This is the first part of the delimiter
          "/" - as a char. This is the second part of the delimiter
          Example (a=1A(hex) and b= 05(hex) )
          "x" 1A 05 "/" "/"
          1A(hex)=00011010(bin)
          05(hex)=00000101(bin)
          Relays 1,2,3,6,8,9,10,11,12,13,15 - switched OFF
          Relays 4,5,7,14,16 - switched ON
    
          Note that there must be minimum 5ms interval between each two commands !
    Any thing I missed please ask.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width