Jump to content

Recommended Posts

Do you mean Modbus instead of OPC?

Modbus-TCP is normally on port 512. On a Vision350 you can use Socket 2, which is by default initialized for Modbus. But you can also use any other socket and any other free port number. In this case you have to call 'Socket Init' on your Vision and you also have to change the port number on your cfw011.

cheers

Udo

Link to comment
Share on other sites

2 hours ago, udubiel said:

Do you mean Modbus instead of OPC?

Modbus-TCP is normally on port 512. On a Vision350 you can use Socket 2, which is by default initialized for Modbus. But you can also use any other socket and any other free port number. In this case you have to call 'Socket Init' on your Vision and you also have to change the port number on your cfw011.

cheers

Udo

Currently using modbus through an OPC server, I contacted support here in Brazil and he said that I could be using port 20256, however the moment I set the IP and start the FB config I put the 2 ports and indicated the  IP of my slaves ??  I'll be posting the program here, tomorrow.

Link to comment
Share on other sites

  • MVP 2023

There are example programs that came with your VisiLogic installation that show you the proper way to set up MODBUS TCP communications. You can have a continuous connection with up to 4 MODBUS TCP devices by using the 4 available sockets. You will need to initialize the sockets with the proper protocol and port number, as well as set up your MODBUS IP configuration for each.

Link to comment
Share on other sites

3 minutes ago, Flex727 said:

There are example programs that came with your VisiLogic installation that show you the proper way to set up MODBUS TCP communications. You can have a continuous connection with up to 4 MODBUS TCP devices by using the 4 available sockets. You will need to initialize the sockets with the proper protocol and port number, as well as set up your MODBUS IP configuration for each.

Hello Flex727, 

So I will be setting the socket 20256 as master in my network with the inverters and in the FB ip config I will be configuring the ip of the slaves and the port that in the case would be 502, and in another FB ip config I will be configuring as slave of my OPC server on the port  502.

Link to comment
Share on other sites

  • MVP 2023

Briefly, (and perhaps over simplified), a Port is an address that is visible to the outside world. A Socket hosts the Port for the communications. You have 4 Sockets in your Unitronics PLC (numbered 0-3) and therefore you have 4 paths for communications over Ethernet. You can mix and match protocols as you wish, but you only have 4 that you can use at one time. Each of the 4 Sockets has a default configuration, but you can change that with a Socket Initialization FB. If you're going to use MODBUS TCP, you must have a MODBUS IP configuration FB for each Socket that will be using MODBUS TCP. Both the Socket Initialization and the MODBUS configuration should be activated with SB 2.

Link to comment
Share on other sites

43 minutes ago, Flex727 said:

Resumidamente, (e talvez mais simplificado), uma porta é um endereço que é visível para o mundo exterior. Um soquete hospeda a porta para as comunicações. Você tem 4 Soquetes no seu PLC Unitronics (numerados 0-3) e, portanto, você tem 4 caminhos para comunicações pela Ethernet. Você pode misturar e combinar protocolos como quiser, mas você só tem 4 que você pode usar ao mesmo tempo. Cada um dos 4 Sockets tem uma configuração padrão, mas você pode alterar isso com um FB de inicialização de soquete. Se você for usar o MODBUS TCP, você deve ter um FB de configuração de IP MODBUS para cada soquete que usará o MODBUS TCP. Tanto a inicialização do soquete quanto a configuração do MODBUS devem ser ativadas com o SB 2.

Hello Flex, the program is attached, Thank You vary much for Help me !!!


Link to comment
Share on other sites

  • MVP 2023

Leave Socket 1 mapped to port 20256 and don't use it in your program.  Visilogic uses these for programming over Ethernet.

6 hours ago, udubiel said:

Modbus-TCP is normally on port 512

Actually, the default is 502 but it can be any port.  And the Master and Slave don't have to be the same, you just have to know what the number is on each side.

@Edilson Adriano Lucas - you didn't post any documentation links to cfw011 so I didn't dig into the specifics  of it's communication.  I'm guessing from looking at your program that you've already figured out the register map.

 

I hacked on your code a bit for the socket assignment.  I picked port 503 on the PLC side using local Socket 3 to talk the the VFD on it's port 502.

If all this port / socket stuff sounds confusing that's because it is.  Especially for someone new to Ethernet communications who's trying to understand Modbus and wondering why the PLC can't talk to whatever they want because their computer has no problem with this.

The UniStream series buries all this under the hood and is much easier to configure.

Anyway, off my soapbox.  You have to get what you have working.  Let us know your further questions.

Joe T.

 

TestModbusCFW11_JT.vlp

Link to comment
Share on other sites

49 minutes ago, Joe Tauser said:

Deixe o Soquete 1 mapeado para a porta 20256 e não o use em seu programa. Visilogic usa estes para programar em Ethernet.

Na verdade, o padrão é 502, mas pode ser qualquer porta. E o Mestre e o Escravo não precisam ser os mesmos, você só precisa saber qual é o número de cada lado.

@Edilson Adriano Lucas  - você não postou nenhum link de documentação para cfw011, então eu não investiguei os detalhes de sua comunicação. Eu estou supondo que, olhando para o seu programa, você já descobriu o mapa de registro.

 

Eu cortei seu código um pouco para a atribuição de soquete. Eu escolhi a porta 503 no lado do PLC usando o soquete local 3 para falar o VFD na porta 502.

Se todo esse material de porta / soquete parece confuso, é porque é. Especialmente para alguém novo nas comunicações Ethernet que está tentando entender o Modbus e se perguntando por que o PLC não pode falar com o que quiser, porque o computador não tem problema com isso.

A série UniStream enterra tudo isso sob o capô e é muito mais fácil de configurar.

De qualquer forma, fora do meu palanque. Você tem que conseguir o que você está trabalhando. Deixe-nos saber suas dúvidas.

Joe T.

 

TestModbusCFW11_JT.vlp 222,33 kB · 0 downloads

Hello Joe, thank you very much for your attention.
So I'm communicating with the inverters and my question really is which port to use.
I recently ran a UDP communication project with or PLC, where I succeeded, but a friend once made the communication through the TCP protocol with other CLPs together with the OPC server system and eventually came into conflict I believe he used the same ports .

Currently my scenario as described above is to perform the communication between the PLC with the Inverter and at the same time communicate with the OPC server, you could be typing some topic that can specify more about the port configurations.

My other question is whether the reading and writing logic is correct, or you use another pattern.

Many thanks for now.
Link to comment
Share on other sites

  • MVP 2023

Hey @Joe Tauser, I notice you place an inverted contact of SB 2 in front of the SCAN_EX FB. I've seen other people do this also, but I have never done it in any of my hundreds of projects over the last many years and never experienced a problem related to the slave scanning. Is there really a purpose or any advantage for this?

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.

Guest
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...