NETLink PRO Compact & Libnodave Verbindung geht nicht

Senator42

Level-2
Beiträge
927
Reaktionspunkte
80
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo NETLink PRO Compact & Libnodave Freunde,

--- Problem ---
Ich habe einen "Netlink Lite", S7 und ein VB6-Proggi mit Libnodave.
Das alle geht.
Nun habe ich einen "NETLink PRO Compact" und wollte mein VB-Proggi damit laufen lassen.
(Code steht unten).
Bei
retCode = daveConnectPLC(hConnection)
bekomme ich jedoch Fehler -4.

--- bisherige Erfahrung ---
mit dem anderen Netlink (ein nun schon betagter Netlink Lite)
funktioniert mein VB-Programm, S7-Manager (Status-FC, Var etc.) geht auch

Das Setup der mitgelieferten CD habe ich noch nicht angerührt,
weil ich dachte Libnodave und VB reicht für mein Vorhaben.
S7 habe ich natürlich auch noch nicht benutzt.


--- Hardware ---
NETLink PRO Compact von Helmholz
Ethernet
SPS: S7-300 CPU 312

--- NETLink-Parameter ---

NETLink PRO Compact Status
==========================

Device Specific Parameters
--------------------------
Product Name NETLink PRO Compact
Product Order Number 700-884-MPI21
Firmware Version V2.50 (sw: 0000 wl: 0000 do: 01)
Bios Version V2.39
Serial Number T00052684
MAC Address 00:06:71:19:CD:CC
Device Name SPS

MPI/PPI/PROFIBUS Status
--------------------------
NETLink Bus Address 0
Online bus parameters Baud rate (kBit/s) 187.5 HSA 31
Tslot_Init 415 Ttr 9984
Max. Tsdr 400 Min Tsdr 20
Tset 12 Tqui 0
Gap Factor 5 Retry 2
List of active stations 0, 2
List of passive stations -
Currently used connections 1 (max. 32)

TCP/IP Status
--------------------------
Ethernet State 100Base-TX full-duplex
IP Address 192.168.0.63
Subnet Mask 255.255.255.0
Gateway Address 0.0.0.0
Listen on port 7777 Default port 7777 is always active.
DHCP OFF
Connected to client address 192.168.0.4
Security Interface ON/OFF OFF
Write Protection ON/OFF OFF
Currently used TCP connections 0 (max. 16)

MPI/PROFIBUS Settings
--------------------------
Go online after boot up ON
NETLink Bus Address 0
Single Master OFF

RFC Multi Computing OFF Bus Address: 2
RFC Routing over CPs OFF Rack(0-7): 0 Slot(0-31): 2



--- code ---
hSocket = openSocket(MyParam.iPort, MyParam.sIP)
' funktioniert


MyParam.iDaveLocaleMPI = 0
' Public Const daveProtoMPI_IBH = 223 ' MPI with IBH NetLink MPI to ethernet gateway */
MyParam.iDaveProtoll = daveProtoMPI_IBH
MyParam.iDaveSpeed = daveSpeed187k
hInterface = daveNewInterface(hSocket, hSocket, "Roberts_Verbindung", _
MyParam.iDaveLocaleMPI, MyParam.iDaveProtoll, MyParam.iDaveSpeed)
' funktioniert

l = 1000000
Call daveSetTimeout(hInterface, 2 * l)


MyParam.iDaveMPI = 2
MyParam.iDaveRACK = 0
MyParam.iDaveSLOT = 2
hConnection = daveNewConnection(hInterface, _
MyParam.iDaveMPI, MyParam.iDaveRACK, MyParam.iDaveSLOT)
' funktioniert

retCode = daveConnectPLC(hConnection)
Debug.Print "retCode = "; retCode ' ---> -4

' funktioniert NICHT !


Weiss jemand was ich falsch mache?

--- ende ---
 
Ich kenne den NETLink PRO Compact selbst nicht. Gut möglich, daß Libnodave mit denen nicht klarkommt. Um das zu wissen, müßte ich die Debug-Ausgabe sehen. Können NETLink PROs nicht ISO over TCP? Wenn ja, würde ich es damit machen.
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Ich kenne den NETLink PRO Compact selbst nicht. Gut möglich, daß Libnodave mit denen nicht klarkommt. Um das zu wissen, müßte ich die Debug-Ausgabe sehen. Können NETLink PROs nicht ISO over TCP? Wenn ja, würde ich es damit machen.

müßte ich die Debug-Ausgabe

wie schalte ich die Debug-Ausgabe denn ein?

im modul habe ich dies:

