libnodave 0.8.5 and Delphi XE4

DeJure

Level-1
Beiträge
2
Reaktionspunkte
0
Zuviel Werbung?
-> Hier kostenlos registrieren
Hello all,

I do try to read couple of bytes from Siemens S7-300 PLC with libnodave library. The hardware i use:
CPU 315-2DP
CP 343-1 Lean

Software:
Delphi XE4
Libnodave 0.8.5
Windows 7 x86

I do not use TNoDaveComponent, just nodave.pas. Here is the fragment of my code:
Code:
var
address : array[0..20] of ansichar;
s : ansistring;
i : integer;
fds : _daveOSserialType;
di : pdaveinterface;
dc : pdaveconnection;

begin
s := '192.168.5.1';  //IP of PLC
i := length(s);
for i := 1 to length(s) do
  address[i-1] := s[i];
  address[length(s)] := #0;
fds.rfd := openSocket(102, address);
fds.wfd := fds.rfd;
showmessage(inttostr(fds.rfd));
di := davenewinterface(fds, 'IF1', 0, daveprotoISOTCP, 2);
di^.timeout:=100;
daveinitadapter(di);
showmessage(inttostr(daveinitadapter(di)));
dc := davenewconnection(di, 2, 0, 2);
daveconnectPLC(dc);
showmessage(inttostr(daveconnectPLC(dc)));

As a result:
fds = integer between 390-410; That one is ok.
daveinitadapter(di) = 0; According documentation should be 0, so ok.
daveconnectPLC(dc) = -1; According documentation should be 0, so i do not connect to PLC.

I did change all char and pchar variables in nodave.pas to ansichar and pansichar.

Anybody could point me out what am i doing wrong? I did try NoDaveDemo, supported with library and it works fine.

Thank you in advance.
 
Zuletzt bearbeitet:
Zurück
Oben