Industrial Communications

cancel
Showing results for 
Search instead for 
Did you mean: 

Change Modbus TCP/IP master IP address programmatically

I think you can understand my frustration.  I have spent weeks learning the new DSC & 2014 packages to upgrade software from LV 7.1 and XP to Win7.  The IP address was the very last element of hundreds of changes I have made to my software.  Now I find out I have to start all over.  Can NI not write a patch, dll or VI to fix this problem.  This software will be installed in Fortune 100 chemical plants and refineries worldwide.  I have no way of controlling their IP addressing system.

T-Ray
0 Kudos
Message 11 of 13
(3,063 Views)

It will be nice if it is possible to access at runtime all or some of the properties in the 'Configure Modbus I/O Server' dialog, for example the IP address for Modbus Ethernet, or the refresh rate.

But even a INI type of file containing some of the server properties, which can be changed manually, before the software launches, will be a big improvement

 

0 Kudos
Message 12 of 13
(3,055 Views)

I have learned much since my original query on this.  You do not have to recompile to change Modbus IP addresses and other parameters in the .lvlib file.  Create a library such as My.lvlib.  Your program should call this library and be compiled using this library.  If you need to change Modbus IP addresses or even change to a serial comm port or chnage Modbus addresses in the library, simply create a new library in the Labview software, give it a different name such as MySerial.lvlib.  I then copy the MySerial.lvlib on top of My.lvlib.  For this to work, all Modbus entries in the library must be given an alias name and refered to by the alias name in your software.  There is no need to recompile the code.  The only need is the LV software to create the library.  I can now modify customer setups by simply sending them a new library file to copy over the old one. There is no need to recompile the code.

 

I also discovered that you can edit the ascii entries in the .lvlib file.  Each Modbus address is stored in the file as a pseudo file path such as My Computer\GWi508ModBus_C1.lvlib\508ModbusSlave\400003.  If I copy _C1 to a new library called GWi508ModBus_C2.lvlib and then append new entries to it, I will have a mix of paths that include _C1 and _C2.  To fix the problem simply do a search and replace in Notepad on the characters _C1 and replace with _C2.  No need to recreate the entire library.  This is a helpful trick if you have a large number of tags.

T-Ray
0 Kudos
Message 13 of 13
(1,446 Views)