MPI- und MPI2-Protokolle mit Libnodave und VB.Net

Earny

Level-1
Beiträge
422
Reaktionspunkte
38
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo,

zuest möchte ich mal allen Foren-Mitgliedern ein gutes Neues Jahr wünschen.
Wenn ich mit meinen alten Siemens-Adaptern eine Verbindung zu einer S7-SPS aufbaue, benutze ich gelegentlich beim Einsatz von LibNoDave das MPI-Protokoll. Dabei ist mir aufgefallen, dass ein Verbindungsaufbau mit dem MPI-Protokoll (unabhängig vom Adapter) nicht mehr möglich ist. Ich bin ganz sicher, dass das noch vor einem Jahr ging! Der Verbindungsaufbau mit dem MPI2-Protokoll ist aber noch möglich.
Mich würde die Ursache für dieses sonderbare Verhalten interessieren.
Hat da jemand eine Idee?

Gruß
Earny


Nachfolgend der Verbindungsaufbau aus meinem Beispielprogramm:

MPI-Protokoll:
Code:
[COLOR=#0000ff][COLOR=#0000ff]Private[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Function[/COLOR][/COLOR] MPI() [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR]
[/COLOR][COLOR=#0000ff][COLOR=#0000ff]Dim[/COLOR][/COLOR] Baud [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]String[/COLOR][/COLOR], Port [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]String[/COLOR][/COLOR], Rack [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR] = 0, Slot [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR] = 2
[COLOR=#0000ff][COLOR=#0000ff]Dim[/COLOR][/COLOR] MPIAdressPLC [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR] = 2, MPIAdressLocal [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR] = 0
Port = cbxCOM.Text
Baud = cbxSpeed.Text
ph = setPort(Port, Baud, Asc([COLOR=#800000][COLOR=#800000]"O"[/COLOR][/COLOR]))
di = daveNewInterface(ph, ph, [COLOR=#800000][COLOR=#800000]"IF1"[/COLOR][/COLOR], MPIAdressLocal, daveProtoMPI, daveSpeed187k)
[COLOR=#0000ff][COLOR=#0000ff]Call[/COLOR][/COLOR] daveSetTimeout(di, 1000000)
res = daveInitAdapter(di)
dc = daveNewConnection(di, MPIAdressPLC, Rack, Slot)
res = daveConnectPLC(dc)
Timer1.Enabled = [COLOR=#0000ff][COLOR=#0000ff]True[/COLOR]
[/COLOR]btnAufbau.Enabled = [COLOR=#0000ff][COLOR=#0000ff]False[/COLOR]
[/COLOR]btnAbbau.Enabled = [COLOR=#0000ff][COLOR=#0000ff]True[/COLOR]
[/COLOR]MPI = 0
[COLOR=#0000ff][COLOR=#0000ff]End[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Function[/COLOR]
[/COLOR]

MPI2:
Code:
[COLOR=#0000ff][COLOR=#0000ff]Private[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Function[/COLOR][/COLOR] MPI2() [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR]
[/COLOR][COLOR=#0000ff][COLOR=#0000ff]Dim[/COLOR][/COLOR] Baud [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]String[/COLOR][/COLOR], Port [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]String[/COLOR][/COLOR], Rack [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR] = 0, Slot [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR] = 2
[COLOR=#0000ff][COLOR=#0000ff]Dim[/COLOR][/COLOR] MPIAdressPLC [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR] = 2, MPIAdressLocal [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR] = 0
Port = cbxCOM.Text
Baud = cbxSpeed.Text
ph = setPort(Port, Baud, Asc([COLOR=#800000][COLOR=#800000]"O"[/COLOR][/COLOR]))
di = daveNewInterface(ph, ph, [COLOR=#800000][COLOR=#800000]"IF1"[/COLOR][/COLOR], MPIAdressLocal, daveProtoMPI2, daveSpeed187k)
[COLOR=#0000ff][COLOR=#0000ff]Call[/COLOR][/COLOR] daveSetTimeout(di, 1000000)
res = daveInitAdapter(di)
dc = daveNewConnection(di, MPIAdressPLC, Rack, Slot)
res = daveConnectPLC(dc)
Timer1.Enabled = [COLOR=#0000ff][COLOR=#0000ff]True[/COLOR]
[/COLOR]btnAufbau.Enabled = [COLOR=#0000ff][COLOR=#0000ff]False[/COLOR]
[/COLOR]btnAbbau.Enabled = [COLOR=#0000ff][COLOR=#0000ff]True[/COLOR]
[/COLOR]MPI2 = 0
[COLOR=#0000ff][COLOR=#0000ff]End[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Function[/COLOR]
[/COLOR]

Funktionsaufruf im Libnodave-Modul:
Code:
[COLOR=#0000ff][COLOR=#0000ff]Public[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Declare[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Function[/COLOR][/COLOR] daveNewInterface [COLOR=#0000ff][COLOR=#0000ff]Lib[/COLOR][/COLOR] [COLOR=#800000][COLOR=#800000]"libnodave.dll"[/COLOR][/COLOR] ([COLOR=#0000ff][COLOR=#0000ff]ByVal[/COLOR][/COLOR] fd1 [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR], [COLOR=#0000ff][COLOR=#0000ff]ByVal[/COLOR][/COLOR] fd2 [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR], [COLOR=#0000ff][COLOR=#0000ff]ByVal[/COLOR][/COLOR] name [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]String[/COLOR][/COLOR], [COLOR=#0000ff][COLOR=#0000ff]ByVal[/COLOR][/COLOR] localMPI [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR], [COLOR=#0000ff][COLOR=#0000ff]ByVal[/COLOR][/COLOR] protocol [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR], [COLOR=#0000ff][COLOR=#0000ff]ByVal[/COLOR][/COLOR] speed [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR][/COLOR]) [COLOR=#0000ff][COLOR=#0000ff]As[/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff]Integer[/COLOR]
[/COLOR]


Gruß
Earny
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Das MPI-Protokoll hatte ich zuletzt eigentlich nicht mehr eingesetzt, sondern im Zusammenhang mit den alten Siemens-Adaptern nur noch das MPI2. Ehrlich gesagt hatte ich das MPI-Protokoll nur der Vollständigkeit halber mal eingesetzt. Ich meine mich zu erinnern, dass das MPI2-Protokoll minimal schneller arbeitete, als das MPI-Protokoll.

Erstaunt war ich nur darüber, dass das mit dem MPI-Protokoll jetzt überhaupt nicht mehr geht. Ich bin mir nicht bewusst, irgendetwas am VB-Programm geändert zu haben:confused:.


Gruß
Earny
 
Zurück
Oben