Sign in to follow this  
Zerout23

Select RTU or TCP/IP

Recommended Posts

Hello,

Is there  a way where I can have a user select whether they want to connect to a single device using either RTU or TCP/IP.

Currently I have a Button Component with the sequence

device.MyDevice.ConfigureComm() 

However, this only allows the user to configure the device using the protocol that I preconfigure. I would want them to select whether they want to connect using a serial or ethernet connection.

Share this post


Link to post
Share on other sites

There are a couple ways to do it, but the easiest is simply to preconfigure a serial and an ethernet port, giving them unique names.  Then you can just do:

device.myDevice.PortName = "mySerialPort"

or

device.myDevice.PortName = "myEthernetPort"

You will probably have to do initcomm() after switching.

Note you can also do this with the ProtocolName variable to switch protocols.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this