Send ASCII to Serial Device
-
- Senior Member
- Posts: 153
- Joined: Fri Mar 19, 2004 12:30 am
- Location: San Diego, CA
Send ASCII to Serial Device
I need to send the string ,?0800%1% as an ASCII using the Serial Plugin. It looks to me as though the device doesn't like the ASCII "?". I can send it as HEX if translate the ASCII to Hex, buI don't know how to send a 2 byte variable (i.e., "03") using %x% when sending as Hex. Any help would be appreciated.
-
- HouseBot Guru Extraordinaire
- Posts: 1121
- Joined: Tue Sep 28, 2004 7:49 am
- Location: The Netherlands
I have sent ASCII strings containing a ? lots of times. You will see a problem while sending an ASCII &. This is an outstanding BUG that will hopefully be addressed very very soon by the Meedio team!!
I also send ASCII strings like: !1MVL%1% and that also works fine.
Maybe you can start a trace to see what your true output from the serial device is, or connect another PC with a hyperterm to your HBServer to see what is received. That will usually give you some good clues about the problem!
I also send ASCII strings like: !1MVL%1% and that also works fine.
Maybe you can start a trace to see what your true output from the serial device is, or connect another PC with a hyperterm to your HBServer to see what is received. That will usually give you some good clues about the problem!
-
- Senior Member
- Posts: 153
- Joined: Fri Mar 19, 2004 12:30 am
- Location: San Diego, CA
Good call. I never set up a trace before and it worked great. It looks like my problem is that my property value sends [0-15] decimal to the serial device. How would I send an ASCII command that represents a two digit HEX value [00-0F] embedded in my command? I'm using a slider control with a range of values from 0-15 decimal.
-
- HouseBot Guru Extraordinaire
- Posts: 1121
- Joined: Tue Sep 28, 2004 7:49 am
- Location: The Netherlands
You could run a vbscript (script device) triggered by a task that tracks your slider movement. So if the slider is moved, the script will run. The script could then do a simple decimal to hex conversion and set the property from there.
Another option is to create 16 entries in your propertie and link these 16 entries to your hardware device. So the device would hold commands like ,?080000 up to ,?08000F and these will be linked to device.property, 0 - 15.
Create a property and populate it with 16 labels. Could be 0, 1, 2, .... 15 or whatever. Then link 0 to ,?080000 ..... , 15 to ,?08000F
Hope this makes sense to. It will work, just not sure how to explain it better.
Another option is to create 16 entries in your propertie and link these 16 entries to your hardware device. So the device would hold commands like ,?080000 up to ,?08000F and these will be linked to device.property, 0 - 15.
Create a property and populate it with 16 labels. Could be 0, 1, 2, .... 15 or whatever. Then link 0 to ,?080000 ..... , 15 to ,?08000F
Hope this makes sense to. It will work, just not sure how to explain it better.
-
- Senior Member
- Posts: 153
- Joined: Fri Mar 19, 2004 12:30 am
- Location: San Diego, CA
I like the VB Script idea. Haven't done VB/HB before, but I think it is within the range of my abilities. I might run into this again since my serial device uses hex for just about everything. I did think about creating 15 commands in my serial device and mapping them to property values. Either way thanks much for the input.
-
- Senior Member
- Posts: 153
- Joined: Fri Mar 19, 2004 12:30 am
- Location: San Diego, CA
-
- Senior Member
- Posts: 153
- Joined: Fri Mar 19, 2004 12:30 am
- Location: San Diego, CA
I just found this. This exact issue was addressed by MediaStorm
http://www.meedio.com/forum/about15177-0-asc-15.html
he asks
While we're on the topic of HEX, how about a checkbox or something to allow for padding HEX values? This should be very simple..
With padding enabled anything single digit (byte) would be zero padded to 2-bytes length.
IE- 0-15 would be padded as 00 - 0F
This would take care of the bulk padding need for lots of different devices and shouldn't be much to implement at all.
http://www.meedio.com/forum/about15177-0-asc-15.html
he asks
While we're on the topic of HEX, how about a checkbox or something to allow for padding HEX values? This should be very simple..
With padding enabled anything single digit (byte) would be zero padded to 2-bytes length.
IE- 0-15 would be padded as 00 - 0F
This would take care of the bulk padding need for lots of different devices and shouldn't be much to implement at all.