PDA

View Full Version : RS232 Serial plugin Receiving data?



Ron
October 13th, 2002, 12:55 PM
I was actually thinking of making the Eventstring available in a variable, how does that sound ?

Ron
October 13th, 2002, 12:55 PM
DARN forgot to include this one! ... building it in right now.

Ron
October 13th, 2002, 12:55 PM
Sure send them.

Mark F
October 13th, 2002, 12:55 PM
I believe so. I think the check reg commands only work for variables with names like regX so you need to use something like:
volumetheta!=4;
or
volumetheta>=volumemax;
or
(volumetheta<=volumemax) and (volumetheta>=volumemin);
as the last line of the manipulation script. Then set the TRUE (first) and FALSE (second) command values.

Mark F
October 13th, 2002, 12:55 PM
I've sent Ron a new version of the serial plugin. It has the functions described above and more.

The .zip file also has three examples or demos. Two of them (NULL Modem Demo and RPPlus Demo) include examples of parsing incoming data.

More information is in the readme.txt files.

Mark F
October 13th, 2002, 12:55 PM
Very cool, Rick.

Barco, Quadscan, Casablanca ... you've got some fun toys. :smile:

In the current Serial plugin, the data returned from a device is put into a command and sent to Girder. Other commands can be triggered by this data.

There are two problems with this in your situation. First, at the present time, there isn't a plugin that parses a command into smaller pieces so you can't trigger off of a single byte in the stream. Second, each command is limited to 249 bytes due to the shared memory buffer allocated for each plugin by Girder.

To support what you want to do, I think the serial plugin would need to parse the incoming byte stream (based on rules you provide) and send commands to Girder based on the parsed stream.

I will do this as time allows but I cannot promise anything. I don't like writing parsers and I don't know how I would present this in an intuitive user interface. Suggestions are always welcome.

By the way, I'd be happy to send the source for the serial plugin to someone else if they'd like to do this.

Mark F
October 13th, 2002, 12:55 PM
The check register command only supports numerical registers so you would need to request a response that is 4 bytes or less in size. The serial plugin doesn't place results into registers, right now.

EDIT: You changed the question as I wrote my response. :smile:

The plugin doesn't write data to a file, right now, either.

_________________
Mark F

<font size=-1>[ This Message was edited by: Mark F on 2002-01-14 02:22 ]</font>

Mark F
October 13th, 2002, 12:55 PM
The plugin takes whatever is returned and sends it to girder as a "hardware event string". This is treated the same as any other piece of hardware generating an input event. Like the keyboard or mouse or a remote control. It is the thing that you "learn" to trigger commands.

_________________
Mark F

<font size=-1>[ This Message was edited by: Mark F on 2002-01-14 02:25 ]</font>

Mark F
October 13th, 2002, 12:55 PM
There is a drop down list next ot the learn button. When you want to learn a hex byte string for a command: high-light the command, choose "Generic Serial Support" from the drop down list and press the "Learn Event" button. A dialog will be displayed and you can type in the exact string that is returned from the cass. When you press OK, the string is passed (as a hardware event string) to Girder. Alternatively, you can just press the "Learn Event" button and try to coax the correct string from the cass but this can be difficult in many situations.

Mark F
October 13th, 2002, 12:55 PM
I use the logger plugin to see what is being sent through Girder. I also use a breakout box and o-scope (external hardware) to see the RS-232 stuff.

EDIT: By the way, I just about spit out my orange juice when I read "make my system wife proof". :grin:

_________________
Mark F

<font size=-1>[ This Message was edited by: Mark F on 2002-01-14 12:33 ]</font>

Mark F
October 13th, 2002, 12:55 PM
UPDATE: I think I have the last bug figured out. I'll try to get this done by Saturday.

Mark F
October 13th, 2002, 12:55 PM
How about if I place the event string in the payload data? Then you can use the pld1 variable in an event handler/command.

Mark F
October 13th, 2002, 12:55 PM
Works for me. :smile:

Mark F
October 13th, 2002, 12:55 PM
I added this function to the current Serial Plugin version 3.0. From the readme.txt file -

:cool: Using the received event string as data
The received data is given to Girder as both the event string and as [pld1]. A
sample .GML file (serial.gml) is provided to show how to parse the received data into
Girder variables.

One warning: I have limited the received data buffer to 200 bytes for no apparent reason. :sad: If this is too small, I can expand it or make it user selectable.

Mark F
October 13th, 2002, 12:55 PM
I will work on this at home so it may take a couple of days to finish. What I want to do:

User defined sizing for received data buffer (from 30 to 1024 bytes)

Data packaged as an event -
The event string will remain the same as today (old commands will work!)
pld1= serial data or "DSR/CTS/Ring/Carrier Lost/Detect"
pld2= "Data" or "LineChange"
pld3= the name YOU assigned to the device that generated this event
pld4= the COMx name of the device that generated this event
binary stuff is the raw serial data or modem status mask

