Converts a string (float single precision) in decimal

Hello

I use reading series base and write vi to communicate with a device.  The answer I receive (shown in hexadecimal format) is 4606 8D3B, which from what I understand (this discussion: http://forums.ni.com/t5/LabVIEW/string-to-number-conversion-a-very-interesting-observation/m-p/32170... ) the data is not actually hexadecimal but rather binary and appears just hex for the user.

My camera manual says that this information is "Float - 4-byte ANSII standard simple precision, low to high" and I'm trying to convert this string to a decimal value.  (it should be 0.004 or e-3 xx 4)  So far I've written a program that separates the bytes in a table of 4 bytes, each binary converts and then separate all binary bits and try to group return the binary bits in the exponent and the mantissa to calculate the value, but it seems rather convoluted and I hope that there is a more simple function in that all this is done automatically.  Also, since the answer is low to high, I understand that I must first return the number of 3B8D 0646 make high to low, but I think I did that already, it's just the conversion that I do not know how.

Any help would be appreciated, thanks

Alex

Try this:

Tags: NI Software

Similar Questions

  • Convert the hexadecimal string of Little Endian floating-point single precision

    I made a lot of tinkering and research, but despite all the very similar examples, I found, I think that I am limited by my lack of knowledge in programming. I gives me values such as 0000c 641 I need to convert to 41C60000 who must convert single precision IEEE754 to 24.75 as a standard 32-bit float. I saw very similar examples with boxing and unboxing conversions, but I simply can't understand it. Thank you.

    OK, so if you have actual letters coming, there are a few ways that you can do. You can basically change the string in order to get in order waiting for LabVIEW. Otherwise, you can do the same using data manipulation functions:

  • Will I lose data conversion to double precision single-precision float?

    Before you say Yes...

    I use a crio unit in scan mode interface. Which returns the mode of scanning values in floating point double precision. Apparently I'm supposed to be able to choose between double precision fixed-point ("not calibrated") and ("calibrated") floating point data, but this feature seems to be exclusive to the fpga interface and is not available with the scan engine. The two data types are 64 bits per value, when it comes to the size on disk, anyway is still basically the same.

    The system continuously records 13 channels of comma floating double-precision at 200 Hz. using the binary file write, I measured it is about 92 MB/hr on the disk. (more than 120 MB/hr with PDM and much more to write on the worksheet) In short, this 92 mb/hr rate is just too much data on the disk on this system.

    The modules that I record since, 9236 9237 and 9215 c-series modules, have 24-bit a/d converters or less. Does this mean that I have not need 64-bit to represent the number and accuracy even?

    Can I force/cast point values double-precision floating that I receive of the variables of e/s scan engine to the data type of a different, smaller, as a single-precision floating point and retain the same precision?

    Nickerbocker wrote:
    between noise and precision equipment, I doubt that it makes much difference.

    You can test it by looking at the difference between a DBL and converted to SGL DBL. But I support the Nickerbocker trick. I don't think it will make the difference

  • How to convert the string to a full decimal point and left shift

    Hey guys I tried to convert gps string to an integer, like this

    A string that is 2467.8976 and I need to convert it to a similar integer as point of this 2467.8979 so that I can shift the decimal point to the left (24.678979) which i coudnt do it with the chain. It's just been my 2 weeks with the labview so be gentle. Thank you

    Hi Awais07,

    Once you have created an indicator that signals the output of parsing the string, right-click on this indicator > display... Format > increase the value of the digit 9

    Kind regards

    Lennard.C

  • Convert the string with number of floats a number

    How to convert the string as "- 8.9E - 03" to a number of TestStand?

    Thanks in advance

    Hello

    Try to use the Val() function

    In the expression, it looks like this

    People of the country

    .nValue = val (Locals.strValue)

    Locals.nValue = Val("-8.9E-03")

    Hope this helps

    Jürgen

  • single-precision changes constant value

    See attached 'vi '. If I set a digital double precision on my schematic, change it to SINGLE-precision, then enter the valeur.001 inside, he adds values to the right of the decimal point. Why would he do that? I'm using Labview 2011 SP1.

    Display telephone and take just a guess.

    The accuracy is defined in bits and a lot of fractional values is not a translation exact decimal.

    For example 0.001 cannot be represented exactly in the sgl or dbl.

    This is inherent to the representation of floating point and not language-specific. You simply download the closest value possible. Assign the DBL and change the format to display 20 decimal digits. Same difference.

  • Convert unsigned to float IEEE integer

    Hello

    Is there a conversion in CVI function that would turn 2 at IEEE loat unsigned integers?

    for example:

    1st value MSB: 50588

    2nd LSB value: 16425

    Actual reading:-5000.02

    Thank you.

    AMT

    You just need to do some pointer manipulation to build your float.

    But we must be aware of the size of the data types you are using.  Based on the values in your example, it seems that you're using single-precision IEEE, which is 4 bytes.  In 32-bit operating systems, the unsignedInt has also 4 bytes.  So you cannot combine two unsignedInt in IEEE single without their casting as short ints, which are the 2 bytes of each.  You should check if your unsignedInt value will fit in a short unsigned before castant.

    You can play with the sizeof() function to see data type sizes on which platform you use.

    Here are a few lines of code the combine your examples of values to produce the desired result.

    #include
    #include
    main()
    {
    allocate shared myFloat (in single precision IEEE)
    float myFloat;
     
    create pointers to those two words in the format single-precision IEEE
    not signed short * pMSW, * pLSW;
     
    move the pointers to the first and second word in your tank
    pLSW = (unsigned short *) & myFloat;
    pMSW = pLSW + 1;
     
    initialize the values of Word
    * = 50588 pMSW;
    * pLSW = 16425;
     
    Print everything
    printf ("DSM: % d\tLSW: Single %d\tIEEE: %f\n", * pMSW, * pLSW, myFloat);
     
    wait for a response
    printf ("Press any key to continue...\n");
    GetKey();
     
    }

    Here is a link to a discussion on the other way, that has a sample program and links for more information IEEE format.

    http://forums.NI.com/T5/LabWindows-CVI/how-to-convert-a-number-to-32-bit-binary-or-hex/m-p/977159#M4...

  • Converts a string to a 32 long

    Hello, how to convert a string in the form of a figure with its real numerical value to format long32.

    Please see the attachment.

    Nevica

    There is a function "decimal string.

  • Why overlays take much longer on grayscale images single precision

    Hello

    I came across a rather curious problem. In a Visual inspection machine, we create 8-bit 16MPixel images. These are then calculated in single precision images. After processing the image display us certain types of images of result to the user. Here, the user can use the mouse on the image display and gets a reading of the current image of the sector where the mouse is currently positioned. If the image is RGB or U8, fine.

    However, if the display holds one of the 32-bit grayscale images things become quite slow, by a factor of 5 to 10 about. Now I can see that 32-bit is quite a bit more than 8 bits, so I guess an increase in lap by a maximum factor of 4 times.

    Since the images are large enough, an update takes about 90-100 ms with the 32-bit image, while the same action requires little more than 10 to 20 ms with U8 and same RGB. Because the movement of the mouse is caught by a structure of the event, all movements are processed and finally the tail to cause a blockage of the software that all these events are processed. This leads to ridiculously long 'freeze' time in the software, sometimes as long as 20 sec, as I saw through a log of the events has been implemented for this purpose.

    Attached is an example of code that shows the unusually long processing time for overlays on SGL-images. If there is any suggestion, I would be happy to read them. Thanks in advance.

    Falk

    After in-depth discussions with German support NOR we have understood that it is not primarily the recovery action that consumes time, but rather my screen image update after each action of the event. As my goal was to provide the user with the most recent image information available as close to the position of the mouse as possible there is no another way to do it without compromising the goal that I have explained.

    Several alternative ideas, we had (some don't work well) are briefly explained below:

    1. Use the property of the band of the art instead of creating an overlay

      • PRO: ultra fast response because no update of the display image is needed, easy to implement
      • Cons: Stationary, takes advanced band rest a while to appear, requires the user to stay in the same place on the screen for a while, the band faded unpredictable (in my test) and reappears only after leaving and returning to the display picture more keep the mouse pointer for a few seconds
    2. Use an extra (classic style) indicator string to display the desired text in the desired position
      • PRO: also very fast
      • CON: kind of hassle to the code, because it implies the correct calculation of the desired position of the channel indicator using the position of the window of the façade, the image appears indicator and the position of the mouse. Actually not hard I know, but nothing that see you with your mind on your dinner... You'll need a bunch of different reference types here to acquire the position necessary to window VI, indicator to display Image and mouse properties
    3. As 2 but without moving the indicator
      • PRO: fast and easy to implement
      • CON: not as easy to use since the indicator is stationary somewhere around the display of images and not at the mouse position.
    4. copy/typecast image SGL U8 image and move forward with overlays
      • PRO: the response is improved to the level that I used
      • CON: 'problem' with the update of the display image remains and therefore increases the response time the picture gets
    5. Use the property of the information string Image instead of creating an overlay
      • PRO: would be faster than 1., since no required update picture
      • k.o. - CON: property seems to be Read-Only, so no changes defined by the user of the text is possible

    I guess my choice will be 2.

    If anyone has other ideas on this subject, I will be always happy to hear about them.

  • Writing to spread sheets with more than single precision

    Hello world

    Care im registration data using writing to propagate VI Labview 8.

    It records in single precision, which is a problem for me because I need a bigger

    precision.

    Are there ways to get around this problem?

    Thank you

    The entry in the File.vi worksheet has an entry for the Format string. The default value is "%.3f' that will give you less than single-precision.  Change to what you need.  Read the detailed help for more information about Format strings.

    Lynn

  • string floating-point conversion issues

    Dear reader,

    System:
    Windows 2000 with Labview 8.0 update 8.0.1

    I'm having problems converting a string to a variable number to decimal. The string I want to convert is "+ 000.41". If I feed this string to a string for the object Number Fract/Exp the result is 0. I found it a little strange so I check to another computer and the result was 0.41. The only differentses between systems was version 8.0 and 8.0.1 and the opperating system windows 2000 and Xp. So I run an update to update the version of 8.0.1, but that didn't work.
    Now I am stuck and don't know where to look for a solution. So can you help me?

    Kind regards

    K. Zwetsloot


  • Converts a string with period in full

    Hello, I am easily able to convert the string "24233" in full, but I am unable to convert '2313.213123' in full why? How can I make the parser recognize the period as a decimal?

    Thank you

    Noah NAKED

    Hey noahnu,

    I tried to do what you said and it worked fine on my end. Here is the code that I tested with:

    var txt:String = "2313.213123";
    
    var num:int = parseInt(txt);
    
    trace(num); // traces 2313
    

    are you trying to keep the decimal value as well? If so, try rather using the number object:

    var txt:String = "2313.213123";
    
    var num:Number = Number(txt);
    
    trace(num); // traces 2313.213123
    

    hope that helps. Good luck!

  • convert the money data type in a decimal format 2.

    What is the best way to convert the money data type in a decimal 2 format in ms sql 2005 for use in my applications.

    This?

    CAST (tr.depositReceivedAmount AS decimal (10, 2))

    I respectfully disagree with the idea that you must change the query column a type of 'money' data to something else.

    In most database servers, "«argent» Silver" is a data type that is designed to provide a very homogeneous behaviour with regard to the arithmetic accuracy.  In Microsoft Access, the representation is a the whole scale.  MS SQL Server, it is obviously similar.  Ditto Oracle and others.

    You like that the money data type in the database for this clarification, because "hell has no fury like an accountant looking for a bad penny."   The column of database storage formats are designed to satisfy the accountants, and it's a good thing.

    Meanwhile, you also want to take care as to exactly how you are dealing with values.  There are several points where the district could take place.  You don't have available the strongest possible manipulation of the floating of the data types in ColdFusion.  You also are somewhat at the mercy of any interface software can be between you and that SQL server, you can use.  "It is correct to all about values , but not several times."

    I suggest to round the value just before the display and user input must be two decimals.

    Then, you may need to do some things at the end of SQL server.  For example, when you update a value in the table, you may need to use logical server to explicitly truncate the value to two decimal places, as well as an update of "$ 34,56" explicitly updates the column "$34,5600.."  (This kind of thing should happen in the context of SQL Server).  You know that the user entry has exactly two significant digits, but maybe (maybe not...)! SQL server may not know this.  You want to ensure that the stored server internally represents exactly two digits, when the origin of a user input value.

    Do not err on the side of "convenience" or "which seems." good on the screen  (If you do, get ready get telephone communications of the accountants, always at inappropriate times of the night.)

  • Converts a string fragment file values

    Function wich use to convert the string fragment values?

    I have this string in the file:

    Instrument: NOR-DAQ; Date: 01-10-2008;
    Quantity: voltage [V];
    Results: 1.23,3.45,5.65,6.89,...;

    And I need to values - 1.23,3.45,5.65,6.89

    Hi crisdragon,

    You must use the native LabVIEW file and the string API.

    I gave you an example.

    Hope this helps.

  • convert a string to a path

    I want to assign a value to a global variable of the station (type: number) to the local variable (type: number).

    The problem is, that knowledge straight from the global variable of the station at the time of execution.

    I have a string like "StationGlobals.PARAMETER.SWITCH.xx.nRESISTOR_VALUE" - the characters 'xx' variable will be replaced when running...

    Now I want to convert this string to a path variable to assign to the local variable (type: number) the value of the global variable of the station (type: number)

    Do you know how I can do?

    Greetz

    Jonathan K.

    Try

    Locals.nCurrentResistorValue = Evaluate (Locals.sFunctionPath)

Maybe you are looking for