How to send raw hex codes over rs232 ?

Does anyone know how to send raw hex codes over a rs232 interface ?
i copied the panasonic tv over rs232 plugin and put the protocol to “raw” but i need it to send a code in hex without frontrunning code.
this has to be sent without extra characters and in hexa-decimal format: AA 5D FE 01 00 06
anyone can shed a light on this for me ?
i used :

<?xml version="1.0"?>
<implementation>
    <settings>
        <protocol>raw</protocol>
    </settings>
    <functions>
        function sendCommand(command)
            if (luup.io.write(command .. string.char(13)) == false) then
                luup.log("Cannot send command " .. command .. " communications error", 1)
                luup.set_failure(true)
                return false
            end
            return true
        end

Try sendCommand(“\aa\5d\fe\1\0\6”)

cheers, i gonna as soon as i have the time and post update :slight_smile:

didn’t seem to work. no response from the television.
im not really sure if it should be entered this way. i put the protocol to raw and send both versions of the command , one with spaces and one with the dashes but neither give any response.
the tv is locked with a pincode and im not sure if mdc is turned on or has an id between 0 and 24. according to what i understand it should response nevertheless to some common commands.
is there any way to check what is send through the rs232 device ? i.e. a raw output reader which puts everything outputted by the rs232 cable to a monitor. or can anyone help me out on how to let the vera show the response from the tv ?

reference docs :

[url=http://www.samsung.com/us/pdf/MDC_SyncMaster400PXn460PXn320PX_Protocol_Ver-17.pdf]http://www.samsung.com/us/pdf/MDC_SyncMaster400PXn460PXn320PX_Protocol_Ver-17.pdf[/url]

To turn a sequence of bytes into the required string, use [tt]string.char(…)[/tt]:
Lua 5.1 Reference Manual

eg. [tt]string.char(0xaa, 0x5d, 0xfe, 0x01, 0x00, 0x06)[/tt]

The Onkyo plugin is doing that sort of thing:
http://code.mios.com/trac/mios_onkyo-media-control/browser/trunk/I_OnkyoReceiver1.xml#L60

thanx :slight_smile:
i have a look at it

Hi Da_JoJo

It’s an old post, but i was wondering if you got this sorted out?

I have two HDMI Matrix switches with RS232 connections that need RAW codes sent to them…

well … i don’t have the samsung monitor anymore and i blew up my RS232 usb dongle , never got it to work :frowning:
from what i remember there wasn’t a way to get back the response from the other side of the cable. it was a send and hope it would work thingy.
i have no idea if mcv made any changes to the protocol for RS232 or if someone has gotten it to work though.
somehow it supposed to send raw codes, so there is a possibility it might work with the right talking to the device.
the example in first post should work.
use :
sendCommand(“\11\22\33\44\55\66”)
to send codes 11,22,33,44,55 to the rs232 device.
hope you get it work and please share ur findings.

Hi Da_JoJo

Thanks for responding…

I’m trying to see what I can get to work via this thread → http://forum.micasaverde.com/index.php/topic,8571.0.html

I’ve also seen some other interesting posts which I hope to be able to test e.g

local socket = require("socket") host = "192.168.1.222" c = assert(socket.connect(host, 9090)) c:send("cec:send A 50:04\r") c:close()

ah so it can receive the return values from another device :slight_smile:
rs-232 cables need not be longer then 5 meters preferably shorter. checked the power if it need TTL or usb voltage ? using a straight or null-modem cable ? (tx and rx swapped)
have you tried converting the hex to binary and send this ?