Is there more information I could package as part of the event that would make your job easier?

I have all of this coded and just need to finish testing it before letting it out. :smile:

Mark F
October 13th, 2002, 12:55 PM
No reason to be sorry. :smile:

The data returned from the Theta (Theta:01020302010fe5...etc) contains the device name you gave it and the serial data. The serial data (01020302010fe5...etc) will be in pld1. The device name (Theta) will be in pld3. The com port name will be in pld4 and pld2 will be set to the string "Data" to indicate a data event.

I would use the following variable manipulation commands to parse the fifth byte into an integer variable. Remember that each byte is 2 hex characters so byte 1 would be characters 0 and 1. Byte 2 would be characters 2 and 3 and so on so byte 5 would be characters 8 and 9.

int Byte5;
string SubStr;
SubStr = "0x"+cut(pld1,8,2);
Byte5 = strtoint(SubStr);

Using this on the string (01020302010fe5...etc) yields Byte5 = 1 and SubStr = "0x01". To get the length of a string, use the strlen() command. Extending the above example -

int Byte5;
int Length;
string SubStr;
SubStr = "0x"+cut(pld1,8,2);
Byte5 = strtoint(SubStr);
Length = strlen(SubStr);

and Length = 4.

Hopefully, this makes sense. Ron made a nice help page here (http://www.girder.nl/help/registers.php) that explains a bunch of this stuff.

Mark F
October 13th, 2002, 12:55 PM
The current plugin doesn't have all the strings. It only supports the event string (Theta:01020302010fe5...etc) in pld1. I'm planning a new release tomorrow. I'd wait for that one since the string will change between now and then.

Mark F
October 13th, 2002, 12:55 PM
The next serial plugin failed testing over night. I will try to get this out by the weekend but I have some debugging to do. :sad:

Mark F
October 13th, 2002, 12:55 PM
I answered in your other thread. :)

rickd
October 13th, 2002, 12:55 PM
Great thanks Mark one question when I isolate the string and place it into a decimal variable say "volumetheta" how do I test it's value in the same way as Check reg does?
Does it have to be done under Variable maniplantion.
Thanks Rick

rickd
October 13th, 2002, 12:55 PM
I have upgraded to the latest plugin over the holidays and my BArco and Quadscan work great I also connected my Theta Cassablancca to the Serail port and can now control that too.

The cool thing is it can return data on all settings and I can then perform functions based on the units settings or state. It can return up to 256 bytes or more of data. My question is how is this captured and stored using this plugin and how do I then check a byte in the area register or file it stores the received data in?

Mark can you help Thanks rick

rickd
October 13th, 2002, 12:55 PM
What about if I request a variable from the theta which is only 4 or 5 bytes in terms of it response could we load them into registers and then do if then via a check reg command?

Alternatively I can set it to only return a set number of bytes for status information could this be saved into a file and then loaded into registers somewhere for me to check a value and therfore perform a command based on a value?


What is the command that Girder places the data into I coulkd perhaps only be interested in one or two bytes of the data stream and maybe able to try to paly with what it returns.

<font size=-1>[ This Message was edited by: rickd on 2002-01-14 02:20 ]</font>

<font size=-1>[ This Message was edited by: rickd on 2002-01-14 02:22 ]</font>

rickd
October 13th, 2002, 12:55 PM
OOOOH I see so if I request a variable and it comes back as with all sorts of hex bytes nothing will happen until it receives a learned command.

So I could conceivably learn one or more desired received strings the Cass returns for a variable request command sent to it (ie I can specify a variable location address for it to return to Girder serial plugin) and if it matches my learned event string it would trigger the desired programed event.

So is this like learning an IR command how do you do it?

This might do me....though the status command can return the whole parameter list ...being able to write it to a file and request a byte location between 1 and 256 to be placed into register would be nice.

rickd
October 13th, 2002, 12:55 PM
Thanks I'll give it a go....is their anyway of putting a trace on what's coming out of port to check it?

Obviously gider would still need to have hold of the port too?


Thanks Mark and I have to say this plugin is primo....I have been able to solve so many issues with it to make my system wife proof


Cheers mate.

rickd
October 13th, 2002, 12:55 PM
Cheers Mark wil give it a try been on holiday will give it a try.....

rickd
October 13th, 2002, 12:55 PM
You can pretty much do anything its just a matter of getting the manual for rs232 and using the commands. I only use three commands under rs232 to the barco ....1. Select input 5, (for my Quadscan) which turns it on if it's off, 2) Select input 3 which is the HTPC and 3) the standby command for turning it off....I use Girder registrers to track the state of the projector ie if a input select has been sent then it sets reg 1 to 1 and only sends a standby ie off command if it a) receives the associated IR command for off and b) the register is 1 else it assumes it's off and aborts.

