Jump to content

ModbusTCP/VisiLogic communication on the same port

Recommended Posts

Is it OK to switch between Modbus TCP and communication with VisiLogic on the same Socket.
Code how I do it in attached project.
I tested it and it worked, but then after a day I had a problem that communication with barcode readers was not working.
Basically what I do when I change between Modbus TCP/VisiLogisc, I run all communication initialization - TCP/IP CARD INIT, SOCKET INIT, Modbus IP CONFIG.
What I have found out that when I change from Modbus to VisiLogic, while Socket reinitializes to another port ( I use 20256 for VisiLogic and 20257 for Modbus), protocol
stays Modbus (I can see this in info view). So when changing to VisiLogic i do PLC restart with SB300 and then initilalization.

Any comments on  that ? Have you done something similar ?


Link to comment
Share on other sites

  • MVP 2023

As far as I can tell, you cannot change the configuration (as opposed to the protocol) of a socket without a configuration FB. It seems that the socket initialization (or card initialization) should reset the configuration, but it doesn't except by PLC reset. Since there is no PCOM configuration FB that I am aware of, it seems that a PLC reset is your only option. You might want to contact Unitronics support to confirm this, and if confirmed, request they add the feature on a future update to VisiLogic.

I'd like to find out that I'm wrong about this as I think it's an oversight by Unitronics.

Link to comment
Share on other sites

  • MVP 2023

I'm surprised this does anything.  You're not calling your subroutine from the Main.  It is also a very good idea to keep most of your inits in the Main routine.

What you're doing should work- I have initialized sockets on the fly in a similar fashion.  I believe you that Modbus IP takes over and won't let go.

I would break the init logic into smaller networks, as you really don't need to keep re-banging sockets three and four.

I would also assign separate Function in Progress bits to all your Modbus IP config blocks - I think they may be stepping on each other.

I've poked on your program a bit and attached it.  Let us know if I've led you down the wrong path.

Or you could dial up to a V700 and you get 8 sockets.

Joe T.

2x_Modbus JT.vlp

Link to comment
Share on other sites

  • MVP 2023
11 hours ago, Joe Tauser said:

I believe you that Modbus IP takes over and won't let go.

Before I wrote my comment I re-created his routine with just one socket and tried everything I could to get the MODBUS configuration to let go without a PLC reset. Nothing worked. I was very surprised. I also took a look at the System Integers that denote socket configuration, but they are all read-only. I'm thinking Unitronics needs to address this if possible.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...