Floating point number using Modbus RTU DSC LV 8.2

I'm reading temperature from a Modbus conrolled device. I need to convert a temperature value (17053) read as a double type Shared Variable (SV) and convert it to ieee 754 type to show temp of 79 deg F as shown on the control front panel.
I'm using DSC module LV 8.2. I'm wondering if the conversion is already done in DSC LV 8.5???

seem to find my own answers after putting the post....
I use a typecast to single but I had to change the double to 16 bit integer for the type cast to convert correctly.... see attached png
Attachments:
ModbusSVFloat.PNG ‏28 KB

Similar Messages

  • Determining whether an integer is a floating-point number

    I want to create a program that when an integer is input into the numeric constant, a floating-point number with all zeros to the right of its decimal point will light the LED on the front panel. The LED will remain unlit for any other floating-point number. I know I want to use a Round to Nearest function, but not sure where to go from there. 

    rtufaro wrote:
    I want to create a program that when an integer is input into the numeric constant,
    You mean CONTROL, right?
    You just need a type of rounding.  Doesn't matter if you round up or down.  So you just round and then compare the input to the rounded value.  If they are equal, you light up your LED.  So all you need is a numeric control, 2 functions, and a boolean indicator.

  • How to restrict the decimal place of a floating point number?

    Hi,
    Here is my code:
    public void TwoDecimal(double u){
         String w = Double.toString(u);
         int c = w.length();
         System.out.println(c);
         if (c <= 5)
            double a = Double.parseDouble(w);
            System.out.println(a);
         else
            System.out.println("Invalid input!");
      }I want to show a floating point number which has 2 digits and 2 decimal places, e.g. 45.82, 29.67. This number is input by user and passed as a parameter.
    For those case like the above sample floating point numbers, it can display the proper value of 'c'. e.g. 45.67 will display 5.
    However, when I passed 99999, it will show 7; 9999 will return 6, not 5.
    So, if the user does not input the '.', does it append 2 implicit chars to it? i.e. 99999.0 and 9999.0. So, that's why it returned 7 and 6 for the length of the string respectively.
    How can I fix it?
    and
    Does it has better algorithm?
    Pls advise.
    gogo

    When dealing with a known precision, in your case hundredths, it is often a good idea to use an integer type and add in the decimals on printing only. This is often the case in banking systems. Almost all of them use integer types, (read long) in pennies to store monitary values. Ever seen someone type in a value for a credit card machine? For something like $20 they press.. "2" "0" "0" "0" The machine knows the lowest denomonation in a cent, so it knows where to put the decimal place. I suggest you do something like this. It also helps to avoid base 2 round off errors.
    -Spinoza

  • Maximum size of a floating-point number

    Morning all,
    Does anyone know what the maximum size of a floating point number can be under Solaris 8 running on
    a V880?
    Regards,
    Richard Breckon

    I'm not sure what you're asking.
    The maximum size is 128 bits.
    The maximum value is as given in /usr/include/float.h: 1.189731495357231765085759326628007016E+4932L

  • Using Modbus RTU in Labview 8.5 for Terminator Field I/O

    We have on site Terminator: T1H-EBC100 Field I/O's and are trying to use Labview to control it.  We currently use Labview with our NI Fieldpoint modules and RIO's.  We have been trying to find a way to use LabView to control the Terminator Field I/O and it uses ModBus RTU for its protocol.  Does Labview 8.5 support this and any suggestions on getting the process started in using it.

    Our modbus solutions don't work with max. 
    Instead you send a message over TCP/IP or serial with a message for a particular node address. Only the node at that address will respond or act on the message. 
    Modbus is much different that FP in this respect. The modbus specification doesn't require pre-discovery of every node. 
    Additionally, because of this you should be able to send a message to the terminator even though it isn't discovered. You just will be need to configure the address correctly. 
    Jesse Dennis
    Design Engineer
    Erdos Miller

  • X64 Asm floating point number adressing .

    Dear Community
    Please kindly inform us about the number offloating-point
    addressing mode x64 Asm
    Best Regards
    Rafał Bator

    Hi RB_1,
    Your issue is out of support range of VS General Question forum which mainly discusses
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    You post the issue in this thread:
    https://social.msdn.microsoft.com/Forums/en-US/78825b09-d948-4676-a343-1791bad36603/asm-codnig-floating-point-number?forum=vcgeneral
    so I will remove this thread. Please discuss your issue on that thread or opening new thread on Visual C++ forum.
    Thanks,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Floating point Number & Packed Number

    Hai can anyone tell me what is the difference in using floating point & packed Number .
    when it will b used ?

    <b>Packed numbers</b> - type P
    Type P data allows digits after the decimal point. The number of decimal places is generic, and is determined in the program. The value range of type P data depends on its size and the number of digits after the decimal point. The valid size can be any value from 1 to 16 bytes. Two decimal digits are packed into one byte, while the last byte contains one digit and the sign. Up to 14 digits are allowed after the decimal point. The initial value is zero. When working with type P data, it is a good idea to set the program attribute Fixed point arithmetic.Otherwise, type P numbers are treated as integers.
    You can use type P data for such values as distances, weights, amounts of money, and so on.
    <b>Floating point numbers</b> - type F
    The value range of type F numbers is 1x10*-307 to 1x10*308 for positive and negative numbers, including 0 (zero). The accuracy range is approximately 15 decimals, depending on the floating point arithmetic of the hardware platform. Since type F data is internally converted to a binary system, rounding errors can occur. Although the ABAP processor tries to minimize these effects, you should not use type F data if high accuracy is required. Instead, use type P data.
    You use type F fields when you need to cope with very large value ranges and rounding errors are not critical.
    Using I and F fields for calculations is quicker than using P fields. Arithmetic operations using I and F fields are very similar to the actual machine code operations, while P fields require more support from the software. Nevertheless, you have to use type P data to meet accuracy or value range requirements.
    reward if useful

  • Check Floating Point Number

    Hello All,
    I am having some trouble checking the value of a field with Key Figure type Number with 8 byte floating point. I want to read that field and populate another field with an X if true. For example if that field is equal to 5,0000000000000000E+07 then i want to mark the other field with an 'X'.
    The problem is in my code, how do i read that number in the fltp field, such as the number above. my code reads as follows for the 'X' field.
        if SOURCE_FIELDS-abc123 eq 5000000.
          RESULT = 'X'.
        endif.
    Thanks everyone in advance

    You don't need to worry about converting the code into standard format or floating, just implement your code as you want and it will automatically take care of the conversion. Basically 5,0000000000000000E+07 = 50,000,000.
    thanks.
    Wond

  • Floating point number to IBM bytes

    Hello,
    I'm trying to convert a float value to a byte array (but in IBM standard).
    I understand that the general idea will be the following algorithm:
    1. process the sign, exponent and fraction from the float value (using IBM standard)
    2. build the bytes from the S, E, F from step 1.
    So far, I only have the step 2 like this:
    public static byte[] toBytesIbm( int signBit, int exponent, long fraction ) {
    byte[] bytes = new byte[4];
    bytes[0] = (byte)(signBit + exponent);
    bytes[1] = (byte)((fraction & 0x00FF0000) >> 16);
    bytes[2] = (byte)((fraction & 0x0000FF00) >> 8);
    bytes[3] = (byte)(fraction & 0x000000FF);
    return bytes;
    Getting the sing bit is also not a problem, so the real work is in getting the exponent and fraction from the number. I don't know how to do this. I have code from a trusted source to convert from IBM bytes to IEEE float numbers, so I can check if the bytes are correct.
    Can anyone help me with this?
    Thanks in advance

    Brushfire wrote:
    Thanks for the correct. I'm never quite sure about the masks, but I've had issues with extra data being introduced before, so I like it better safe than sorry. The mask is needed when a narrower primitive has been sign-extended to a wider primitive, and you want to keep the result unsigned.
    But in this case, the result is then cast to byte, which removes all the upper bits that the mask was trying to set to zero in the first place.
    If you need to store a byte in an int without sign-extension, you need a mask:
    int n = someByte & 0xFF;If you want to store the lower 8 bits of an int in another int, you need a mask:
    int lowerEight = someInt & 0xFF;But if you want to store the lower 8 bits in a byte, just cast:
    byte lowerEight = (byte)someInt;

  • Exception with floating point number

    I get the following message if i try to import a floatingpoint number (12.12 is the number).
    oracle.xml.sql.OracleXMLSQLException: 'java.lang.NumberFormatException: 12.12' encountered during processing ROW element 0. All prior XML row changes were rolled back. in the XML document.
    I4ve tested anything with '.', ',' NLS-Parameters and so on.
    The Bugfix is now to multiply the number with 100. It4s not fine, but it works.
    Thanks in advance,
    Oliver Friedrich
    null

    Hello,
    this is a short piece of my code. I think there is all information you need.
    Greetings
    Oliver Friedrich
    String xmlControl = "CONTROL"; // XML tag
    String dbControl = "XML_CONTROL"; // Database table
    OracleXMLSave saveObject = new OracleXMLSave(conn, dbControl);
    saveObject.setRowTag(xmlControl);
    saveObject.setIgnoreCase(true);
    saveObject.setDateFormat("yyyyMMdd");
    int count = saveObject.insertXML((Document)docImport);
    XML-File:
    <?xml version="1.0" encoding="UTF-8"?>
    <ROOT>
    <CONTROL>
    <NUMBER>12</NUMBER>
    <COST>123.45</COST>
    </CONTROL>
    </ROOT>
    Database-Table
    desc XML_CONTROL
    Column Name Null? Type
    NUMBER NUMBER(12)
    COST NOT NULL FLOAT(32)
    null

  • Reading Holding Registers Float Modbus RTU

    I'm having an issue with ready any floating point number correctly off of a Shark 100 Power Meter.
    I can sucessifully read a block of registers containing the meter name and serial number as 16 bit characters.
    For example when I read registers 1-16 on the map and flattening them to a string, I get a fully working string returned.
    When I try and read holding registers 1012-1013 (Amps A) I get really funny numbers when I convert to a float.
    Here is my code so far
    With my front pannel settings:
    Expected Value I'm looking to have returned: 11.11 Amps
    but
    When I use an indicator to read the registers: 19265, 0
    Same value when I do a conversion
    When I do a type casting to a float: 1.26484E+7
    I've tried some different combinations such as reading only one register and joining the numbers, both in big-endian and little-endian order, still no luck.
    Please Help!
    Here is the modbus float definition as defined the owners manual:
    Solved!
    Go to Solution.

    The float format you posted is the same as LV uses, so if you put example values (Register 1 = C4E1, Register 2 = 1DB9) in the code below it will give you right result.
    What is the full value of your "Output Registers"? You should have two values in numeric array for this to work.

  • Sending a floating point through serial using VISA

    how do I send a floating point number through a serial port to my microcontroller using VISA Write

    I would recommend the Flatten To String because of being able to change the endiness.  Some systems want Big Endian while others want Little Endian.  It is best to specify.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Failure of LabVIEW DSC 8.0.1 to yield values of Modbus RTU holding registers

    So, I know what I'm doing--or used to. Have done this before in LV 6 and 7. Previously used Lookout OPC drivers and the "Tag Engine".
    Recently with 8.0.1, I first set up the Industrial Automation OPC servers (AKA Lookout) to communicate with the holding registers (40,001-49,999) of my modbus rtu Watlow 96 and MLS316 temperature controllers. Subsequently, with the Server Explorer all of my 133 parameters on our 2 rs485 serial ports are communicating bidirectionally.
    So now Duh, why can I not bind a shared variable to register, say 40,334, and eliminate the OPC? The data is always reported as bad. Neither can I link shared variables to these addresses through the OPC I/O server.
    Am I missing something? Are there any examples of code available where individual modbus holding registers are communicated with bidirectionally?

    Well, this may seem rather silly but I viewed the video demo that NI has on binding modbus registers to shared variables before I even made my attempt.
    Now, differing from the demo video, I am using modbus RTU on a serial port.  Also differing from the video, when I create my shared variables, they are not placed in the same lvlib as the modbus server just created--LabVIEW prompts for a new library to be created.
    Could the NI product service staff please test with a serial modbus RTU device (a real living creature and not just a simulation please) the bidirectional communications and prove functionality with the Shared Variable Monitor of your product?  I suggest that you attempt communicating with holding registers 40,001 through 49,837.
    By the way, my com is set up correctly for I can view and or change all of the desired modbus RTU registers using the OPC Lookout Protocol Drivers through the Server Explorer.
    Please do not send me any more links to videos that test with simulations.  A real solution is required.
    Lloyd Ploense

  • Lookout 6.0.2 modbus rtu problem?

    One of our customers has Lookout 6.0.2 communicating with several CMI Scada Packs over wireless modems using Modbus RTU protocol. Suddenly last Friday night he got comm fail alarm pages on all but one site. The  Modbus statistics window revealed that Lookout had stopped polling all sites except the one site that stayed in communications. The only activity was the one site.
    He watched it poll this way for 2 hours, never returning to the normal polling cycle.
    I had him exit and re-launch Lookout and polling returned to normal and has been that way since late Friday night.
    This system has been in service for several years with very near 100% good communications sice we deployed it, up until now.
    It was obviously a Lookout failure, since the only action taken was to exit and re-launch Lookout.
    Isn't there a watchdog timer for this sort of error?
    Is this a failure of the Modbus cbx object? (We are using the plain vanilla Modbus driver)
    Roger Foote
    Foote Control Systems
    Solved!
    Go to Solution.

    Hey Mr Domer
    If it's the one I think it is, I designed and built the RTU system and repeater system after the "Packaged" system became obsolete.
    That was back when 1200 baud was fast! I guess it was compared to the 300 baud limit on the old stuff. Probably been re-built a couple of times since.
    Thanks for the sequencer suggestion. I will have to think on this since we are pushing the limits for polling... Some ScadaPacks in this syatem have to do up to 25 modbus transactions per site... We have serious I/O in this sytem lots of which is in floats. Haven't tried DNP yet but I am getting pressure from some distributors to go Clear SCADA and use DNP to thin out redundant polling. Thing is this system has worked flawlessly for years and now suddenly we have this issue, so I am not ready to throw in the towel yet and I doubt the board would go for the moneys to implement it. We are adding another 8 pump site this October after the canals are off line but before they are drained for winter. This is  so we can test the system before the frost protection season for the almond crop.
    If NI can't fix this I will probably just insist that my clients reboot every week. I am fortunate that these are not unmanned districts. Only problem is that each of them are at least a 2 hour drive from any one point so I need to keep callbacks to a minimum which would be zero callbacks if it weren't for software screwups.
    Best regards
    Roger 

  • SQL Loader and Floating Point Numbers

    Hi
    I have a problem loading floating point numbers using SQL Loader. If the number has more than 8 significant digits SQL Loader rounds the number i.e. 1100000.69 becomes 1100000.7. The CTL file looks as follows
    LOAD DATA
    INFILE '../data/test.csv' "str X'0A'"
    BADFILE '../bad/test.bad'
    APPEND
    INTO TABLE test
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
    Amount CHAR
    and the data file as follows
    "100.15 "
    "100100.57 "
    "1100000.69 "
    "-2000000.33"
    "-100000.43 "
    the table defined as follows
    CREATE TABLE test
    Amount number(15,4)
    ) TABLESPACE NNUT050M1;
    after loading a select returns the following
    100.15
    100100.57
    1100000.7
    -2000000
    -100000.4
    Thanks in advance
    Russell

    Actually if you format the field to display as (say) 999,999,999.99, you will see the correct numbers loaded via SQL Loader.
    null

Maybe you are looking for