Are you using the wait command between characters as I did not have to do this with my Barco I just send the entire string. Working out the checksums fooled me for a while though.

Sounds like you have it going well what is it with an external SCSI DVD and how does that perform.

Rick

<font size=-1>[ This Message was edited by: rickd on 2002-01-28 21:37 ]</font>

rickd
October 13th, 2002, 12:55 PM
Hey Mark now we have a parser in 3.1 can we get the serial plugin to receive data to a register of some sort? So I can test variables thanks Rick

rickd
October 13th, 2002, 12:55 PM
Great I have a device (theta Cassablancca 2) which returns 250 odd bytes with every piece of status available so I will need to check certain bytes in Hex to either prevent or invoke other events. Also my Barco 808 can also provide return status via rs232.

Thanks Rick

rickd
October 13th, 2002, 12:55 PM
I note release 3.1.1 and version 3.0 of the serial port plugin is this function in there yet or am I getting ahead of you guys :smile:

<font size=-1>[ This Message was edited by: rickd on 2002-04-01 03:30 ]</font>

rickd
October 13th, 2002, 12:55 PM
Awesome Mark!!! I would like 256 at some stage but I can control the number of bytes return to either 13,64 or 256 and most of the data I am interested in is in the first 64bytes but if you get a chance having 256 or varaible length would be good thanks Rick

rickd
October 13th, 2002, 12:55 PM
Sorry will the modem event pdl4 have the data in it.

In logger pluging when I request status from my device it returns the name then data as follows Theta:01020302010fe5...etc

having that in a variable for manipulation would be good ie StringLen() volume=mid(5); then convert it to decimial.

I know these are not the actual commands but along those lines.

So an example of how you would get the length of the variable, cut out the theta or name part then extract the 5th hex number and then convert it to Decemial would be good.

Thanks Rick

rickd
October 13th, 2002, 12:55 PM
Thanks Mark that makes absolute sense....remines me of my programming days....Girder is getting awfully powerful... I'll give it a go cheers Rick

rickd
October 13th, 2002, 12:55 PM
Ok Mark I will likely not get a chance till the weekend cheers Rick

rickd
October 13th, 2002, 12:55 PM
Thanks Mark

With Ron releasing the new 3.1.2 with a payload capability on the ip event server/client I was wondering if I could receive the data on my HTPC via the new serial port plugin and take pld1 (returned string from theta) and make that the payload.

This would enable me to do the manipulation on the received data on my machine upstairs which has a keyboard and montior on it. ie I can do the GMVS stuff and programming on this machine and based on the results pass back an ip event.

if this is possible an example is nice though once I get the new version loaded I sure it will be straight forward thanks Rick :lol:

rickd
October 13th, 2002, 12:55 PM
Mark a big thanks I now have full status feedback running from the Theta and Barco so I know what input, state of power, tape loop volume everything thanks Again.

Just a small bug in ievent client or server which does not always get the event string.....seems only one way though cause when ever the theta sends serial commands the htpc always gives status to the upstairs machine. ie when ever you press a key on the theta it updates.

With all this handshaking between my machines perhaps there is a timing issue when both machines are both client and server.....anyway I'm sure Ron will nut it out. Ron if your listening I can send you text files with my event logs if it will help.

cheers rick

Mastiff
October 13th, 2002, 12:55 PM
Yo, Rickd!
I need to thank you, you helped me without even knowing it a month or so back. :smile: I bought a Barco 808 then and couldn't find out how to control it from Girder, but then I saw the way you controlled the Quadscan and tried that (multigroup with separate commands), and it worked! This also to make the system wife proof, but I can do one better! With the HTPC, an external SCSI DVD player, a macro on my Marantz RC1200 (the one that looks like a Star Trek fazer, not thetouchscreen, which I hate!) and a mini-remote (with the codes programmed into Girder) my son is able to turn on the system and play DVDs, and he's just turned six! :smile:
BTW I would like to have your sound system! I had to settle for a mid-end Onkyo 939 with Mirage OM-12s and OM-C2 in front and 595's as rear speakers. But then I've got butt shakers in the seating plattform! :wink:

Please tell me if you find a way to do more advanced operations on the Barco.

Mastiff
October 13th, 2002, 12:55 PM
No, I have no wait, I just send it. And I needed to control the whole package from Girder, since I don't want a Pronto (I hate touchscreens) and my RC1200 couldn't learn the Barco codes. And an original remote? Fugeddaboudit! X-pensive! :smile:

As for the external SCSI DVD it's on a 9 foot cable and performs just like it was in the HTPC. So the HTPC is in the storage room next to my home theater, and I can put DVDs into the little black box (an external SCSI cabinet originally built for a tape backup, painted black and stripped of the powersupply (it generated so much heat that I had to get rid of it, the fan was annoying. I've made extension power cables from the power supply in the HTPC). I like it! :smile: