Modbus Slave
Hi all,
I have to write a modbus client in LabView. My pc is a slave and has to
communicate with a SPS-station via RS232. Is there a vi available with a
smart interface for read/write ?
Thanks
Rene,
sorry, no.
but you might use a few of the VIs to write your own slave and then send me a
copy ;-)
Urs
Mareike schrieb:
> Hi urs.
>
> Great, the Modbus master works fine.
> But I'm looking for a slave-implementation. Do you have a solution?
>
> Rene
>
> "urs" wrote in message news:[email protected]..
> > Mareike schrieb:
> >
> > > Hi all,
> > >
> > > I have to write a modbus client in LabView. My pc is a slave and has to
> > > communicate with a SPS-station via RS232. Is there a vi available with a
> > > smart interface for read/write ?
> > >
> > > Thanks
> >
> > Mareike,
> >
> > try the dutch companie AIR's free modbus library - I think it's a modBus
> > Master only, but might be a good base to start with.
> >
> > http://www.air.nl/home.htm
> >
> > Best Regards
> > Urs
> >
> >
Similar Messages
-
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 KBWhren 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 -
Hello Ni Forums
This is my first post on this forum and I have been using labview for about 8 months now
I have a problem regarding writing data to modbus registers through an i/o server set as a modbus slave for my 9074 hardware.After I have completed building project and deploying the variables and following instructions from here , it yields no result but a line zeros. I have the Ni DSM open and modbus master setup to see whether the data is actually being read/written from the respective sides which both yield the same line of zeros as well. What I am actually trying to write to is an array of single precision floating data. The registers are structured from ranges F40000-F46534 for 10 elements or have them for range AF40001L1-AF46534L1 of item AF40001L10 where it is an array of length 10. (Referenced ranges here)
I know 1 thing for sure, the modbus connection works and is ready for data requests, I tested this through NI DSM and manually set data for and my master received them .
System and Project specifications
Windows 7 OS
Labview Full Development System 2011
No Labview DSC module but I am using the real time module as referenced by one of the documents
This project is a real time application with fpga mode (not scan interface mode)
The master and slave are the same subnet and network
Modbus Connection Type: TCP
9074 compact rio 8 slots
9234 module x3
9221 module x1
9472 module x1
Shared Variable Engine service running on windows os and rtos system
Used this guide to learn about the modbus protocol as I searched all over the internet to learn about modbus
I already having Modbus IO Server software installed on the crio through ni max version 1.8 for NI RIO 4.0
attached file(s)
Image of Crio software specifications
Image of the Data being written into variable in rt block diagram
Short Version of the problem: Why is the io variable not being written into with properly converted data?The data can have zeros but not all of them will be zeros and I have another program (on local computer for database storage)that is recieving the same data through TCP and they are not zeros.
If a machine is running and is active then the data that will be collected should not be zero , it should infact be some analog value > 0.
I will look into the function you described
How do you view the errors in the IO server subfolders ?
Is it the modbus register called error status that returns an error code if so that value is currently 0
Regards mzamstl
-
Lookout's Modbus Slave Address
Hi,
It appears that the Modbus Slave (Ethernet) Object in Lookout (6.0.1) doesn't work with an Address (or "Identifier") greater than 127.
I tried a simple test with the Modbus Object in one process with an address of 128. And a ModbusSlave Object in another process with its address as 128. There's no communication. However, when I make the addresses 127 (or lower), they yak like nobody's business!
I haven't tested the Serial version though.
Est-ce un bug?
-KhalidHi Khalid,
I think I was overlooking the Lookout 6.01 version that you mentioned earlier in your post ! I was able to recreate the issue that you are facing if I create a modbus slave object in Lookout 6.01 version. Thats a bug! And version 6.02 has a fix for it!
Have a great day!
Regards,
Prashanth -
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 KBI 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! -
Has anyone tried to use LabVIEW as a modbus slave with a PLC master?
Hello. I use modbus extensively with PLCs as slaves. I am finding that it might be benificial to make the PLCs be the master in my next application. I have tried this with the MB Ethernet Example Slave.vi without any luck. Can anyone help?
I am running LabVIEW 8.6 on Windows XP with AutomationDirect PLCs using ethernet communication.
Thank you in advance for your help.
Ron Deavers, CLDHi
There are two options to connect to a Modbus device. Either the Modbus IO Servers (found in the NI LabVIEW Datalogging and Supervisory Control Module) or the free Modbus Library.
FLAsh
National Instruments
Applications Engineer -
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. -
Modbus TCP server/slave implementation
Does anybody have experience to implement a modbus server or slave application? My computer needs to communicate with a PLC. The configuration is: computer is TCP server or slave, PLC is TCP client or master. Computer to write input registers for PLC to read. Computer read holding registers from PLC. Cannot find any labwindows examples.
Thanks a lot.Thank you all for the replies. Most the links are for modbus tcp client (master) instead of modbus server (slave).
Now I am trying to use a modbus slave activeX control (trial version) from Automated Solutions Inc: http://www.automatedsolutions.com/products/modbusslave.asp.
I created an instrument driver using Create ActiveX Controller wizard. I can get a correct object (modbusHandle) with the first line below (status = 0). But the second function (set a property) gives negative status return (status = -2147418113).
status = ASMBSLVLib_New_DASMBSLV (NULL, 1, LOCALE_NEUTRAL, 0, &modbusHandle);
status = ASMBSLVLib__DASMBSLVSetDataMode (modbusHandle, NULL, ASMBSLVLibConst_DATA_MODE_MB_TCP);
Did I create the activeX control correctly? Automated Solutions told me that the ActiveX control is a windowless control. It's a runtime control. Is it a problem?
Thanks in advance.
jzhu0000. -
Bonjours,
Voila mon problème, je cherche à intégrer une communication MODBUS à ma sbRIO. Maintenant, j'ai déja intégrer une interface RS232 dans la FPGA en utilisant les D I/O de ma carte. Mon RS232 en ensuite converti en RS485 en hardware. Ma question est la suivante, j'ai trouvé l'exemple cRIO_MODBUS mais celui-ci est un exemple ou le cRIO est en MASTER, et moi j'aimerais que ma sbRIO soit en SLAVE. Je me demandais si il existait un exemple ou le cRIO est en slave?
Cordialement
Sébastien Kuenlin"How to turn a RT Target into a modbus slave using IO server", ça devrait pouvoir t'aider un peu.
"Introduction à ModBus"
J'espère que ça t'aidera, bon courage!
When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!" -
Hello everybody,
I' m trying to make modbus slave device on labview. Has anybody experiences with the similar project. Please send me some links/advices which could help me in realization of such a project.Hi kingarth,
I made slave devices using NI's Modbus Library for LabView 7.1: http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=F1582737BACF5CA8E0340003BA7CCD71&p_...
This same library should be available for 8.0 and has been downgraded to 7.0 and 6.1.
I found no major difficulties. Programming is enough straightforward, there are examples in the library itself.
I did not test it thoroughly, though, because I only needed a handful of digital inputs.
Paolo
Paolo
LV 7.0, 7.1, 8.0.1, 2011 -
Multiple errors with DSC modules modbus master and slave
Hi,
I've searched quite a lot of posts but haven't found solution for my problem. I'm playing with LabVIEW DSC module and it's modbus master and slave functionalities. Even the LabVIEWs own modbus examples (Modbus Simulator and Fundamentals) seem to work randomly or not at all: When checking the Variable Manager utility Modbus Simulator (i.e. modbus slave/server) seems to deploy variables correctly with good quality but Modbus Fundamentals (i.e. modbus master/client) most often shows unknown value or bad quality for all the variables. When running the VIs I get 'Error -1950679035 Unable to locate variable in the Shared Variable Engine' and sometimes some other errors too. If the Modbus Simulator (slave/server) is expected to work fine I guess I should get two slaves communicating, but this isn't happening either. So maybe Modbus Simulator example isn't working either.
I've tried undeploying and deploying the libraries, stopping and starting the SVE, booting PC, reinstalling DSC module, and setting firewall and antivirus software off. This problem is going on with two different computers, both of which have recently installed LabVIEW 2011, first PC with Win XP and second PC with Win 7. No other OPC servers should be installed to these computers. And what is really interesting, the problem seems to have nothing to do with my network since Simulator and Fundamentals examples are not working even if the network cable is unplugged!
Any suggestions? Replies are highly appreciated!V8 has the same feature, but the words are different.
The Generator typically uses the Driver time base, and the Gl. Var Write is writing once per block.
So, to see all values, you must have a block size of one.
I set up the Driver timebase to 10 Hz, block size of 1. The Generator and the Read Variable default to the Driver timebase.
The Generator is making a 2 Hz Rectangle waveform. YOu can see that it's shifted, but otherwise intact.
- cj
Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab. -
Could VBAI be use as Slave in ModBus communication ?
hello,
I'm working with VBAI 2010, in ModBus comunication I need to use VBAI as Slave.
I saw on help file that it is not possible but in menu "Tools\Communication device\" I can see "Vision Builder AI ModBus Adress :"
What does it mean ?
Is there any solution to use VBAI as slave in ModBus communication ?
FabriceYes, Vision Builder AI can actually only be used as a Modbus slave for now (users can implement the master functionality using a Run LabVIEW step).
To configure Vision Builder AI as a Modbus Slave device, select Tools>>Communication Device Manager.
Click New Device, to create the Modbus Master Device you want Vision Builder AI to communicate with.
Give it a name, then select either the Modbus Serial or Modbus TCP as the communication protocol depending on the physical layer used to connect to your device. For serial, you will need to specify the port and Modbus Mode (the most widely implemented is RTU).
Click OK.
Click the Start Server button, next to the Modbus Server, to start the background task that will listen for incoming Modbus messages. Note that the Modbus registers will be updated asynchronously from your inspection, whenever a Modbus frame is received.
The Vision Builder AI Modbus Slave Address is only used to identify the device, when the protocol is Serial, and you use the RS-485 protocol to connect together more than 2 Modbus devices in a multi-device configuration. Ignore this control if you are using Modbus TCP.
We know this dialog is a little confusing and are working towards improving it in future releases.
Once the server is running, use the Modbus Slave step to read and write the Modbus registers (that are located on the machine running VBAI, since you configured VBAI as a slave device).
Make sure that you specify the correct address in your Modbus Master device configuration software for the register you want to access in Vision Builder AI. In most Modbus device configuration software, you must enter a name for the register you want to use. Per Modbus convention, the register address of the slave device is calculated by subtracting 1 from the register name that you specify in the master device configuration software. Vision Builder AI expects register addresses, not register names, so you may have to subtract 1 from the address you defined in the Modbus device configuration software. For example, a register name defined as 2 in your Modbus configuration device translates to register address 1 in the Vision Builder AI Holding Registers table.
Modbus Device
Holding Register Name = 2
Vision Builder AI
Holding Register Address = 1
The Modbus data model is based on a series of four tables: Discrete Inputs, Coils, Input Registers, and Holding Registers. These tables do not overlap in Vision Builder AI. Some Modbus devices use the following start addresses for these tables.
0x00000 for the Coils
0x10000 for the Discrete Inputs
0x30000 for the Input Registers
0x40000 for the Holding Registers
Because the tables do not overlap in Vision Builder AI, ignore the first digit of the start addresses when entering the addresses in Vision Builder AI. For example, a register name defined as 0x40000 in a Modbus configuration device translates to register address 0 in the Vision Builder AI Holding Registers table.
Modbus Device
Holding Register Name = 0x40000
Vision Builder AI
Holding Register Address = 0
Sometimes you need to subtract 1 from the register name that you specify in the master device configuration software and ignore the first digit of the start address to ensure proper register addressing. For example, a register name defined as 0x40008 in a Modbus configuration device translates to register address 7 in the Vision Builder AI Holding Registers table.
Modbus Device
Holding Register Name = 0x40008
Vision Builder AI
Holding Register Address = 7
The Modbus Local Registers Terminal accessible from the Tools menu is a useful tool to figure out where you're writing data.
Hope this will help you configure the communication between VBAI and your device easily.
Best regards,
-Christophe -
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 KBHi 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 -
Problem Description :
Dear Sir,
We are doing a project where we are using Lookout with
Front end Modicon PLC. The communication is by
Ethernet, using Modbus.
Since the installation is at a distant place, we wanted
to use another PC (running Lookout) to simulate the
PLC. For this, we tried to communicate
a: the server Lookout PC running Modbus Ethernet mode of
Modbus object as Master
b: with another PC (for simulating the PLC) running
Modbus Slave
We did not get any communication. (we have given the
details of what we have done, at the end of this email)
We also tried connecting the above 2 PC's as
a: the server Lookout PC running Modbus Serial mode of
Modbus object as Master
b: with another PC (for simulating the PLC) running
Modbus Slave object
Again we did not get any communication.
If instead of PC (b) we connect the Modbus simulator to
PC (a), there is no problem in communicating
Please let us know how to go about establishing the
communication between 2 PC's using Modbus serial,
and Modbus Ethernet. A detailed step by step procedure
would help us a lot.
Thanking you
Warm Regards
Raja Mahbubani
Procedure of our trial with ethernet.
This is what we have done in detail.
On PC A:
We created an object (Pot) and connected it to
the modbus data member of the modbus object say 40001. In the
properties of the modbus object we selected modbus ethernet mode
of communication and in the IP address field we wrote the IP
address of the machine B to which we are trying to communicate
i.e. 152.63.50.2.
On PC B: we tried the following two methods
Trial 1 : We created a modbus slave object and
inserted an expression for the same data memeber to which the
object was connected hoping to get the value of the pot of machine
A on machine B.
Trial 2 : We created a modbus object on machine B and we wrote
the IP address of machine A and inserted an expression for the
same datamemeber to which the object was connected hoping to get
the value of the pot of machine A on machine B.
NI Software : Lookout
Version : 4.0.1 or 4.5
OS : Windows 98
NI Hardware : N/A
Drivers : N/A
Other Hardware/Instruments : N/A
CPU : Pentium
RAM : 64
Vendor : S-Tech
Customer Information :
Raja Mahbubani
Theta Controls
IN
[email protected]
Ph: (+91) 20 4222556/7The ModbusSlave which comes with Lookout currently supports only Serial communication. So, you cannot use Ethernet between your two PCs. At least not with Modbus Master-Slave setup (if you must speak Ethernet between the two PCs, IPASCII object lets you do that, but then you'll need to implement your own protocol).
Since all you want to do is simulate a Modbus PLC on a PC, you can use the Serial mode of communication for now. And later on just modify the Object in your Server Lookout to use the Ethernet mode.
For setting up a Serial Modbus Slave, use a null-modem cable between the two PCs (lines 2 and 3 are swapped). On your PC 'B,' create the Modbus Slave object with the right COM port for that PC. And on your PC 'A' create the regular Modbus Object as if you w
ere connecting to the Modbus Simulator box. The only difference here is the cable. The simulator box uses a straight-through cable whereas the Slave needs a null-modem cable.
Hope this helps.
Rgds,
Khalid
Maybe you are looking for
-
How to upload excel fiel with 'FileUpload' UI element ?
Hi, my customer donot want to upload excel in CSV format. And how could i convert excel file into my internal table? BR.
-
Need help- On my mac with yosemite, when trying to install my own brushes, I get error message: "Could not load the brushes "blahblah.abr" because the file is not compatible with this version of PS" (PS CC 2014) ????
-
Excise details not maintained for import vendor
Dear All, We have upgraded from 4.7 to 6.0 while doing import scenario we have error to maintain excise details for import vendor. Whereas we are not maintaining any excise details fro import vendor. Please guide me for above problem. Also I think no
-
Finding BADI calls in ABAP Code
Hi Guys, I want to find which program(s) call BADI Interface WORKORDER_UPDATE-INITIALIZE. I've tried the where-used list without luck. Also tried a break-point, but it doesn't stop. PeteA
-
RoboHelp 8 HTML - context sensitive chm file does not open?
This works: RoboHelp_CSH.RH_ShowHelp(0, "C:\\RoboHelp\\!SSL!\\WebHelp\\XHelp_File.htm", RoboHelp_CSH.HH_HELP_CONTEXT, 2); This doesn't RoboHelp_CSH.RH_ShowHelp(0, "C:\\RoboHelp\\!SSL!\\Microsoft_HTML_Help\\XHelp_File.chm", RoboHelp_CSH.HH_HELP_CONTEX