2

For a couple of days i've been trying to use libnodave as communication library to communicate with a S7-1200 PLC of Siemens(CPU 1214C). With the libnodave library there are a couple of things provided. The Delphi application is working, the windows executable is working.

On the Vmware I'm running Linux and the precompiled binary of testISO_TCP is working. Seems like i can use it, right?

daveInterface * di;
daveConnection * dc;
_daveOSserialType fds;
ds.rfd=openSocket(102, "192.168.0.1");
fds.wfd=fds.rfd;
if (fds.rfd>0) {
    di =daveNewInterface(fds,"IF1",0, daveProtoISOTCP, daveSpeed187k);
    daveSetTimeout(di,5000000);
    dc =daveNewConnection(di,0,0,1);  // insert your rack and slot here
    if (0==daveConnectPLC(dc)) 
    {
       printf("Connected..\n");
    }
}

But when i copy the source code 1:1 to my IDE (Eclipse) i get the following error message:

IF1 error in daveConnectPLC() step 1. retrying...IF1 error in daveConnectPLC() step 1. retrying...IF1 error in daveConnectPLC() step 1. retrying...Couldn't connect to PLC.
Please make sure you use the -2 option with a CP243 but not with CPs 343 or 443.

Seems like there is some error when connecting to the PLC. The following function generates this error:

DaveConnectPLC(dc)

Note that the rack and slot are unchanged when you compare it to the executed binary in Linux!

Is someone able to help me to get it work on the Eclipse IDE? It's quite weird all the executables/binaries are working but when i want to execute it straight from IDE it's not.

Thanks in advance.

ZF007
  • 3,708
  • 8
  • 29
  • 48
user3707349
  • 31
  • 1
  • 2
  • I have a similar problem that I am investigating now. Hopefully I will have an answer for you soon. In my case I had this working for over a year when suddenly after a routine rebuild of my libraries nothing worked anymore. My guess is that nodave is very sensitive to build flags. – Mr. Developerdude Oct 15 '14 at 20:48

1 Answers1

1

First fo all running on virtual is not the same as running on a real computer. That it runs on Windows does not guarantee it runs under Linux despite the fact the source is the same and/or the same libraries are used. Basically the precompiled program under Linux is the only proof that it will and can run.

Whenever I have issues in this area, I look with the compiler version used and compiler settings. Running code with debug option is notorious to corrupt code with hardware communication.

If you were not already using Wireshark, I would highlt recommend to use it. It is a perfect tool to see what's going on.

  • Thanks for answering. I created a program and precompiled it on Linux. Linux is running on the VMware so it's not giving any problems. When i use the same program running from Eclipse, it is not working. I think it's a problem with Eclipse but i'm not sure. I've checked the compiler version and they are both the samen. Running in debug mode made no difference. I have also been using wireshark, seems like i am able to ping the PLC, but it´s not sending any messages back. – user3707349 Jun 10 '14 at 11:04
  • Do you run the program in Eclipse or the result from a shell? It can be that Eclipse is blocking. –  Jun 26 '14 at 15:09