Libnodave: connectPLC returns -1

2019-08-08 21:40发布

问题:

I'm trying to connect to a Siemens CPU315-2 DP via Ethernet by a CP 343-1 Lean using Libnodave dll.

I've tried the example program "simpleISO_TCP.cs" contained in the download file. The function openSocket works just fine but the function connectPLC always returns -1 wich means that the connection to the PLC fails.

Anyone knows what could cause this problem?

PS: I'm using Visual Studio 2012 in Windows 7 64 bit.

回答1:

A few things for you to check:

  • Is the correct hardware configuration downloaded to the PLC
  • Can you ping PLC IP Address
  • If Simatic is installed have you disabled Port 102 service
  • Is your rack and slot number correct

I would try to use the testISO_TCP.exe located in the win folder. Run it from cmd prompt with IP Address and -w flag which will write to some memory addresses(ensure that it safe to do this if it is a production PLC)

I was just doing some work with this library and it was fine using a CPU 317-2 PN/DP with a CP343-1 (6GK7 343-1EX11-0EX0)