06-29-2011 09:43 AM
Hi,
I'm trying to read data from a transmitter via RS232 and DasyLab V9.00.01. The transmitter sends only HEX-values. I have got a conversion formula
to achieve the final result from this HEX-value. Therefore I'd like to work with the pure HEX-Values in DasyLab.
The HEX-String looks like this:
2C 01 81 16 F7
With the help of a format string I get the interesting HEX-values:
81 61 F7
Now I could calculate my final result, but DasyLab converts it to ASCII. So I only get:
□-÷
Which is equal to "0" as output value.
Is there any way to work with the HEX-Value alone and ignore the useless ASCII code?
Hopefully someone can help me with that.
Thanks!
06-29-2011 12:25 PM
what format string are you using?
ah?
or b, to just read the binary value of the character?
06-29-2011 03:17 PM
06-29-2011 03:24 PM
No matter which format you use, DASYLab will convert the incoming string to a floating point number.
If you use the a, then it will interpret the number literally.
If you use the ah, then it should take each character, and convert it.
so,
2C 01 81 16 F7
should be interpreted by ah as
2
12
0
1
8
1
1
6
15
7
2ah
should interpret it as
44
1
129
22
247
Once inside DASYLab, you can then operate on these numbers using the bit logic module or the formula module to do the Hex math that you need.
if you need the values all at once, then set up additional channels to read each character, so that the module will have 5 or 10 outputs. The formula works better that way.
You can visualize the interpreted data in the Digital Meter, by changing the display to Hex.
06-30-2011 04:15 AM
Thanks for your fast response!
Am I supposed to enter the format of the data at any other point than at the format string?
As I sad, my format string is:
2X 3AH.
Therefore I should already use the right format, at least I hope so. I tried also ah and 2ah as you suggested, but the interpretation (RS232 Monitor) is always:
2C 00 04 27 30 , - - ' 0
When I control the connection between the RS232 modul and my digital meter the value transferred is always "0".
Also little HEX values can't be used because they always yield a value of "-".
I'm really helpless at the moment.
06-30-2011 08:03 AM
Do you want to read the entire string as a single number?
To change the digital meter to display Hex, do this
06-30-2011 09:45 AM
Does this work?
5 channels are set to read "b" or byte
Display the value (0-255) on the list, and display the Hex value on the Digital Meter.
You should then be able to use the bit logic modules and the formula module to process your decoding.
07-04-2011 06:04 AM
That's exactly the solution I was looking for. Thanks very much for your help!