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