02-29-2024 05:24 AM
Hi,
I need to read a data memory area address from an Omron PLC using LabVIEW. To achieve this, the PLC has a fixed IP address and subnet mask assigned to an Ethernet port where I need to connect my PC.
However, my PC's Ethernet card only has one port which is currently being used for internet connection. To connect to the PLC, I've decided to use an Ethernet to USB converter, effectively adding a secondary Ethernet card.
Now, with two Ethernet cards (one native, one via USB), how do I assign the port I want to use for the TCP/IP connection? The TCP/IP Modbus library only requests the slave (the PLC) address, without specifying the master IP address or Ethernet port to use.
It's important to note that I'm working in a professional environment connected to a large Ethernet network. Therefore, the PLC communication needs to function as a separate network where I communicate exclusively through TCP/IP with the PLC.
thx
02-29-2024 05:42 AM
Then put the PLC in a subnet different from your main LAN (say 192.168.1.x instead of 10.0.x.x.). The OS will take care of sending data via the correct adapter.
02-29-2024 06:07 AM
Do I need to make any additional configurations on the PC or in LabVIEW so that the operating system knows where to search for the address? Such as assigning that subnet to the specific Ethernet card or something similar?
Thanks for the response 🙂
02-29-2024 06:46 AM
Yes, of course in the OS you need to set the additional Ethernet card with a static address in the same subnet as the PLC. For example, the card address would be 192.168.0.2 and the PLC 192.168.0.100 with 255.255.255.0 subnet mask (I'm assuming you are able to set the PLC address at will).
02-29-2024 07:02 AM
@miguel_af wrote:
Do I need to make any additional configurations on the PC or in LabVIEW so that the operating system knows where to search for the address? Such as assigning that subnet to the specific Ethernet card or something similar?
Thanks for the response 🙂
As stated, you just need to make sure your two ports on the PC are using different subnets. The PC will take care of everything else based on the IP address you try to connect to with LabVIEW.
03-08-2024 02:51 AM
It seems you don't know what a subnet mask is...
Write your IP adress in binary form, and write your subnet mask below as well:
192 .168 .0 .42
11000000.10101000.00000000.00101010
255 .255 .255 .0
11111111.11111111.11111111.00000000
The subnet mask is always a number of ones, followed by a number of zeros, nothing else.It shows which bits of the IP define the network, and which are for the individual adress of a device within that network. So, IPs 192.168.0.42 and 192.168.0.42 are in different networks if the subnet is 255.255.255.0, but they are in the same network if the subnet is 255.255.254.0
So, the subnet does not define a network. It just defines which part of the IP defines the network.