NI Home > Community > NI Discussion Forums
Reply
Member
Koaxial
Posts: 4
0 Kudos

HEX values in dasylab

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!

Active Participant
CJ_Butler__DASYLab_Pro
Posts: 809
0 Kudos

Re: HEX values in dasylab

what format string are you using?

 

ah?

 

or b, to just read the binary value of the character? 

 

 

- cj
Member
Koaxial
Posts: 4
0 Kudos

Re: HEX values in dasylab

The format string I use is: 2x 3ah I already tried all available data formats (a, ah, b...). The result was pretty much the same. Sad but true...
Active Participant
CJ_Butler__DASYLab_Pro
Posts: 809
0 Kudos

Re: HEX values in dasylab

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. 

 

- cj
Member
Koaxial
Posts: 4
0 Kudos

Re: HEX values in dasylab

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.

Active Participant
CJ_Butler__DASYLab_Pro
Posts: 809
0 Kudos

Re: HEX values in dasylab

Do you want to read the entire string as a single number? 

 

To change the digital meter to display Hex, do this

 



- cj
Active Participant
CJ_Butler__DASYLab_Pro
Posts: 809
0 Kudos

Re: HEX values in dasylab

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.

- cj
Member
Koaxial
Posts: 4
0 Kudos

Re: HEX values in dasylab

That's exactly the solution I was looking for. Thanks very much for your help!