Industrial Communications

cancel
Showing results for 
Search instead for 
Did you mean: 

Change Modbus TCP/IP master IP address programmatically

We have a program running on CompactRIO cRIO-9024, no chassis. The software is developed in LabVIEW RT 2011.

The secondary network port (eth1) is configured as Modbus TCP/IP master and we are talking to a third party Modbus slave device.

 

The software is running without any problems for years, but now we have to change the IP address of the Modbus master, respectively the slave. Specifically we need to move in a different network sub-net, i.e. instead of the current 192.168.1.x, we have to use for example 192.168.111.x

 

My question is: can we make the Modbus TCP/IP master IP address configurable? In other words, can we change it grammatically?

Right now, in order to make this change I have to create a new executable. So, is there a way to change our settings, software, etc... so that in the future we can read the IP address of the Modbus master from a configuration file and change it via software. I am trying to avoid recompiling the source code.

 

Nick

0 Kudos
Message 1 of 13
(10,513 Views)

Hey Chembo,

 

Please take a look at this post. Hopefully it could be usefull.

 

"How do I change the Modbus Address of a Modbus IO Server programatically?"
http://forums.ni.com/t5/LabVIEW/How-do-I-change-the-Modbus-Address-of-a-Modbus-IO-Server/td-p/279504...

 

Regards!

 

Daniel C.

0 Kudos
Message 2 of 13
(10,486 Views)

Hi Danubio,

 

Thanks for the information. This post is related to the Modbus address. In my case I need to change the IP address setting in the Modbus I/O Server configuration. This IP address links to the Modbus server (slave) which I want to connect to from my software running on the CompactRIO.

 

And here is also an update for everyone who looks for information about this setting:

 

I talked today to NI support and it seems that the IP address can be changed only manually from the dialog box included as screenshot in my initial post. There is no way, at least for now, to change this setting programmatically.

 

Nick

0 Kudos
Message 3 of 13
(10,477 Views)

I doubt you can avoid a recompile.

 

 

But, if you re-write the application, removing the I/O server, and use either the Modbus Library V1.2.1, or the new Modus API (Which now officially supported in 2014). Then you can programatically change the slave (server) IP address, and just about anything else you might want to change programatically.

 

0 Kudos
Message 4 of 13
(10,389 Views)

Has anyone solved this problem yet?  I need to change an IP address for a ModBus Master using the DSC module.  Recompiling is not an option.

Can you undeploy the library, write the new IP address into the .lvlib file and redeploy?   

T-Ray
0 Kudos
Message 5 of 13
(9,752 Views)

The library is included in your executable. I don't think you can change the IP without recompiling.

 

Temporary this seems to be possible with the NI Distributed System Manager. You can see the deployed library and when you click the Modbus Server with the right mouse button, the 'Edit I/O Server..." option is available. The IP address can be changed. I am not sure if it is required to stop/start the process, or the changes are applied also when the process is running. If it works at all, the setting will be active until the next library deployment.

 

 

0 Kudos
Message 6 of 13
(9,740 Views)

That's a bummer.  I cannot recompile for every customer's installation.  The only method availble then is to use a dedicated Ethernet network so I can have predetermined IP addresses.  This is poor programming on NI's part.  Do they plan on fixing this in the near future? 

T-Ray
0 Kudos
Message 7 of 13
(9,737 Views)

You can work around it, potentially, using the DSC VIs mentioned in the earlier post. I/O servers should be deployable without recompiling the cRIO code. However, this does require a windows machine to create and deploy the library.

 

To the best of my knowledge the only way to change the address on the fly is using one of the APIs.

0 Kudos
Message 8 of 13
(9,732 Views)

@T-Ray wrote:

That's a bummer.  I cannot recompile for every customer's installation.  The only method availble then is to use a dedicated Ethernet network so I can have predetermined IP addresses.  This is poor programming on NI's part.  Do they plan on fixing this in the near future? 


Even a dedicated Ethernet port doesn't always help (see the very first posting of this thread). We were asked to move the primary network port address of the CompactRIO to the subnet of the secondary port. Well, the change is easy with the web based administration tool, but unfortunately two ports on the same machine cannot work in the same subnet. This is true for VxWorks based CompactRIOs. Supposedly with NI Linux on the new models similar configuration should fine.

Sometimes it is very difficult to recompile existing software, because it may be considered as a big change and will require a lot of time and work until it can be validated and released for production.

 

The LabVIEW Modbus API seems to be a good choice for new development or upgrades of existing software. One more reason to switch to LabVIEW 2014 RT, if possible 🙂

 

0 Kudos
Message 9 of 13
(9,719 Views)

@chembo wrote:
 

The LabVIEW Modbus API seems to be a good choice for new development or upgrades of existing software. One more reason to switch to LabVIEW 2014 RT, if possible 🙂

 


While you're waiting for that upgrade you can always use the unsupported NI Labs release (https://decibel.ni.com/content/docs/DOC-30140). Its similar to the 2014 code so upgrading shouldn't be too difficult whenever you do move to 2014.

0 Kudos
Message 10 of 13
(9,710 Views)