Modbus

Dear NI,
                    I am using Modbus- MB vi's, i trying to read a value from my device . my device has a baud rate : 19200, slave address: 2, and charformat: 8E1.
i cant able read the value using this vi's..... i tested with Modtest software. from that i defined all the above parameters and i used Holding registers to read the data, and given Register address is 40001.
Help me to read the data using Labview.....
send me the example program...
Regards,
Balaji DP

Sending the Modbus command using LabVIEW is pretty trivial, you can use the Advanded Serial Write/Read Shipping example to do it (assuming you sending it out over your serial port).  It sounds to me like you are having trouble sending the correct command or generating the correct CRC-16.  For either of these you will probably need to either read the manual or contact customer support for the device you are trying to talk to.
CLA, CLED, CTD,CPI, LabVIEW Champion
Platinum Alliance Partner
Senior Engineer
Using LV 2013, 2012
Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

Similar Messages

  • Lookout modbus plus performanc​e

    I'm running 9 Schneider Electric PLCs Compact 265 connected to Lookout v5 PC via modbus plus. I have cyclic stalls of transport, each 50 secs or so, which last for 3 or even more seconds. I've tried all the settings there are on modbus object in Lookout, but with no success, only different graph shapes in performance monitor (you can have a look at graphs at the end of mail). Even single PLC on network (with others shut down) freezes the communication for more then second, which is unacceptable since I need to refresh my data at least each 350ms.
    I've considered 3 things:
    1. PLC underperforms
    I've checked scan time in PLCs, they're all running smooth with scan time under 90ms. This time doesn't increase even during modbus peaks, I've reduced watchdog to 100ms and it never triggered. Looks to me like plc has more than enough time for modbus, so plc should not be the problem.
    2. PC underperforms
    Hardly a problem, PC running under 5% most of the time, never goes over 50% no matter what I do.
    3. modbus underperforms
    Statistics show no garbled or timed out frames on any plc, so wiring should be fine.
    PLC uses 130 registers of memory (type 4 – holding register). With all registers back to back (no slack between registers), this should mean that all the memory can be transferred in 2 frames. This also means total data load per sec should be
    9 plcs * 3 refreshes * 130 reg * 2 bytes = 7030 bytes.
    Even with overhead included, this is so little compared to theoretical 120 kbytes modbus plus should be able to perform, so nothing else for me to do but scratch my head.
    I've checked Lookout source for any loops which could initiate some read or write at 50sec cycle, but there's nothing even close anywhere in program.
    Am I missing something? Can anyone tell me why modbus freezes my system?
    Bye everyone,
    Darko
    SVETLOST TEATAR

    Hello,
    It’s been a while since I last checked the forum, but in the meanwhile I’ve resolve the problem.
    The solution lies in modbus.ini and the way modbus object communicates with modbus secondary, an issue not properly covered by help and ni.com. Unless defined otherwise in modbus.ini, modbus object will refresh all of the configured memory points in your plc each 50 or so polls (I can’t remember which is the default value). This can be a problem if the number of memory points is large, because it congests modbus and creates performance stalls.
    You can read more about this here: Lookout Driver Objects - Custom INI File Settings (http://zone.ni.com/devzone/conceptd.nsf/webmain/E​54F75254BBE772786256CFC00700B5F).
    Thanks everybody for joining in.
    Bye,
    Darko

  • Performanc​e of Modbus using DSC Shared Variables

       I'm fairly new at using Modbus with LabVIEW.  Out of the roughly dozen tools and API's that can be used, for one project I'm working on I decided to try using Shared Variables aliased to Modbus registers in the project, which is a DSC tool.  It seemed like a clever way to go.  I've used Shared Variables in the past, though, and am aware of some of the issues surrounding them, especially when the number of them begins to increase.  I'll only have about 120 variables, so I don't think it will be too bad, but I'm beginning to be a bit concerned...
       The way I started doing this was to create a new shared variable for every data point.  What I've noticed since then is that there is a mechanism for addressing multiple registers at once using an array of values.  (Unfortunately, even if I wanted to use the array method, I probably couldn't.  The Modbus points I am interfacing to are for a custom device, and the programmer didn't bother using consecutive registers...)  But in any case, I was wondering what the performance issues might be surrounding this API.
        I'm guessing that:
    1) All the caveates of shared variables apply.  These really are shared variables, it's only that DSC taught the SV Engine how to go read them.  Is that right?
       And I'm wondering:
    2) Is there any performance improvement for reading an array of consecutive variables rather than reading each variable individually?
    3) Are there any performance issues above what shared variables normally have, when using Modbus specifically?  (E.g. how often can you read a few hundred Modbus points from the same device?)
    Thanks,
        DaveT
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.
    Solved!
    Go to Solution.

    Anna,
        Thanks so much for the reply.  That helps a lot.
        I am still wondering about one thing, though.  According to the documentation, the "A" prefix in a Modbus DSC address means that it will return an array of data, whereas something like the F prefix is for a single precision float.  When I create a channel, I pick the F300001 option, and the address that is returned is a range:  F300001 - F365534.  The range would imply that a series of values will be returned, e.g. an array.  I always just delete the range and enter a single address.  Is that the intention?  Does it return the range just so you know the range of allowed addresses?
       OK, I'm actually wondering two things.  Is there a reason why the DSC addresses start with 1, e.g. F300001, instead of 0, like F300000?  For the old Modbus API from LV7, one of the devices we have that uses that API has a register at 0.  How would that be handled in DSC?
    Thanks,
        Dave
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.

  • How to Plot number and string in one row (data logger counter via MODBUS) ?

    hi all i made data log quantity using Digital Counter via modbus (RS-485) to monitoring quantity and reject that has and Name Operator, Machine and Part Number.
    i have problem about plot the number & string in one row, as shown on the picture below :
    how to move that string on one row ? i attach my vi.
    Thanks~
    Solved!
    Go to Solution.
    Attachments:
    MODBUS LIB Counter.vi ‏39 KB

    Hi rhiesnand,
    right now you add 2 new rows to your array.
    The solution is to concatenate both row parts to one bigger 1D array before adding that array as new row to your 2D array!
    Like this:
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Getting wrong values from modbus slave

    Hi,
    I'm trying to get data out of a lumel na5 digital meter. The device is connected via its RS485, through a RS232->RS485 converter to the RS232 port of the PC.
    I've donwloaded the NI modbug library, and was able after some work to communicate with the device.
    The problem is that the data I get out of it is wrong. I monitored the request and response data that the VI send, and it looks ok but the data is not correct.
    Anybody has some similar experience?
    Thanks in advance,
    Eyal.

    Hi,
    I do not have any experience with your device but, if you get data (even if it is wrong) from your device with a ModBus protocol you have your communication working !!
    The wrong ModBus data is often caused by simply using the wrong register number(s). Start at 0 or 1, hexa and decimal mixup, invalid register numbers in the range, things like that.

  • I am using the MODBUS library and can't receive data, however I can send it just fine?

    Hi,
    I am using the Modbus Library to communicate with a VFD to control a fan. I am using the master write and read vi. I can write data to the VFD and get the fan to do what I want. The VFD is supposed to send a confirmation packet after I tell it to do something and I can also read its registers. When I debug the VI it shows the problem is the buffer always reads zero and the VI timesout. If I watch the lights of the USB to RS 485 adapter I am using to interface with the VFD, I see that the RX light flashs right after I send a message. So I should have something in the buffer. Does anyone have any suggestions?
    Aaron
    Solved!
    Go to Solution.

    Ok, heres what happened for anyone who has this problem. In the MB Serial Receive.vi The Bytes at Port property node was reading 0 even though there was something in the buffer. The program execution was then stuck in a loop till it timed out and never went on to read anything from the serial port buffer. I didn't spend too much time wondering why that VI didn't work and created my own. With an appropriate delay after writing to the serial port,  I used the same Bytes at Port property node and was able to get the right number of bytes to then feed the read VISA vi the number of bytes to read. I got the right response message and everything seemed good. But of course NOT! I then experimented with writing different speeds to the VFD to get the fan to run at different speeds. I found a small range of speeds where I would get no response from the VFD, either by it functioning or sending me a response packet. After quite some time, I found there is an error in the LRC-8 code in the MODBUS NI library. It does not mandate the LRC be a two character value. So if your LRC turns out to be a single character value such as F (which should be 0F)  you get an incomplete MODBUS message. This was easily fixed in the LRC8 vi by telling the 'number to hexidecimal string' vi to produce an output with a minimum width of two. Then everything worked great. Moral of the story is the MODBUS library is clunky.

  • Communication problem with Modbus object in Lookout 3.8

    What means the error code 06 besides the following alarm message NO COMMUNICATION RESPONSE FROM MODBUS SECONDARY ? Lookout runtime-express version 3.8 build 7

    Greetings,
    The alarm message "No Communication response from modbus secondary" means that communication cannot be established between the modbus object and your external device. Verify that you have set up the serial port settings properly and that you have configured the modbus object. Verify that your external device is functioning properly and connected to the PC. If all of these things are ok, you may need to increase the receive gap of the serial port settings and the receive timeout of the modbus object. There is a tutorial on the web which outlines the troubleshooting steps for communication in Lookout.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/033CD84BAC7E1E7586256A3300756284?opendocument
    I hope this information is helpful. Have a good day!
    Patrick R.

  • Error when running ethernet modbus slave demon in an executable - reoccurence

    Thought I'd solved this with the help of the mass compile function. However, it seems to have come back. Maybe it never went away.
    Brief summary  - I'm trying to create an exe of the MB Ethernet Slave example.vi in LV 2013. I can create the exe OK but when I run it I get an error 1003 at invoke node. "This VI is broken or contains a sub VI that LabView can't locate. Verify that you can run the VI. VI path C:\Modbus\Source code\Slave demon.vi."
    Well I can run the slave demon VI with no problems. I can also run the MB Ethernet Slave example VI with no problem.
    In the MB Ethernet slave example VI there is an invoke node that calls the slave demon vi. I've used the slave demon VI path constant as an input to the invoke node so that the exe shouldn't have a problem locating it.
    I've also checked out the sub VIs of the slave demon and they all seem to be present in my project. I've also tried a few different build settings - all to no avail. All VIs have been mass compiled under LV 2013.
    Maybe the exe is struggling to locate the TCP functions.
    Any help would be much appreciated.
    Attachments:
    MB Ethernet Example Slave.vi ‏47 KB

    I have checked the path and double checked by dragging the VI into an empty path constant. I also created a version that uses the file dialog express VI so that I can select the slave demon VI when the program runs. I've also set the slave demon to be always included in the project build. The error message still appears.
    By disabling sections of the slave demon vi I found that a VI called Internecine Avoider was linked to the appearance of the invoke node error message. By disabling this VI I could get the invoke node error message to disappear, although the slave demon then didn't work as intended. This VI is included in my project under the vi.lib so it should be found.

  • Modbus Slave Demon - Executable cannot find VI.

    I have included in my application Modbus Ethernet Example Slave, which I've altered a bit ( only the inside of While Loop ). Everything is working fine until I've come to using an executable built from my project.
    When I start it I got: Error 7 occurred at Open VI Reference in Modbus Init.vi->Main_v0.3.5.vi
    Possible reason: LabVIEW:  File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system.
    In my project library I have Modbus Ethernet Example Slave in directory where the .lvproj file is, and the so the "Open VI Refference.vi"  gets it from there (path is built using "Application Directrory Constant" + Name of VI).
    I've also set "Always include" for MB Eth Example Slave in build properties but I still get the error of not founding the VI.
    Do You have any idea why is it happening?

    For your example, your exe has to reside in the same folder as the project as well. 
    Kudos and Accepted as Solution are welcome!

  • CRIO and ni 9234 modules not working or communicating through fpga with accelerometers, fpga connected to real time application which is also connected to shared variables linked to modbus slave

    Hi,
    I have a compact rio which has a 4 way chassis attached to that chassis is three ni9234 modules they are linked using fpga to a real time application then using shared variables in the low speed loop that are linked to a modbus slave to communicate with dcs, the ni 9234's have accelerometers connected to them with iepe ac coupled option on the c modules, my problem is the real time application seems to be running okay even when power loss occurs it restarts with no problem and the fpga writes to the portable hard drive bin files fine but without a accelerometer connected I get low noise readings as soon as I connect a accelerometer to any one of the 10 outputs it just goes to a fixed number (0.03125) as soon as disconnect it again it reverts back to reading noise, I have run a scan on the modules and only get a spike when I connect or disconnect the accelerometer, I have tested the voltage at the pins of the module and I get 22 volts dc which makes it more likely that the hardware is not the problem but a software is maybe causing this to hang-up, I attach project and files for your perusal. I also carried out a new project which in scan mode directly linked the module input to shared variable and the same scenerio again. Help would be much appretiated. 
    Many thanks
    Jason
    Solved!
    Go to Solution.
    Attachments:
    logger 2plusmodbus2.zip ‏679 KB

    Whren using waveform acquisition with the 9234s we recommend the following FPGA and RT template.
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/209114
    it can be extended as a data logger with:
    http://zone.ni.com/devzone/cda/epd/p/id/6388
    or using shared variables combined with scan engine
    http://zone.ni.com/devzone/cda/tut/p/id/9851
    The FPGA in all of these, as well as the RT framework have been used successfully by 1000s of users.  I would recommend giving these a try. 
    Preston Johnson
    Principal Sales Engineer
    Condition Monitoring Systems
    Vibration Analyst III - www.vibinst.org, www.mobiusinstitute.com
    National Instruments
    [email protected]
    www.ni.com/mcm
    www.ni.com/soundandvibration
    www.ni.com/biganalogdata
    512-683-5444

  • Process Failure when communicating over MODBUS using LabVIEW 2011 and DSC

    I'm currently trying to read from a PLC's holding registers using MODBUS/TCP. I've confirmed that the PLC is updating the values and responding to MODBUS communication correctly using a third party program called Modbus Poll. However, when I try to poll the PLC using LabVIEW's shared variable engine, I am unable to read any values from the same addresses that I'm viewing with Modbus Poll.
    My setup simply consists of a PC connected directly to the PLC over Ethernet, with no router in between. I am using LabVIEW 2011 SP1 with the DSC module.
    I opened the NI Distributed Systems Manager to view the status of all shared variables in the Modbus library that I created and I've noticed that the CommFail bit is permanently set to "true". All other variables with a "read" access mode report "Process Failure". I've tried restarting the process as well as stopping and starting the local variable engine with no success. I've also restarted my computer several times to see if any services were failing, but this does not seem to have fixed the problem.
    I finally resorted to monitoring communications over the network card that I have the PLC plugged into via Ethernet using Wireshark and I've found that while Modbus Poll is communicating with the PLC, many MODBUS and TCP packets are sent and received. However, when solely using LabVIEW or the NI DSM to communicate with the PLC, there does not appear to be any communication over the network card.
    Something that may be worth noting is that I was able to communicate with the PLC and read values from it with the DSM on just one occasion, when I first figured out which addresses I should be reading from. It all stopped working shortly thereafter. Prior to this, "CommFail" was not usually set to "true" with my current configuration. Thinking that it was my firewall, I have since turned my firewall off, but this seems to have had no effect on the problem either.
    Any help on this matter would be appreciated.
    Solved!
    Go to Solution.

    Just a thought but I think the  register addresses used by LabVIEW are one off of the actual register #.  I was using a CRIO as a modbus IO Server and had to shift the register addresses by 1 to get things to work correctly (can;t recall if it was +1 or -1).  This is documented somewhere on ni.com but can;t seem to find it now.  But here is another  link that may help:
    http://zone.ni.com/reference/en-XX/help/371618E-01/lvmve/dsc_modbus_using/
    Dan

  • Binded variables change value of modbus PLC variable when application starts

    Hello,
    I have a front panel with controls binded to some shared variables that use a modbus server to control a PLC. There is no logic behind that front panel, all I want to do is to be able to read/write some variables on the PLC.
    I binded the control with datasocket. The reason I did not use PSP is that I would like to bind the controls programmatically so if the client change the server (that holds the library and the citadel BD) the only thing he would have to do is to change the name of the server in the configuration file. It's seems that there is a bug in the Data Bindingath Property and it always return me an error when I try to bind dynamically (Which is not the case with the DataSocket:URL Property) .
    Now the PROBLEM: 
    Lets say a certains variable on the PLC holds the value 10. When I open my panel, I can see that value (10) a very short moment (milliseconds) and the value shifts to '0'. That undesirable '0' is indded written on the shared variable on the server and on the PLC. After that I can change the same value back and everything works properly. Its seems to me that the problem occurs only at the first connection. Same thing apend with booleans controls.
    I would like to be able to open my application, see the '10' in my control, update it if I want, close the application and get the last value when I re-open it.
    I'm running an executable with the DSC run-time.
    Thanks in advance for your help!
    Vincent

    Hello Vincent,
    This was reported to R&D (#161821) for further investigation.  I noticed that this only happens for controls in subVIs.  Perhaps you could restructure your program so that it no longer needs to view the front panel of its subVIs.  I will let you know if I find any other workarounds.  Thanks for the feedback!
    Regards,
    Burt S

  • 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

  • Polling variables using Modbus IP and labview 8.2.0 shared variables

    I'm using shared variable in order to read/write register on a Watlow PM controller over Modbus IP standard. Once I make a change to FP control, the shared variable polling starts and I no longer get update of any controls or indicators on the FP.
    Just wondering if this is an LV 8.2.0 issue and if any of this is addressed in LV 8.5?
    Thx ahead of time
    richjoh

    Hi richjoh,
    If I understand correctly, there are two issues to address: the status of the UpdateNow shared variable and the fact that your controls and indicators are not updating. 
    When you right-click on UpdateNow in your project and select Properties, what is the data type listed there?  Is it bound to one of the other shared variables that has a value in Variable Manager?
    After changing a control on the front panel, do you continue to see the values changing in Variable Manager even though the controls and indicators do not update on the front panel?  Do you see the same behavior regardless of which control you change? 
    Thanks for the additional information. 
    Jennifer R.
    National Instruments
    Applications Engineer

  • My project writes accelerome​ter data to usb drive but shared variables do not communicat​e with modbus

    Hi there,
    I have got a program that reads input from 3 off 9234 modules on a cRIO, the idea of the program is to read this data and save it in a bin file to a connected usb hard drive, the program also uses shared variables to connect the max signals from the 9234 then send thm to a modbus slave, my problem is that althought I am now getting the correct data on the usb drive I am not getting anything down the modbus link, I attach the program for you to see, all the shared variables are on the rt low speed loop, any help would be most grateful.
    Many thanks
    Jason 
    Solved!
    Go to Solution.
    Attachments:
    logger 2plusmodbus2.zip ‏679 KB

    Hi Jasonh,
    Thanks for posting your code! Due to the lack of comments on the code, would it be possible to direct me to where it sends the code to the modbus slave please?
    This tutorial on How to turn a RT Target into a Modbus Slave using IO Servers may also be of some help.
    Kind regards,
    Tori
    Student

  • Modbus can't share variables: error -1967353901

    Hi guys,
    I'm using for my first time the dsc module,
    and specially the modbus communication part.
    I've tried on winXP (installed on VMware) the given exemples:
    Modbus Fundamentals.vi and ModbusSimulator.vi work,
    but when i want to build mine, it's going on errors.
     - 1: Error -1967353901 occurred at Shared Variable in P1_server_vi.vi
     Possible reason(s):
     LabVIEW DSC:  (Hex 0x8ABC8FD3) The Modbus I/O server
     failed to connect to the Modbus Ethernet slave device.
     Ensure that the Modbus Ethernet slave device works properly
     and that the connection between the Modbus master and slave
     devices is configured correctly.
     This error or warning occurred while writing the following
     Shared Variable:
     \\My Computer\P1_server_lib\000001
     \\my_ip\P1_server_lib\000001
     - 2: it's running but the values of the shared variables are not shared,
      between the server and the client.
     - 3: when i'm using the library of the given exemples, its working,
      I can even add or remove some variables.
     So i looked the configuration of the given library, and the one
     i've created, to compare them, but they are strickly the same.
     Restarted my PC, run it again still the same errors.
    I've tried too on Win7, (no WMware) none of them work,
    neither the given exemples or my program.
    I've enable all NIs software from the firewall.

    Of course,
    Thanks for the reply, I'll be pleased to get the why of this matter.
    I sent you in a .zip file, two projects and their .lvproj, .vi, .lvlib and .aliases
    You have P1_server which is to simulate the server, and P2_client for the client,
    using just one shared variable (create bound variable from the serve) named 000001.
    An action from the server on the boolean button should occured on client Boolean Led.
    But ...
    Best Regards
    Martin
    Attachments:
    dsc_modbus_LMartin.zip ‏18 KB

Maybe you are looking for