PDA

View Full Version : Learning Serial Commands



abarhorst
July 13th, 2007, 06:59 AM
I have a remote that has a serial connection. I would like to attach it to a free com port and have girder monitor it for commnds. Can i go to the learn tab, select Raw:Serial and issue a command that girder will learn?? I tried this..and it didn't seem to work? I have the baud rate, ect correct becuae I can talk to the remote....I just can't see to get girder to learn and react to a serial command coming in.

Rob H
July 13th, 2007, 07:25 AM
I don't think that will work at all - you'll need to write a simple serial device that can process the input from the remote. Do you have any documentation for it?

abarhorst
July 13th, 2007, 09:58 AM
Well...since the serial part of the remote was meant to be able to control different devices, the settings can be configured. Here is how I have it configured to communicate with my reciever.

Baud: 19200
Parity 0
Data Bits 8
StopBIts 0
Flow Control N


When I send P1P1 (HEX) from the remote it looks like it send a command "50 31 51 31" to the reciever. It works, and it turns on. I would like to send this command to Girder first, through the serial port and have it trigger several other actions (dim lights, turn dvd player on, etc). at the same time. I have tried this using IR from the USB-UIRT, but there is a delay from recieving the IR and recognizing it.

After setting up a simple serial device, can I do the learing from the learn command box (just like I do for IR)? Or do serial devices have to be learned another way? If so, how does one go about this? Thanks - Andrew

Rob H
July 13th, 2007, 02:34 PM
Learning from the serial device isn't supported - it will involve using a bit of Lua.

Do you have a URL of any documentation for this device?

abarhorst
July 14th, 2007, 06:27 AM
Rob,

Here is the link to the product. It's a remote system processor similar to Crestron and AMX, but much more price attractive. If I could get this working, this would be an awesome remote to control girder. I just want to have girder monitor one of it's RS-232 outputs.

http://www.rticorp.com/products/RP6.html

It looks like CQC has a driver built for this...but I'm tied into girder at this point.

Thanks - Andrew

Rob H
July 14th, 2007, 08:17 AM
Disappointing that there's no link to any documentation of the protocol - you might want to try mailing them about that.

rpalmer68
July 14th, 2007, 03:06 PM
Disappointing that there's no link to any documentation of the protocol - you might want to try mailing them about that.

I have an RP-6 but I haven't tried using the serial side with Girder just IR with a USB-UIRT.

The serial output uses whatever baud, parity and stop bit you set it to use in the designer software and the command sent is once again what you set in the designer since the RP-6 can send anything to any serial device.

So wouldn't you just use a serial plugin that triggers an event when it gets input on the serial port? - RobH, is there a generic plugin in G4 that will do this?

As long as all the commands being sent from the RP-6 use the same serial settings and the girder plugin is set to these settings, i would have thought you could get something into Girder.

Sorry, I can't test anything right now as my system is in Sydney and I'm in New Zealand, otherwise I'd give it a shot.

Richard

Rob H
July 15th, 2007, 02:53 AM
Yes, that should work I would think.

rpalmer68
July 15th, 2007, 06:20 AM
Yes, that should work I would think.

So which plugin should be used to do this?

Richard

Rob H
July 15th, 2007, 08:56 AM
The Generic Serial plugin is fine for this. It just needs a simple serial device, something like this :-


local Super = serial.Classes.Simple
local device = Super:New({
Name = "RTI RP6",
GlobalName = "RP6",
Description = "RTI RP6 remote",

LogLevel = 0,-- change this to a higher number or false when the device is working

BaudRate = 19200,
Parity = 0,
DataBits = 8,
StopBits = 0,
FlowControl = 'N',

CallbackType = serial.CB_FIXEDLENGTH,
ReceiveFixedLength = 100,

SendStartByte = '',
SendTerminator = '',
IncompleteResponseTimeout = 100,
NoResponseTimeout = 1000,

Initialize = function(self)
if Super.Initialize(self) then
-- add your own initializations here
self.Status = 'Initialized'
return true
end
end,

ReceiveResponse = function(self, data, code)
if math.band(code, serial.INCOMPLETERESPONSE) then
gir.TriggerEvent(math.bytetohex(data), 18) -- you may want to change the 18 to another number - see the thread on TREESCRIPT DUI Page Registry
end
Super.ReceiveResponse(self, data, code) -- must call the parent's ReceiveResponse
end,

})

serial.AddDevice(device)

abarhorst
July 15th, 2007, 10:44 AM
Rpalmer,

Thanks for the additional info. You described the RP6 better than I was able to. Once the device is set up with a serial definition, Would you have to use another Lua script to monitor the incoming serial commands, or would learning be easier?

Rpalmer, how quick is the response to IR using the USB-UIRT? I have this as well, but thought that a serial connection would be much faster then IR. If the IR is plenty fast, then perhaps I don't need the serial...although I would like to figure it out. Which remote do you have?

Thanks - Andrew

rpalmer68
July 15th, 2007, 02:50 PM
Hi Andrew,

I have the old T2, been working great for quite a few years, but is now retired as I move over to Netremote.

The IR has been fine for me I never had any real response/speed issues with USB-UIRT/IR setup, in fact it was too responsive sometimes!

For the serial side of things just drop Robs code into a new file "RTI-RP6.lau" and save it into the plugins/serial directory, reset Girder and then enable it in the Girder serial plugins interface on the correct comms port.

Then the RP6 should just trigger an event in girder every time you send something assuming you have the same baud etc set in the definitions and the plugin.

Either drag these events from the log onto your action, or I guess you can also do a "learn" as well.

Hope that helps!

Richard