03-05-2009 08:52 AM
Hi,
I'm trying to read out the actual values of a MKS PR4000B pressure sensor. I managed to get a connection and read/write data to the device (using serial read/write), but I'm having trouble to convert the read output to a single.
The manual tells me the floating number is conform to IEEE 754, the response I get are 8 bytes: @head, actual value.byte3, actual value.byte2, 0x00, @head, actual value.byte1, actual value.byte0, 0x00
I would like to do a cast type to convert it (like in: http://forums.ni.com/ni/board/message?board.id=170&thread.id=195115&view=by_date_ascending&page=1), but never seem to get the right results.
HO\@ps@ should translate to something like 01.903
any ideas?
03-05-2009 08:59 AM
What have you done so far?
If you're using serial read/write that means you're getting a string. There are 2 solutions:
03-05-2009 08:59 AM - edited 03-05-2009 09:01 AM
Perhaps you can post the code you have so far?
What is @head? Some sort of header byte?
If so, why are the 4 bytes separated into two groups with a header and a 00 hex byte?
Perhaps you aren't stripping the correct bytes out of the string you got before feeding them into the typecast function.
Please post some actual byte data that your receive from the sensor (such as a string indicator set for hex display.) The 8 characters you listed, none of them are 00 hex. But I don't know that 00 hex would show up at all on a webpage. That's why a VI with the data saved in a control, indicator or constant would be better.
03-05-2009 11:48 AM - edited 03-05-2009 11:50 AM
Here is a VI that converts your string into a Single .
03-05-2009 12:00 PM