I tried to connect to a S7 300 with an USB MPI device. I use C# . I installed PG/PC interface 2.0.
I tried with s7online, but I get -1 as response. libnodave.openS7online("S7ONLINE") s7online is an exist access point name.
I dont know what is the problem. :-(
Is s7online is good for me??
My code what i tried:
libnodave.daveOSserialType fds;
libnodave.daveInterface di;
libnodave.daveConnection dc;
int localMPI = 3;
int plcMPI = 2;
fds.rfd = libnodave.openS7online("S7ONLINE");
fds.wfd = fds.rfd;
if (fds.rfd > 0)
{
di = new libnodave.daveInterface(fds, "IF1", localMPI, libnodave.daveProtoS7online, libnodave.daveSpeed187k);
di.setTimeout(1000000);
int res = di.initAdapter();
if (res == 0)
{
dc = new libnodave.daveConnection(di, plcMPI, 0, 2);
}
else
{
throw new Exception("Hiba az adapterhez való kapcsolódás során!");
}
}
else
{
throw new Exception("Hiba a megnyitás során!");
}
if (!_Kapcsolodva)
{
int er = dc.connectPLC();
if (0 == er)
{
_Kapcsolodva = true;
}
else
{
dc.disconnectPLC();
}
}
I interested in every solution.
Thank you!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I tried to connect to a S7 300 with an USB MPI device. I use C# . I installed PG/PC interface 2.0.
I tried with s7online, but I get -1 as response. libnodave.openS7online("S7ONLINE") s7online is an exist access point name.
I dont know what is the problem. :-(
Is s7online is good for me??
My code what i tried:
libnodave.daveOSserialType fds;
libnodave.daveInterface di;
libnodave.daveConnection dc;
int localMPI = 3;
int plcMPI = 2;
fds.rfd = libnodave.openS7online("S7ONLINE");
fds.wfd = fds.rfd;
if (fds.rfd > 0)
{
di = new libnodave.daveInterface(fds, "IF1", localMPI, libnodave.daveProtoS7online, libnodave.daveSpeed187k);
di.setTimeout(1000000);
int res = di.initAdapter();
if (res == 0)
{
dc = new libnodave.daveConnection(di, plcMPI, 0, 2);
}
else
{
throw new Exception("Hiba az adapterhez való kapcsolódás során!");
}
}
else
{
throw new Exception("Hiba a megnyitás során!");
}
if (!_Kapcsolodva)
{
int er = dc.connectPLC();
if (0 == er)
{
_Kapcsolodva = true;
}
else
{
dc.disconnectPLC();
}
}
I interested in every solution.
Thank you!