Conversion of modbus hex-data of registers to float

Hello

I use the modbus Protocol to read an analog value from a module.

The webpanel of the module displays the hex value and the float value. The modbus function only returns the hex value.

09FD is 0,780

How can I convert the hex value returned in the float?

There is also a modbus-funtion for this:

public public static float GetSingle (ushort highOrderValue, ushort lowOrderValue)

But I have tried all sorts to use it without success. (It works, but it does not return the correct value)

Thanks for help


Tags: NI Software

Similar Questions

  • Question about reading the hex data

    Hello! I'm a Novice of Labview and have a problem with reading the hex data.

    Basically, I bytes from the serial port like this: "80100E0E0AB4F646F24A00911267087E032080057FFF."

    It is not encoded in ASCII. What I want to do is to convert a hexadecimal string ASCII of the hexagon.

    so that the chain would become of ASCII hexadecimal numbers.

    I think that the following might be a solution, but I have no idea what the Subvi is in the solution.

    http://forums.NI.com/T5/LabVIEW/hex-string-to-ASCII-hex-string/m-p/886078/highlight/true#M400462 Thanks in advance and I thank you for your kind help!

    coolmatthew wrote:

    What I want to do is actually this.

    You use too much a lot of code for all this. All you need is a concatenate strings, replace your entire and other loop. Same result.

    (See also)

  • The modbus two registers to float data conversion

    I read a modbus data HAD two piece of the registers-40609 and 40610. The content of the register I get is an array of two elements (12458, 14019). I want to convert these numbers into a variable, the value of the point. Library modbus does have a VI that does? If this is not the case, how to convert it?

    Thank you!

    Reverse the order of the numbers entering the Join function.

  • Modbus tcp read holding registers return not requested quantity

    Background: I have a client using ELAU motion system - they record data with records they want to be able to read on a cRIO match with some analog FPGA data (I have digital handshaking going on for this).

    LabVIEW 2010 SP1

    cRIO-9074

    With the help of the library of VI of MOdbus.llb OR communicate with the other system.  I can open the TCP communication without problem and actually get SOME records, but not ALL registry data, I want to read.

    I want to do is read the registers individual operating 330 U16 values.  I know how the data are split to represent different lengths (i.e. most of the data items use 2 records number represent a 32 bit).  I want just to read all of the individual records and analyze the data in another VI to convert it to other data types.

    I provided the .vi MB Ethernet Master Query (poly) with the starting address for the first register, then the amount of 330.  The polymorphic instance selected is "reading record keeping.  The array returned by this VI via 'Holding Registers' is only 74 elements and not requested 330.  I have no exception code and no error in LV.  Is there some intrinsic limit, i.e. the number of Holding Registers that can be read?

    I do not use the (not sure if necessary) MBAP header entry.

    Thank you.

    Simple solution once I dug in the series MODBUS/TCP protocol protocol documentation out there via Google.

    History of the modbus function series is the limitation that carried over TCP - the maximum amount of bytes in the pack a data can be only 256 bytes.  So I was limited to approximately 125 ~ records at a time.

    256 bytes is 2048 bits.  The use of the 16-bit registers which gives maximum 128 registers.  I went with 125 followed making easier totals.

  • Protocol Modbus RTU data types

    Hello

    I use series ADAM with the data type Modbus RTU protocol.which should I use to read and write operation?


  • Conversion rates for simultaneous data acquisition

    I use a Mech multifunction data acquisition. / s/SMU-6366. The maximum sampling frequency for the analog inputs is 2 MHz. Is the time of actual conversion of CDA always 0.5µs, or t - it change with the evolution of the sampling frequency? Can I set the time of the conversion? Reading, looks with peripheral multiplex, you can set convert it clock and the sample separately clock. What is with simultaneous data acquisition?

    Hi Daniel K..

    It is a big question. I wonder if you get any errant behaviour - your card is not up samples as you hope?

    Here is some information that might help you:

    What kind of analog-digital converters are used in National Instruments hardware DAQ Multifunction...

    Wikipedia: successive approximations ADC

    I'm not sure exactly what happens, but dare a guess time digitizing ADC does not vary with the frequency of sampling.  And it will also be more than 0.5 US - it is more than likely faster than that.

    I hope this helps.  Good luck with your application!

  • Use of Hex data

    Someone who can help:

    A temperature gauge we use is data sending (via RS232) HEX in the following table format:

    (Sample data)

    byte0 0x11

    octet1 0x02

    octet2 0x01

    byte3 0 x 36

    Byte4 0x00

    0x4B byte5

    octet1 upper and lower nibbles represents the 'xy' of 'zx.y' degrees C temperature, and the low nibble of octet2 represents temperature 'z', then the temperature reading would be "10.2 ' degrees C of the sample data.  I guess that octet1 may not exceed 0 x 99, and octet2 must not exceed 0 x 09, which gives a maximum temperature of 99.9degC, but were not able to test this yet.

    Please can someone help me in the code to get the quartets of high and low data sample as stated?   I use LabVIEW, CVI, which I understand has incorporated features can get the "nibbling".

    Thanks much for any help.

    Allen Cherry

    Roberto,

    Thank you very much for your help - I guess that the variable 'valo' should be declared as a variable 'double' - when I did this, it worked OK - at least with "+ ve" temperatures, I'll have to wait to see what happens with '-ve' temperatures.

    Very much appreciate your help,

    Allen

  • Modbus, writing in the registers by PID regulator

    Hello

    Can you please help... I'm new here

    I try to use a registry read, send the value to a PID vi, then write in a register.

    I've attached an example of using a temperature regulator.

    I get errors whenever I try to connect using clusters, clusters, etc..

    My material and comms are all good, I have values and all gauges reading ok, but it seems I can't work on how to manipulate the data through a vi of PID.

    Your help is very appreciated.

    Thank you

    1 rearrange your functions so that your reading of data occurs before your writing of data.  You can do 1 2 3 4.  Right now your code run step 3 before step 1 and impossible to know where should go steps 2 and 4.

    2. your writing log has an entry called registry where your worth is going.  There is an entrance to U16.  Your PID provides a DBL.  You need to read the manual of the device know how to code the PID output floating point number into an integer.  It may be a simple by multiplying by a factor of scale and he rounded to an integer.

    3. your Modbus Read is for several records. You will get a table 1 d of readings, but it will not be 1 element.  You can use the table to Index, and then together with setpoiint wire to feed in the gauge of multi-aiguille.  Since you data will be an integer U16, you may need to perform a scaling to convert an integer in all that but it represents the temperature.

    4. don't forget that you must connect your process in the PID function value.

  • TCP Comm send the Hex data

    I have an embedded device server that has a controllable set of 8 pins of the user. The format of order for these pieces requires a TCP message which is 9 bytes long and hexadecimal.

    I use TCP Communicator - Active .VI in the LV7.1 examples, make a link to the server of the device. There is no problem with the connection - but I'm unable to send the message in HEX format.

    The transmitter/receiver always converts my entry into ASCII and the command fails so. Also, he fragments the typed command bytes and when I probe the resultng with a network Analyzer (Ethereal) data package I see that the VI has fragmented the bytes of data in several discrete packages.

    The order message I want to send is in this format: FF 00 00 00 FF 00 00 00 1B

    Any suggestions to solve the problem?

    Thank you

    You must either create your string in hexadecimal display mode so that you know that you enter hexadecimal values, rather than characters, or use a byte array, and then use the function to the array of bytes to a string . I would opt for the latter because it is easier to understand.

    Note that the table is an array of integers of U8 whose formatting the hexadecimal value, and using a field width minimum 2 characters, zeros on the left and with the radix displayed. Makes it more clear that this is a hexadecimal value.

  • Conversion is not copy data

    I modified the example application command line allowing possibly thin discs put in service. When a thin available property is set to true, the following block of code is executed in the function "BuildCloningParams".

    if (_vmThinProvision) {
    
         converterStorageParams.targetDiskParams = new ConverterStorageParamsManagedTargetDiskParams[_sourceLogicalVolumeInfo.Length]; 
        ConverterStorageParamsManagedTargetDiskParams targetDiskParams = new ConverterStorageParamsManagedTargetDiskParams(); 
      
    
         int volumeCount = 0;   
    
         foreach (ConverterComputerOsInfoLogicalVolumeInfo volumeInfo in _sourceLogicalVolumeInfo)      {
              targetDiskParams.sourceDiskId = volumeInfo.volumeId;
              targetDiskParams.diskType = "vmfsMonolithicFlatThinProvisioned"; 
    
              targetDiskParams.datastoreName = _vmDatastoreName;
    
              converterStorageParams.targetDiskParams[volumeCount] = targetDiskParams;
    
              volumeCount++;
         }
    }
    
    

    The question is when this provision of the code is run (when _vmThinProvision is set to true), the virtual machine is created successfully, but no data is never copied/converted to the new virtual machine. In the vCenter Converter management console, it just shows work as compeleted immediately (and shows no error).

    If _vmThinProvision is false (and this block of code is not executed), then the conversion works correctly and the data is copied. Obviously there is something in this little block of code that is not correctly say the agent migrates the data, but I can't understand what it is.

    Any ideas what could be causing the problem? Thank you.

    You mix * disk * ID with * volume * IDs. The discs are "physical" storage The volumes are "drive letters" the OS sees. After querying the source, you get two tables - one with "ofConverterStorageInfoDiskInfoand the other is with 'ConverterStorageInfoVolumeInfo's. Each entry has a diskId or volumeId respectively. VolumeInfo holds the diskId to the drive where the volume is physically assigned. Each volume can have several "diskId to cover the case of dynamic disks (i.e. one volume spanning across multiple disks). When you do P2V Converter is cloning * volumes * (in other words, what operating system sees, because it also offers the possibility of taking snapshots on the level of volume rather than at the level of the disc). You must give each volume ID desired on the target in the target storage settings source.

    Now, when you create the storage schema target mapping is a little different. You have an array of targetDiskParams (that you create), but sourceDiskId Member should be valid * disc ID * on the source, but you put * volume ID * it. Each instance of ConverterStorageParamsManagedTargetDiskParams was a member of ConverterStorageParamsVolumeCloningParams . It holds all the * volumes * you want to be placed on the disk target. Note that, with this structure, you cannot specify multiple disks of a volume, which means that each volume is entirely contained in a single disk on the target (no dynamic disks).

    So, to get to your problem, you need to specify a * valid source ID disk * and an array of volume cloning params for each instance of targetDiskParams. Each instance of VolumeCloningParams must specify a * volume valid source ID *. Volumes not mentioned in the target disk params will be ignored during conversion.

    You don't need to look at ConverterComputerOsInfoLogicalVolumeInfo.

    HTH,

    Ivan

  • Date Validation /Conversion as string to date

    Hello Oracle experts

    I'm trying to find the right date conversion/validation. The problem is that I get as string(dd-Mon-yy) format date in a text file. I need to load it into an Oracle table in the form of text, then post the text as a date is valid.

    I can check the day and year. But how to check the month. If the date is * 1 April 11 * it's OK but if it is as * ODA / 01/11 * so how to check the string of months is one channel of 12 months. I mean from January to December.

    If I use the conversion to this day, I get the error ORA-1843.

    with t1 as
    (
    SELECT ' 01-CCA-11' stringdate FROM DUAL Union all the
    SELECT 1 December 11 ' stringdate FROM DUAL Union all the
    SELECT ' 01-Juk-11' stringdate FROM DUAL Union all the
    SELECT 1st April 11 ' stringdate FROM DUAL
    )

    The first and 3 record is incorrect month.

    Help, please.


    I use
    Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
    With partitioning, OLAP, Data Mining and Real Application Testing options


    Thank you

    Rajesh

    If you want to just check the month (and assuming that the month is English), you could do something like

    SQL> ed
    Wrote file afiedt.buf
    
      1  with x as (
      2  (SELECT '01-Apd-11' stringdate FROM DUAL union all
      3   SELECT '01-Dec-11' stringdate FROM DUAL union all
      4   SELECT '01-Juk-11' stringdate FROM DUAL union all
      5   SELECT '01-Apr-11' stringdate FROM DUAL ))
      6  select (case when regexp_instr(
      7                       x.stringdate,
      8                       '-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-'
    ) > 0
      9               then 'Valid'
     10               else 'Invalid'
     11           end) status,
     12         stringdate
     13*   from x
    SQL> /
    
    STATUS  STRINGDAT
    ------- ---------
    Invalid 01-Apd-11
    Valid   01-Dec-11
    Invalid 01-Juk-11
    Valid   01-Apr-11
    

    Justin

    Published by: Justin cave on July 30, 2011 19:32

  • UTF 8 Conversion and manipulation of data EXCEED_SIZE

    Currently, I am working on a UTF-8 conversion task.

    We ran the csscan on the database and identify the tables and columns that are data that can 'EXCEED_SIZE' and 'DATA_LOSS.

    Here are the details of my database:
    Database version: 9.2.0.8.0
    NLS_CHARACTERSET: WE8ISO8859P1

    My question is, how can we identify the number of characters to truncate data EXCEED_SIZE, so that the data resulting will be insert in the post column conversion?

    Any document available on the treatment of EXCEED_SIZE data and DATA_LOSS cases.

    Thank you
    Anil

    There is no function unique SQL or an expression that can allow you to find the maximum substring of the current value that is will insert in the column after the conversion. But you can write a PL/SQL function that returns the string on the right using probing approach.

    FUNCTION to CREATE or REPLACE max_substring (VARCHAR2, max_column_length NUMBER input_string) RETURN VARCHAR2 IS

    substring VARCHAR2 (4000 BYTE);
    BEGIN
    substring: = input_string;
    LOOP
    IF the substring IS NULL THEN
    RETURNS A NULL VALUE.
    END IF;
    IF LENGTHB (CONVERT (substring, 'UTF8', 'WE8ISO8859P1')) < = max_column_length THEN
    RETURNS the substring; -the substring is part of the column even after conversion
    END IF;
    substring: = SUBSTR (substring, 1, LENGTH (substring) - 1); -remove the last character
    END LOOP;
    END;

    Please, test and revise this function carefully before using it in production. It can be applied to:

    UPDATE table SET columnis max_substring(+column+,+column_length+);.

    Change the arguments to be CONVERTED if the character of the target or source of change.

    As it has already recommended:
    1. check if your database has WE8MSWIN1252 codes (bytes in the range 0 x 80-0x9F)
    2 consider using AL32UTF8 instead of the UTF8. UTF8 is needed only for databases that interface with clients 8.1 or older and databases.

    -Sergiusz

  • VISA: on the conversion of the other date to string

    I met a problem to make the series using VISA communication. When I convert the decimal value of 10 type that matches the CSA Code, there is an error, but another digital conversion is no problem.  Can someone help me?

    ben64 wrote:

    Isn't strange that the size of the VI went from 59K to 46K just renaming?

    Ben64


    I opened it in LV 2011 and back recorded on the original file 8.5 LV since I do LV 8.5 installed.  That the change in size may be the vs file saving code downgrade upgrade function.  But it's still a significant percentage.

  • analyze serial port hex data and graph time real conspiracy

    Hello guys,.

    am a newbie to labview and am currently working on my final project of the student, but I met a problem extracting the values of currents and voltage of hexadecimal string read to read the VISA stamp. I also want to throw the string header every time so that I can only process only the voltage and current hexadecimal string. My rope of the read data is attached. 0023-0034 0045 0132 AA55 AA55 AA55... Where AA55 is header I want to throw. The following 2 after the header bytes represent the tension, while the 2 bytes represent the current. After 6-byte header (AA55) appears again.

    So far, I read the data read as attached VI visa, and I would be recognizing all assistance to extract successfully, only the voltage and current values every time the (AA55) header is read to raw data. I have read several forums observation about the covers this topic but none seem still a click. Thank you once more!

    The VI am working on is attached and some failures in the print screens.

    A framing error means that something is wrong with your string of bits 1 and 0 s, coming from your equipment.  The start and stop bits are not where they are supposed to be.  Check all your configuration settings set to ensure that they match the device.  Baud rate (230 400 seems quite high), stop bits, data bits, parity.  Something is probably wrong in there.  That or if you have bad cables or electrical noise interfere with transmission.

    Why is it you are emptying the receive buffer?  Which is almost never necessary and could actually cause you to lose data or start the synchronization of your data once you've established.

    I don't know what you're trying to do in this while loop inside.  That looks nothing like what I was describing.

    See the attached VI.  I have not fully tested (after all, I do not have material sending me data).  But it should give you the idea.

  • Conversion of hundreds of data in CSV files. Script on command prompt?

    Hi, so I think I have a unique problem with an easy solution. I have more than 1400 files which are actually (roughly acsii) RAW data files that I need to parse CSV files converted. They are all in the same folder, and I know there are scripts there to take all the files in the folder and the list of people in the CSV format. I just want to convert all the files in the CSV file. I could use Excel and manually convert all 1400 of them, but there must be a better way. Also, it would be great if everything was annexed to 1 VERY large CSV file.

    I'm relatively new to the windows command prompt window, so any help would be greatly appreciated.

    Thank you!!

    Check this: copy command to allow adding files: https://www.youtube.com/watch?v=MX2SXdR9yfw

    You can use it to combine all the files, then open them only once, and convert the whole thing to a CSV file in a single step.

