Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Reading the response of a component using rs-232c

  1. #1
    Join Date
    Nov 2004
    Posts
    52

    Default Reading the response of a component using rs-232c

    Hello,
    I'm using the serial plugin to talk to my Yamaha RX-V2500 receiver. I am using the .gml file that Kraven has posted on these boards and I can send commands to the receiver. The receiver is spitting a long hex string back to me and I would like to decipher it but don't know where to begin to do this.

    An example of the end result I'm looking for is, say I send the 'volume up' command to the receiver, I want the receiver to spit back the value of the volume to me so I can post it in my NetRemote app.

    If someone could point me in the right direction, I'd appreciate it.

    Thanks,
    Eric
    Eric Mooney

  2. #2
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Eric, you will have to convert the hex string to characters.

    The string will be in pld1 or pld2 (can't remember).

    You will us lua to convert this to character data

    try something like

    x = tonumber (pld1,16)

    print (x)

    this converts hex to decimal and might be a starting point.

  3. #3
    Join Date
    Aug 2005
    Posts
    178

    Default

    Go to the generic serial plug in and check the receive settings. With my denon receiver, some of the receive settings in the .ini file I got here weren't correct for my model. Sending commands worked fine, but all I received was long strings of hex charecters. I forget what I had to do- uncheck hex->bin or something like that, but it was a minor change and it solved everything. Have you checked out Mike's file for the Yamaha RXV1000 in the downloads section? Importing the .ini file for serial settings may solve your problem. HTH

  4. #4
    Join Date
    Nov 2004
    Posts
    52

    Default

    FTD,
    Sorry, I should have explained what I was getting back a little better. I originally had the bin-->hex checkbox selected and I was getting a response that looked something like this:
    0230303300020302033300 and so on

    now with the bin-->hex unchecked I'm getting:
    |301400||002105||001201|| and so on.

    Are you saying that one of these settings in the 'receive' edit window would give me readable text or it would give me back a format that would be pretty easy to translate to english? That would be sweet if it gave me english. The only type of translate option in this window is the bin-->hex checkbox.

    Maybe there is a config setting I have set on the receiver to tell it to send in a particular format? dunno just guessing.
    Eric Mooney

  5. #5
    Join Date
    Aug 2005
    Posts
    178

    Default

    I'm not sure if it will be quite that simple, but I think if you compare the response recieved for a given command you'll find a pattern. Have you looked at the serial protocol for your receiver? You can find it here: http://www.yamaha.com/yec/customer/c..._RS232C_ST.pdf It looks like there are 4 fields that you'll be looking for. It also looks like 2 of those will be text, so if you're not seing any text it may be that some translation needs to be done. Can you post the response you receive to Power On, Power Off, Source->CD and Source->TV commands? (responses with bin-> hex both checked and unchecked) I'll help however I can but with the disclaimer that I'm very novice to this :wink: If we can find a "string a" for each "command b" you can write a script to catch and translate the feedback received.

  6. #6
    Join Date
    Nov 2004
    Posts
    52

    Default

    Hey FTD,
    Thanks for helping me with this. I do have the rs-232c docs for my receiver but quickly admit that I am a newbie to the protocol. OK, here's what I have:
    ____________________________________
    With bin-->hex unchecked:
    power On =
    21:44:39.500 EVENT: Dev: 202 3F000000
    21:44:40.218 EVENT: Dev: 140 YamahaRX: 300001 Pld1: 300001 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 02 33 30 30 30 30 31 03
    21:44:41.968 EVENT: Dev: 140 YamahaRX: 002001R0178F8B@E01900011000509E7710131403001010 00000010200010028282828282828282828000000141400000 00405501000001112010000000000000000000000010507700 00201001 Pld1: 002001R0178F8B@E01900011000509E7710131403001010 00000010200010028282828282828282828000000141400000 00405501000001112010000000000000000000000010507700 00201001 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 02 30 30 32 30 30 31 03 ...
    21:44:43.125 EVENT: Dev: 140 YamahaRX: 303601303C01 Pld1: 303601303C01 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 02 33 30 33 36 30 31 03 ...

    power Off =
    21:49:43.968 EVENT: Dev: 202 3F000000
    21:49:45.109 EVENT: Dev: 140 YamahaRX: 00B000002000R0178F09@E0190000B0 Pld1: 00B000002000R0178F09@E0190000B0 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 02 30 30 42 30 30 30 03 ...

    source : TV =
    22:22:25.468 EVENT: Dev: 202 3F000000
    22:22:27.593 EVENT: Dev: 140 YamahaRX: 3014000021073010013011003012003013000 022000028A1 Pld1: 3014000021073010013011003012003013000 022000028A1 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 02 33 30 31 34 30 30 03 ...

    source : CD =
    22:23:08.484 EVENT: Dev: 202 3F000000
    22:23:10.640 EVENT: Dev: 140 YamahaRX: 3014000021013010013011003012003013000 02200002810 Pld1: 3014000021013010013011003012003013000 02200002810 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 02 33 30 31 34 30 30 03 ...

    ____________________________________
    with bin --> hex checked:
    power On =
    21:52:16.328 EVENT: Dev: 202 3F000000
    21:52:17.046 EVENT: Dev: 140 YamahaRX: 0233303030303103 Pld1: 0233303030303103 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 33 33 30 33 30 ...
    21:52:18.796 EVENT: Dev: 140 YamahaRX: 02303032303031031252303137384638424045303139303030 31313030303530394537373130313331343033303031303130 30303030303031303230303031303032383238323832383238 32383238323832383238303030303030313431343030303030 30303430353530313030303030313131323031303030303030 30303030303030303030303030303030303130353037373030 303032303130303103 Pld1: 02303032303031031252303137384638424045303139303030 31313030303530394537373130313331343033303031303130 30303030303031303230303031303032383238323832383238 32383238323832383238303030303030313431343030303030 30303430353530313030303030313131323031303030303030 30303030303030303030303030303030303130353037373030 303032303130303103 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 30 33 30 33 32 ...
    21:52:19.937 EVENT: Dev: 140 YamahaRX: 02333033363031030233303343303103 Pld1: 02333033363031030233303343303103 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 33 33 30 33 33 ...

    power Off =
    21:53:00.671 EVENT: Dev: 202 3F000000
    21:53:01.812 EVENT: Dev: 140 YamahaRX: 02303042303030030230303230303003125230313738463039 404530313930303030423003 Pld1: 02303042303030030230303230303003125230313738463039 404530313930303030423003 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 30 33 30 34 32 ...

    source : TV =
    22:11:06.281 EVENT: Dev: 202 3F000000
    22:11:08.406 EVENT: Dev: 140 YamahaRX: 02333031343030030230303231303703023330313030310302 33303131303003023330313230300302333031333030030230 3032323030030230303238413103 Pld1: 02333031343030030230303231303703023330313030310302 33303131303003023330313230300302333031333030030230 3032323030030230303238413103 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 33 33 30 33 31 ...

    source : CD =
    22:19:53.750 EVENT: Dev: 202 3F000000
    22:19:55.890 EVENT: Dev: 140 YamahaRX: 02333031343030030230303231303103023330313030310302 33303131303003023330313230300302333031333030030230 3032323030030230303238313003 Pld1: 02333031343030030230303231303103023330313030310302 33303131303003023330313230300302333031333030030230 3032323030030230303238313003 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 33 33 30 33 31 ...

    This looks pretty foreign to me. I read up on Hex and Dec and Bin last night and these Hex values look more like html color values than anything else to me. I tried to find info on converting Hex to Characters but all l could find were references on Hex to Integers.

    Thanks,
    Eric
    Eric Mooney

  7. #7
    Join Date
    Aug 2005
    Posts
    178

    Default

    OK- I think I've figured out the code to look for, although I'm still trying to figure out it the rest of those long strings is relevant or not.

    In the power on response 3230 is hex for 20 which according to the protocol is the value for the report item for "power" the next value is 3031 which is hex for 01 so 32303031 is saying "power on". In the power off string you'll find 32303030 which is "power off"
    In the TV string you'll fine 32313037 which is hex for 2107 which is Source CBL\SAT (trying to trick me I was looking for 2106 source tv) In the CD string you'll find 32313031 whih amounts to source CD.
    So- pretty clearly on the right track. I'm sure there multiple ways to process this. What comes to mind is either a script in the receive section of your serial settings to "preprocess" the feedback or a script triggered by a Girder event->on serial event which watches for certain values in pld1 and assigns an appropriate value to a variable.

    I'm attaching a small .gml file which takes the second approach to watch for power on and power off commands. I assume you have the logger plugin? Import this into your existing .gml and watch the logger window for "Power On" and "Power Off" as you cycle the unit.

    I'm not sure if all the other data returned is significant for our purposed, I'll look at that later tonight. Let me know if this helps.
    Attached Files Attached Files

  8. #8
    Join Date
    Nov 2004
    Posts
    52

    Default

    After importing your script I ran the 'Power On' [32303031] and got this:
    ---------------------------------------------------------
    02:42:16.375 EVENT: Dev: 202 3F000000
    02:42:17.078 EVENT: Dev: 140 YamahaRX: 0233303030303103 Pld1: 0233303030303103 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 33 33 30 33 30 ...
    02:42:17.093 LUA: call main
    02:42:17.093 LUA: --> call C strfind global
    02:42:17.093 LUA: --> return C strfind global
    02:42:17.093 LUA: --> call C strfind global
    02:42:17.093 LUA: --> return C strfind global
    02:42:17.093 LUA: return main
    02:42:18.828 EVENT: Dev: 140 YamahaRX: 0230303230303103125230313738463842404530313930303031313030303530 39453737313031333134303330303130313030303030303031 30323030303130303238323832383238323832383238323832 38323830303030303031343134303030303030303430353530 31303030303031313132303130303030303030303030303030 30303030303030303030313035303737303030303230313030 3103 Pld1: 0230303230303103125230313738463842404530313930303031313030303530 39453737313031333134303330303130313030303030303031 303230303031303032383238323832383238323832383238323832383030 30303030313431343030303030303034303535303130303030 30313131323031303030303030303030303030303030303030 30303030303130353037373030303032303130303103 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 30 33 30 33 32 ...
    02:42:18.843 LUA: call main
    02:42:18.843 LUA: --> call C strfind global
    02:42:18.843 LUA: --> return C strfind global
    02:42:18.843 PRINT: Power On
    02:42:18.843 LUA: --> call C strfind global
    02:42:18.843 LUA: --> return C strfind global
    02:42:18.843 PRINT: Power Off
    02:42:18.843 LUA: return main
    02:42:19.984 EVENT: Dev: 140 YamahaRX: 02333033363031030233303343303103 Pld1: 02333033363031030233303343303103 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 33 33 30 33 33 ...
    02:42:19.984 LUA: call main
    02:42:19.984 LUA: --> call C strfind global
    02:42:19.984 LUA: --> return C strfind global
    02:42:19.984 LUA: --> call C strfind global
    02:42:19.984 LUA: --> return C strfind global
    02:42:19.984 LUA: return main
    ---------------------------------------------------------
    for some reason, I'm getting back 3 responses from the receiver and one of those responses has the "Power Off" Variable.

    When I run the "Power Off" [32303030] command, I get this:
    ---------------------------------------------------------
    02:45:13.750 EVENT: Dev: 202 3F000000
    02:45:14.890 EVENT: Dev: 140 YamahaRX: 02303042303030030230303230303003125230313738463039404530313930303030423003 Pld1: 02303042303030030230303230303003125230313738463039404530313930303030423003 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 30 33 30 34 32 ...
    02:45:14.890 LUA: call main
    02:45:14.890 LUA: --> call C strfind global
    02:45:14.890 LUA: --> return C strfind global
    02:45:14.890 LUA: --> call C strfind global
    02:45:14.890 LUA: --> return C strfind global
    02:45:14.890 PRINT: Power Off
    02:45:14.890 LUA: return main
    ---------------------------------------------------------
    "Power Off" seems to be running OK.


    After analysing these strings, I looked a PLD1 on each actions and took string positions 7-14 and put them into your script and came up with this:

    ---------------------------------------------------------
    Power On [30303031]:
    02:49:46.187 EVENT: Dev: 202 3F000000
    02:49:46.906 EVENT: Dev: 140 YamahaRX: 0233303030303103 Pld1: 0233303030303103 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 33 33 30 33 30 ...
    02:49:46.906 LUA: call main
    02:49:46.906 LUA: --> call C strfind global
    02:49:46.906 LUA: --> return C strfind global
    02:49:46.906 PRINT: Power On
    02:49:46.906 LUA: --> call C strfind global
    02:49:46.906 LUA: --> return C strfind global
    02:49:46.906 LUA: return main
    02:49:48.656 EVENT: Dev: 140 YamahaRX: 0230303230303103125230313738463842404530313930303031313030303530 39453737313031333134303330303130313030303030303031 30323030303130303238323832383238323832383238323832 38323830303030303031343134303030303030303430353530 31303030303031313132303130303030303030303030303030 30303030303030303030313035303737303030303230313030 3103 Pld1: 0230303230303103125230313738463842404530313930303031313030303530 39453737313031333134303330303130313030303030303031 30323030303130303238323832383238323832383238323832 38323830303030303031343134303030303030303430353530 31303030303031313132303130303030303030303030303030 30303030303030303030313035303737303030303230313030 3103 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 30 33 30 33 32 ...
    02:49:48.656 LUA: call main
    02:49:48.656 LUA: --> call C strfind global
    02:49:48.656 LUA: --> return C strfind global
    02:49:48.656 PRINT: Power On
    02:49:48.656 LUA: --> call C strfind global
    02:49:48.656 LUA: --> return C strfind global
    02:49:48.656 LUA: return main
    02:49:49.812 EVENT: Dev: 140 YamahaRX: 02333033363031030233303343303103 Pld1: 02333033363031030233303343303103 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 33 33 30 33 33 ...
    02:49:49.812 LUA: call main
    02:49:49.812 LUA: --> call C strfind global
    02:49:49.812 LUA: --> return C strfind global
    02:49:49.812 LUA: --> call C strfind global
    02:49:49.812 LUA: --> return C strfind global
    02:49:49.812 LUA: return main
    ---------------------------------------------------------

    "Power Off [42303030]"
    ---------------------------------------------------------
    02:50:58.140 EVENT: Dev: 202 3F000000
    02:50:59.281 EVENT: Dev: 140 YamahaRX: 02303042303030030230303230303003125230313738463039 404530313930303030423003 Pld1: 0230304230303003023030323030300312523031373846303940453031393030 3030423003 Pld2: Data Pld3: YamahaRX Pld4: COM1 Bin: 30 32 33 30 33 30 34 32 ...
    02:50:59.281 LUA: call main
    02:50:59.281 LUA: --> call C strfind global
    02:50:59.281 LUA: --> return C strfind global
    02:50:59.281 LUA: --> call C strfind global
    02:50:59.281 LUA: --> return C strfind global
    02:50:59.281 PRINT: Power Off
    02:50:59.281 LUA: return main
    ---------------------------------------------------------

    How are you figuring out what characters represent the 4 digit hex value? Can you point me to a website? Also, How do I know where to grab the Hex from? I know about the "02" starting and "03" ending the variable and they need to be trimmed out. I am just guessing where I should be looking for these values so where should I be looking?

    Thanks again for your time,
    Eric
    Eric Mooney

  9. #9
    Join Date
    Aug 2005
    Posts
    178

    Default

    Hmm..maybe you're misunderstanding me. Do you have a .gml file already built to control all of the functions on the receiver? I thought you were looking for a way to get feedback on events from the receiver, but maybe I misunderstood and you're trying to build a .gml to control it (we'll deal with feedback leter if that's the case)

    Do me a favor and load the .gml I sent you by itself, then cycle the power on the unit using it's remote instead of G3- see if it returnas a "Power On" and\or "Power Off" in the G3 logger.

    Where I'm getting the strings to look for is go to p 14 of the serial protocol. See RCMD0 RCMD1 RDAT0 and RDAT1? Those are the data we're looking for. So, look at the first line in the table for Playback- 6ch input. The "command group" is Playback, the "parameter" is 6ch input. The values for these are 10 and 00 respectively. So- RCMD0=1 RCMD1=0 RDAT0=0 RDAT1=1 (thus communicating 10 00 to the unit) Well, convert these to hex using this nifty utility: http://www.maths.hscripts.com/asciiHex.php and you get 31303030. This is the string to look for in pld1- when you execute a command changing the unit to 6ch input, it will respond with a string on it's serial link which (among other things) contains 31303030 as verification of the command which was executed. You can find the string to look for for all of the commands using this method.

    But:

    What are you using for the serial settings for your receiver in the Generic Serial Plugin? I have a feeling your settings are wrong in this section, and this would be a lot simpler if they were corrected. If you haven't, try downloading Mike C.'s plugin for yamaha receivers. Go to the generic serial plugin, export your current settings for the yamaha, the remove the yamaha completely from the plugin (note the com port its on). Close completely out of G3, re-launch it, go back to generic serial plugin, import the .ini file from Mike's plugin, and set it to the com port your receiver is on. Then go to G3 and see what kind of responses you're getting. If it's screwed up, you can remove the current settings and re-import your old settings. I have a feeling you'll get much clearer feed back (and hopefully more concise) from the unit- I don't see why a manufacturer would vary it's serial protocol significantly within the same line of receivers, and Mike C seems to be a real guru with this serial stuff.

  10. #10
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    great hex calc link

Posting Permissions

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