Code:
Public Declare Function openSocket Lib "libnodave.dll" (ByVal Port As Long, ByVal peer As String) As Long
Public Declare Function daveNewInterface Lib "libnodave.dll" (ByVal fd1 As Long, ByVal fd2 As Long, ByVal Name As String, ByVal localMPI As Long, ByVal protocol As Long, ByVal speed As Long) As Long
Public Declare Function daveInitAdapter Lib "libnodave.dll" (ByVal hInterface As Long) As Long
Public Declare Function daveNewConnection Lib "libnodave.dll" (ByVal hInterface As Long, ByVal mpi As Long, ByVal Rack As Long, ByVal Slot As Long) As Long
Public Declare Function daveConnectPLC Lib "libnodave.dll" (ByVal dc As Long) As Long
Public Declare Function daveDisconnectPLC Lib "libnodave.dll" (ByVal dc As Long) As Long
Public Declare Function daveDisconnectAdapter Lib "libnodave.dll" (ByVal dc As Long) As Long
Public Declare Function closePort Lib "libnodave.dll" (ByVal fh As Long) As Long
Public Declare Sub daveFree Lib "libnodave.dll" (ByVal item As Long)
Public Declare Function daveReadBytes Lib "libnodave.dll" (ByVal dc As Long, ByVal area As Long, ByVal areaNumber As Long, ByVal start As Long, ByVal numBytes As Long, ByVal buffer As Long) As Long
Public Declare Function daveWriteBytes Lib "libnodave.dll" (ByVal dc As Long, ByVal area As Long, ByVal areaNumber As Long, ByVal start As Long, ByVal numBytes As Long, ByRef buffer As Byte) As Long
Public Declare Function daveSwapIed_32 Lib "libnodave.dll" (ByVal X As Long) As Long
Public Declare Function daveSwapIed_16 Lib "libnodave.dll" (ByVal X As Long) As Long

Public Declare Function setPort Lib "libnodave.dll" (ByVal portName As String, ByVal baudrate As String, ByVal parity As Byte) As Long
Public Declare Sub daveSetTimeout Lib "libnodave.dll" (ByVal di As Long, ByVal maxTime As Long)
Public Declare Function daveGetTimeout Lib "libnodave.dll" (ByVal di As Long) As Long

Public Declare Function toPLCfloat Lib "libnodave.dll" (ByVal f As Single) As Single
Public Declare Function daveToPLCfloat Lib "libnodave.dll" (ByVal f As Single) As Long
Public Declare Function daveGetFloatfrom Lib "libnodave.dll" (ByRef buffer As Byte) As Single
Public Declare Function daveGetFloat Lib "libnodave.dll" (ByVal dc As Long) As Single
Public Declare Function daveGetFloatAt Lib "libnodave.dll" (ByVal dc As Long, ByVal pos As Long) As Single

Public Declare Function davePutFloat Lib "libnodave.dll" (ByRef buffer As Byte, ByVal value As Single) As Long
 
Im FAQ des Forums steht, wie man die Testprogramme nutzt:
http://www.sps-forum.de/faq/62825-libnodave-beispiel-tcp-verbindung-zu-s7-welt.html

testNLpro oder testISO_TCP sind deine Freunde.

Im eigenen Programm mit daveSetDebug

im modul habe ich dies:
...
In WELCHEM??????????? Und warum sagst du mir das?

im Beispiel für BASIC/VBA (Modul12.bas) ist daveStDebug mit drin !!!
Und noch ein nützlicher Hinweis darunter:

Private Declare Sub daveSetDebug Lib "libnodave.dll" (ByVal level As Long)
Private Declare Function daveGetDebug Lib "libnodave.dll" () As Long
'
' You may wonder what sense it might make to set debug level, as you cannot see
' messages when you opened excel or some VB application from Windows GUI.
' You can invoke Excel from the console or from a batch file with:
' <myPathToExcel>\Excel.Exe <MyPathToXLS-File>VBATest.XLS >ExcelOut
' This will start Excel with VBATest.XLS and all debug messages (and a few from Excel itself)
' go into the file ExcelOut.
 
danke, es geht jetzt. und zwar so:

1. habe die neuste von sourceforge geholt (ich hatte noch keine "daveProtoNLpro" drin)
testNLpro.exe -w -a 192.168.0.63
hat sofort funktioniert !

2. MyParam.iDaveProtoll = daveProtoNLpro

3. daveInitAdapter(hInterface) (hatte ich nicht, ging bei "Netlink Lite" ohne !)

4. daveSpeed187k oder daveSpeed19k ist irgendwie völlig egal. warum?

5. Port 1099 oder 7777 ist auch egal. (liegt wohl an: "Additional NETLink Port" )

ABER bei:
retCode = daveDisconnectPLC(hConnection)
bleibt es hängen, für immer.

Habe als erste funktion
daveSetDebug (10)
eingebaut. Aber ich weiss nicht wie die logdatei heisst. Müsste die nicht dort liegen wo VB6.exe liegt.
(bin mom in der VB6 IDE)

6. C++: wo wird eigentlich
typedef struct _daveConnection daveConnection;
als LONG umdefiniert ?
Denn in VB:
Public hInterface As Long ' handle von daveNewInterface
Public hConnection As Long

schönen dank noch, und wie geht daveDisconnectPLC(hConnection) ohne hängenbleiben?
 
Du bekommst nur einen Zeiger auf den struct _daveConnection und der ist halt "long". Und du gibts einfach den Zeiger immer wieder an die DLL!

davesetdebug setzt nur den loglevel, es gibt kein logfile es wrid immer in stdout (oder stderr) geloggt! Weis nicht ob du das mit vb6 beobachten kannst (in csharp oder vb.net gehts, das siehst du einfach im ausgabe (output) fenster!
 
Zurück
Oben