Maybe you are looking for

  • Installing no Windows updates. ___

    Not installing the latest Windows updates. Update for Microsoft XML Core Services 4.0 Service Pack 2 (KB973688) Update for Windows 7 (KB976098)

  • A9J40B: New printer: HP Envy 5530 transport Jam/Paper Jam

    I just purchased and received this printer. After the installation of the configuration and installation of the printer, he tried to print a report, but it will never work.He guard sends me errors and says that there is a blockage of the cart. I look

  • command ' ip wccp redirect exclude in. "

    Hi all, I'll have trouble understanding how the command ' ip wccp redirect exclude in "and hoped someone would be able to give me more information on this subject. I know that it must be on the interface/subnet where WAAS is connected when "redirect"

  • Windows 7 - Printer Spooler problems. Allows to get noticed to add yourself to "need an answer" (error Code 1813, 1297, 1053 and 0x000006ba)

    OK I'm a newbie to this and certainly not a computer techy so please excuse the amateur descriptions. I have a new Dell laptop and have upgraded to Win 7 Home prem to Win 7 Professional. (Not homegroup) (wireless network) successfully with my old run

  • Purchase school?

    I am a user of Adobe Creative Suite for 15 years.  I'm ready to rent rather than buy Adobe, but Adobe doesn't want to receive a credit card or Paypal account.  How are you other schools doing this?  I have to have an order form and then send a cheque