Page 1 of 1
Ascii sequence
Posted: Sun Dec 03, 2006 4:17 pm
by Pedromlo
Hi,
I have a device that i need to send Chr(254) + Chr(10) + Chr(1) + Chr(x).
When x > 0, it works fine.
When x = 0, it does not work fine.
I´m using a script that runs every second and reads some variables and at a certain time x = 0 that points to the first address of the device.
The harware as only one command - %1%.
( I think i read on some post that Housebot does not 'like' 0 to be sent to serial)
Can anyone help me on this.
Thanks
Regards
Posted: Sun Dec 03, 2006 8:39 pm
by ScottBot
The '0' character is used internally as a termination character for all of the alpha-numeric property values, so it will result in the command end marker instead of actual data.
If you are using the Generic Serial Hardware Interface (I assume you are), you can specify another value to use as 0 (null). Just set the "NULL Character Replacement" property of the Generic Serial Hardware Interface to a value that you would never use during normal operation (if there is one). I think it defaults to 255, so you could try sending Chr(255) instead of Chr(0)
Posted: Sat Dec 09, 2006 7:29 pm
by Pedromlo
Hi Scott,
I have tried your suggestion, but it did not work.
I configured othe char on the Null Replacement, i have tried to send 255 and neither worked.
I even have tried to define a char that would make another valid action on the device, but the effect was none. The command with zero did not work and the replacement char did not reach it´s destiny.
Any other suggestion for me?
Best Regards
Pedro
Posted: Sun Dec 10, 2006 9:22 pm
by ScottBot
My fault. The NULL substitution is only for receiving data, not sending it as you are trying to do. Sorry about that.
Here's what you can do:
- Create a Command in the generic serial hardware interface that is a Hex type command.
- For the Write Data value of the command, set it to %x%.
- Create a Property Value (in the device definition) with a value of '*' (just an asterisk) as one of the values in your Generic Serial Device. You can create a new property (like Send Data) or add it to an existing one.
- Assign the asterisk value to the command in the hardware interface you just created.
- In your script, if you send something like "010005", it will send those exact values in hex form (so the second byte would be 00 which is what you are trying to do.)
Hope this makes sense.