Read MODBUS registers

Hi all

I have been more manuals/son using the Modbus Library to communicate through series. However, I'm not sure what exactly I am doing wrong. If I use a program like Modbus Poll and send 02 03 00 02 00 02 65 F8 I get a response: 02 03 04 39 20 90 D5 F9 3F. Looking at the manual for the device that I'm communicating with (a pressure transmitter), the application is in the following format:

02 - address

03 - function

00 - StAdd H

02 StAdd L

00 - reg #:

02 # reg L

65 CRC16 L

F8 - H CRC16

The answer is in this format:

02 - address

03 - function

04. # of bytes

39 data:

20 - data L

3F - data:

90 data L

D5 - L CRC16

F9 - H CRC16

So, in LabVIEW, this is how I have it Setup:

I put the 'Start' address to 1 because I have read, there must be in LabVIEW 1 less than what the actual starting address is (n - 1). I expect the same reply as above using Modbus Poll. In the diagram above, I get the following registers, starting at index 0: 256, 661, 63490 33538

Obviously the answer is not in hexadecimal as above, but it is nowhere near what it should be.

Thanks for the help!


Tags: NI Software

Similar Questions

  • 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.

  • writing multiple modbus registers

    Hello

    I am communicating to my labview program controller using modbus RTU and the controller has 16 bits in modbus registers.

    To send the float as '1.23' values, I write two registers to store the hex value that number in comma floating 32 bits.

    I use the modbus driver provided to this end by labview and use labview 8.2.1

    I have the following doubts in this regard.

    1. The "Modbus master series query. VI"has the command Modbus that records an entry which I use to set the registry values in the controller unit modbus. To send the above, mentioned in floating-point registers 501 and 502 (contains the full value of the PID parameters), use the same vi, whose value should be registered first... is the high or low, to be written to 501 and 502.
    2. The function code to write to multiple records in the modbus driver is 16. But my document that is specific to the Controller explained in the section "writing to multiple records" with the code of function like 10. And I see that feature codes 'writing in the single register' as well as the driver for modbus producing the same type of message frame as discussed in the document. But I see no similarity in the function "write multiple registers" in the document and the modbus labview driver.
    3. "Even if I write records 501 and 502 one after another will use"write in the single register"function code when these registries implement floating-point single using 2 registers ' 16 - bit '. If this method is possible, then I will come and do it the same way I did it for the entry in the single register. While writing data in records one after the other with a gap between the two as small as 4 ms scriptures do good?

    I suspect a confusion between 16 decimal and hexadecimal 10

    Two successive registry entries are not equivalent to a double entry: during the period between the two scripts your controller will be loaded with a false parameter. It is perhaps not necessarily a source of problems. It depends on your application. Writing the MSB should first reduce the problem.

    The order of Hi-Lo is dependent on the machine control. Some use the Big Endian, other Little Endian. But this choice should assign unique register values (U16) as well.

    If it is not documented, you should read the records and see if the result is logical. If this is not the case, invert the byte order and verify that the problem is resolved. Good luck

    Also, I assume that you know how to use the conversion feature to convert a single (32-bit float) 2 U16?

  • Linking a Varable shared several MODBUS registers

    A simple question, but can't seem to find an answer:

    I have a library project with a configuration of server i/o MODBUS series. In this library, I have several shared variables that are related to the registers on the remote device via the MODBUS Protocol, and this works very well if every variable is bound to read a single register (for example Modbus1\D400001). What is the proper syntax to bind a shared variable that is unique in several consecutive registers? If I put the type of shared in the "table of UInt32" Variable can I clarify something in the direction of Modbus1\D400001-D400100? So far, this doesn't seem to work, or at least doesn't have anything that is displayed when creating indicator table and linking of this share to the indicator variable. Thank you

    -David

    Sorry, I forgot to mention that it is version 9.0.1 LabVIEW with the DSC module.

    Hi Underscore_c,

    Take a look at this help document:

    http://zone.NI.com/reference/en-XX/help/371618E-01/lvmve/dsc_modbus_using/

    This document should also be in your LabVIEW help.  You will notice that you can call a table of records by prefixing the address of 'A'.

    For example,.

    A400008L8 is an array of values of length 8.

    There is an example called "Data type Extension Modbus" which should help you get started in the right direction.

    Dave T.

  • Read Modbus register at a variable point number

    I am just reading for a Hart Modbus controller prolinx I talked to Prolinx, and established that my pressure values are coming from 40031-40032, my values flow from 40131-40132 each standard U16 values using LabVIEW code are:

    I get a rather absurd number.  I tried to reverse the tables and byte and Word-swapping.  all to nothing does not.  for register 31-32 bed 61919 LabVIEW and 16811 respectively must be combined to get something close to 82 + some change and records 131-132 i read 17054 and 61858 respectively which must combine to 79 and change.

    I tried most of what I can find on there, but ask your question about the holes in this issue he can pop something.

    Thank you

    Mark

    Hi Marc,

    you are doing something wrong:

  • Using NI MODBUS - reading of several distinct registers

    I'm using LabVIEW 8.6, with the NI MODBUS 1.2 VI library. I have a device which serves up to 50 records, all keeping the same format. I want to read about 20 of them, however they are not consecutive.  (40010, 40015, 40017, etc.)  Read Holding Registers VI gives me the opportunity to read consecutive registers beginning at a given address.   On the other hand, writing several registers VI seems to me to write in an array of distinct registers. Is it possible to do it for the reading of records?

    AZZOAutomation wrote:

    I'm using LabVIEW 8.6, with the NI MODBUS 1.2 VI library. I have a device which serves up to 50 records, all keeping the same format. I want to read about 20 of them, however they are not consecutive.  (40010, 40015, 40017, etc.)  Read Holding Registers VI gives me the opportunity to read consecutive registers beginning at a given address.   On the other hand, writing several registers VI seems to me to write in an array of distinct registers. Is it possible to do it for the reading of records?

  • ComBox MODBUS - difficult to write in the registers of the S.R.I.W.

    Hey guys,.

    I'm talking to a UPS (ComBox XW +) via MODBUS TCP. I can read the values of read only registers very well, and they line up exactly what I see on the interface of the web page they have. However, when I try to write a particular register r/w, I get an error of the incompatibility of function (-538172 using modbus smithd API). Also, when I try to read the register R/W, I always get the value 65535. This leads me to believe there something wrong with my configuration of device, but just in case, I thought that I would make sure that I wasn't doing anything weird in the code. Please the the image of the block diagram, as well as the manual that I use for the device in the attachment.

    There is a small note MODBUS online as well:
    http://solar.Schneider-Electric.com/wp-content/uploads/2014/04/conext-TL-using-Modbus-application-No...

    Hey Thomas!

    Thanks for your help, however, this link is not available more when I try to open it.

    In any case, this problem is resolved. I was just writing the bad slave ID! The other slave was present on the network, but it is card MODBUS is completely different, that's why I was seeing these weird values.

  • How to read the multiple slave devices in a RTU modbus RS485 2-wire network without changing slave address manually?

    Hello

    Currently, I can read data out of multiple using the attached VI DAQ devices by manually changing the address of the slave on the front panel that determines what slave to read the data. However, I want the VI to do it automatically for me instead of me manually by clicking on the buttons on the front panel to change the address of the slave. In other words, the VI should read data off devices 3 slaves and save them to a database of all the 1 second (sampling from 1 sec interval). I tried to use the structures of the case, timed sequences and delays, but I'm still not able to get what I wanted. My current VI is a modified version of a VI library modbus - 'MB series Master query read input registers'. No idea how to do this?

    IM pretty new to LabVIEW, so don't kill me if im away here

    Could replace the cluster 'Series settings' with the attached structure solve this problem?

    The real deal will be just the value back to the default (1).

    -Tom

  • Modbus read

    I'm reading three registers of a Modbus slave unit operating from inside a timed loop. The timed loop is configured to run at 250ms intervals in the original application and that's why I won't be able to wait until playback is completed. So, I read every one registry, which allows a 250ms gap between each reading.

    I just want to know if the VI that I coded will do the job? (Reading of a single register in a VI with Timed loop works fine)  I'm particularly curious about whether referring to how I opened the VISA and using it is correct.

    Thank you

    Salvation of the crows and CC,

    Thanks for your interesting alternatives in the treatment of the data conversion. Of course in this case the maximum is taken by scripture - reading for the Modbus and so this calendar conversion is not too critical.

    But good course compared to the original way of stripping - reorganization and concaneting alternatives are very elegant.

    Thanks again.

  • writing in shared variable published network hosted on rt (defined as slave modbus for crio) problems

    Hello Forums or

    This is my first post on this forum and I've been using labview for about 8 months now

    I have a problem about writing data in the modbus registers through a server of e/s defined as a slave modbus for my hardware 9074. Once I finished the project of construction and deployment of the variables and by following the instructions here , he reports no results but a row of zeros. I have the DSM nor opened and configuration modbus master to see whether the data is actually read or written on the respective sides that give the same line of zeros so.  What I am actually trying to write is a single-precision floating data table. The registers are structured F40000-F46534 runs from 10 items or have them for range AF40001L1-AF46534L1 of the AF40001L10 point where it's an array of length 10. (Referenced beaches here)

    I know 1 thing for you, the modbus connection works and is ready for data requests, I tested cela NI DSM and set manually the data for and received my master.

    System and project specifications

    Windows 7 operating system

    LabVIEW edition development system complete 2011

    No module Labview DSC, but I use the real time such referenced by one of the documents

    This project is an application in real time with fpga mode (and not scan interface)

    The master and the slave are the same network and subnet

    Connection Modbus type: TCP

    9074 compact slots rio 8

    9234 module x 3

    module 9221 x 1

    9472 module x 1

    Engine service Variable shared running on windows os and rtos system

    Used this guide to learn more about the Protocol modbus, as I have searched all over the internet to learn more about modbus

    I already have software Modbus IO Server installed on the crio thanks to max or 1.8 for NI RIO 4.0 version

    file attachment (s)

    Image of software specifications Crio

    Image of data written in scheme-block rt variable

    Short version of the problem: why is the e/s no variable writes in with the converted correctly data?

    Okay, Yes, it's that I was the one proposed. Regarding the news of the error, if you look at the bottom of your image to DSM, you see a little commfail and an error code, but it seems that those are OK.

    The only thing I can think is that DSM (or another function) is written for a range of values that includes 400004. I suggest you to put into service 4-going to a range of 3. 3 s are entered only (perspective control), then you can be sure that the master is not trampling on the data. Once you have checked that, look at DSM and any other code running to make sure q EU not accidentally write 0s to the same reg.

  • Power Meter Modbus rs485 via 9871

    Hello

    I'm under Labview 2015

    I'm currently trying to connect has the place D Pm820 (meter) NI 9871 module in a crio 9076. The project is supposed to read the performance data in the registers of the meter (current, voltage, etc.) using the port rs485 on the back of the meter.

    The pm820 has a pinout for rs485 2-wire with 1 (-) 2 (+) and a 3rd Armor/ground wire. The pm820 meter is a slave device that has several different protocols that it can run on (Modbus RTU/ACII8/7 and JBUS).

    The setting of the counter are:

    Protocol: Modbus RTU

    Address: 1

    Baud rate: 9600

    Parity: None

    I use the module 9871 for device communication for the cRio

    I use the power cord that came with the module 9871 RJ50 to db9 and have the pins 4 and 8 rider (TXD + TXD +), and then connected to the (+) 5 and 9 meter jumper pins (-RXD, TXD) - and then wired to the (-) meter and ground on pin 1. I have read, it's how wire you the db9 connection rs485 2-wire.

    My first goal is just to get the communication with the power meter so that the value that I see in the registry, it is what I should see.

    I started using an example VI for holding registers (master modbus on target RT) reading as labview was pre-constructed and changed it so that its contribution would be to port 1 on the 9871 as created controls for my run configuration. Other I left the rest of the VI that it has been opened.

    When I run the VI I see numbers appear in the registry list, but they have nothing to do with the power meter. I unplugged the power meter and still got the same result however if you unplug the cable connection the 9871 1 VI will be a mistake (as expected). I have the feeling that the labview speaks to itself through the 9871, but I'm not sure. I looked at other posts, trying to find a solution and came across a mention of having to set the thread mode, but I can't find a way to do it using the modbus library.  However I could not find an example reading VISA registers the using visa I see there is a way to do it.

    I enclose a picture of my VI and the front panel to show what I mean.

    If I could help either make my VI work or at least get pointed in the right direction that would be great. I'm not against the use of the Visa library either. Also if you have examples or resources that would allow that they would be greatly appreciated

    It's just a part of my project but just get work communication is my main priority at the moment.

    Thanks in advance,

    Mike

  • Exstance no of Modbus communication

    I work with a rs232 for connection rs485 via a UNO2019 PC box.  The RS-485 connection is going to be MODbus RTU, has about 4 slaves on the bus (MMI flowmeter, VFD, two temperature RTD). All theses devices are configured accordingin

    9600 baud, odd parity, no flow control. the VISA resource would be COM3.

    Now all of these components I worked with every day for numerious months. and VI implementation exists (almost) without error. I get an error code for the additional bytes to the port, but he spends the whole upward. I don't know if I'm not or write, but it has happened in every piece of software, I developed in labview (it does not check the boolean error so I guess that's not important).

    Currently, when I try to read the registers of the MODbus slave, I get error:

    -107380733 (that mean 100 different things that I have done my research properly, bad bytes to the port, do not use correct end characters in your message). But every time I have seen that error code discussed in question direct USB/RS232, not RS232 to RS485.

    The attached string was

    3-> MD series Master Query.vi

    2-> MB series Master query Holding Register.vi

    1-> address Test.vi

    Thank you for any light you can contribute on my problem.

    Problem has been resolved. It was a hardware problem as I thought. Apperently this code error will exist when your RS-232/485 is hard set via dipswitches do not send data.

  • SDC RTU Modbus - cannot specify the type of query for each register address

    Hi, it's Jose.

    I have try the DSC module to connect with a temperature module, but this, does not meet the MODBUS registers addresses, for example to read the temperature, I should ask a 0 x 03 at address 1001.

    But for DSC for a request of 0x03, it expects to addresses like 4000, so since 1000 addresses belongs to coils, SDC makes a request of 0x01

    My thermometer has even coils register.

    Is there a way to force the DSC to make specific requests?

    Thank you and best regards

    What happens if you enter the numbers as 400001 401001 or simply?

    Also try to only 1.

    The current Protocol does not transmit the prefix number which he calls a coil (1) or (4) record keeping, (3) registry entry.  (I mixed up to the top of the last two is possible).

    So the device describing the registry with the wrong group of addresses, may not matter.  You just lie to LabVIEW to tell him where he thinks is it supposed to be.

  • Performance of Modbus using DSC static Variables

    I'm fairly new to using Modbus with LabVIEW.  On some dozens tools and APIs that can be used for a project, I train, I decided to try using an alias of shared Variables in Modbus registers in the project, which is a tool of DSC.  It seemed like a smart to go way.  I used Variables shared in the past, however, and I am aware of some of the questions that surround them, especially when the number of them begins to increase.  I will have only about 120 variables, so I don't think that's not too bad, but I'm getting a little worried...

    The way I started to do this was to create a new shared variable for each data point.  What I have noticed since then is that there is a mechanism to process multiple records at once using a table of values.  (Unfortunately, even if I wanted to use the table method, I probably couldn't.)  Modbus points that I am interfacing are for a custom device and the programmer does not disturb the consecutive use records...)  But anyway, I was wondering what might be performance issues that surround this API.

    I guess:
    (1) all caveates of shared variables apply.  These are really shared variables, but only DSC taught the engine of the SV to go read.  Is this fair?

    And I wonder:

    (2) there is no improvement in performance for reading a table of variables consecutive rather than reading each variable individually?

    (3) there performance above problems what shared variables have normally when you use Modbus specifically?  (E.g. how many times can you read a few hundred points of the device even Modbus?)

    Thank you

    DaveT

    Hi Dave,.

    Thanks for your good questions!

    (1) you are right that the caveates of shared variables apply. Generally, the major issues (conditions of race etc.) are not met because these variables are generally used as I/O.

    (2) with a large number of shared variables that are located on separate machines, it is best to use a table. However, with 120 variables read consecutively will not affect your overall performance, especially if you don't need to read everything at the same time.

    (3) overall, there is no any concerns of performance outside normal common variable concerns. Modbus and DSC are designed to be efficient and do a good job to maximize performance for you.

    I hope this helps.

    Best regards

    Anna L

  • How to monitor the parameters using the Protocol Modbus in LV

    Hello everyone

    I have a problem with my LabVIEW project. I have to watch my monitor settings MI4100 Power using LV 8.5 and I don't really know how. I use the modbus RTU Protocol and I am able to communicate with the instrument, but I can't understand how to monitor records.

    I have attached my comunication VI to see what I've done. Please help me if you can.

    Thanks in advance, Sylvia

    If you work with 32-bit numbers in need of two registers, then what you already do with numbers to reach work.   Read 2 registers from 256, contact numbers, and you'll have nonexercising total power.

    If you read only 1 register, then you will have a table of 1 item.  Decimate this table and joining the numbers don't make any sense.  You'd read comes directly from the registry.

    What is the description of the error for 6002?

    I don't see any reason why you wouldn't be able to read an address greater than 30.

Maybe you are looking for