mhh irgendwie mach ich was falsch ich poste dir mal meinen code nicht erschrecken! wird bissl mehr.
Inhalt der S5Class:
Public Class S5Thread
Public Shared Sub ConnectS5()
Dim clsC As clsConfig = New clsConfig
Dim structC As clsConfig.Config
structC = clsC.GetSettings
clsC = Nothing
' S5LAN Verbindung aufbauen
IPAdr1 = structC.IP1
IPAdr2 = structC.IP2
IPAdr3 = structC.IP3
IPAdr4 = structC.IP4
PortNr = structC.Port1
Ref1 = S5LanOpen(IPAdr1, PortNr, 0, 0, 0) 'Ofen1 Verbindung
'Ref2 = S5LanOpen(IPAdr2, PortNr, 0, 0, 0) 'Ofen2 Verbindung
'Ref3 = S5LanOpen(IPAdr3, PortNr, 0, 0, 0) 'Ofen3 Verbindung
'Ref4 = S5LanOpen(IPAdr4, PortNr, 0, 0, 0) 'Ofen4 Verbindung
If Ref1 >= 0 Then
Res1 = S5LanRdW(Ref1, 68, 60, 240, 2, IstLGOHG11(0)) 'LGOHG1 Istwert
Res1 = S5LanRdW(Ref1, 68, 61, 240, 2, IstLGOHG21(0)) 'LGOHG2 Istwert
Res1 = S5LanRdW(Ref1, 68, 62, 240, 2, IstLGOHG31(0)) 'LGOHG3 Istwert
Res1 = S5LanRdW(Ref1, 68, 63, 240, 2, IstLGOHG41(0)) 'LGOHG4 Istwert
Res1 = S5LanRdW(Ref1, 68, 64, 240, 2, IstLGOHG51(0)) 'LGOHG5 Istwert
Res1 = S5LanRdW(Ref1, 68, 65, 240, 2, IstLGOBAD1(0)) 'LGOBAD Istwert
Res1 = S5LanRdW(Ref1, 68, 66, 240, 2, IstALOHG11(0)) 'ALOHG1 Istwert
Res1 = S5LanRdW(Ref1, 68, 67, 240, 2, IstALOHG21(0)) 'ALOHG2 Istwert
Res1 = S5LanRdW(Ref1, 68, 68, 240, 2, IstALOHG31(0)) 'ALOHG3 Istwert
Res1 = S5LanRdW(Ref1, 68, 69, 240, 2, IstALOHG41(0)) 'ALOHG4 Istwert
Res1 = S5LanRdW(Ref1, 68, 70, 240, 2, IstALOHG51(0)) 'ALOHG5 Istwert
Res1 = S5LanRdW(Ref1, 68, 71, 240, 2, IstALOHG61(0)) 'ALOHG6 Istwert
' Werte die für das Füllen der Textboxen in SUA1-Wärme1.vb benötigt
' werden.
Res1 = S5LanRdW(Ref1, 68, 60, 240, 1, Ist2LGOHG11(0)) 'LGOHG1
' Istwert
Res1 = S5LanRdW(Ref1, 68, 61, 240, 1, Ist2LGOHG21(0)) 'LGOHG2
' Istwert
Res1 = S5LanRdW(Ref1, 68, 62, 240, 1, Ist2LGOHG31(0)) 'LGOHG3
' Istwert
Res1 = S5LanRdW(Ref1, 68, 63, 240, 1, Ist2LGOHG41(0)) 'LGOHG4
' Istwert
Res1 = S5LanRdW(Ref1, 68, 64, 240, 1, Ist2LGOHG51(0)) 'LGOHG5
' Istwert
Res1 = S5LanRdW(Ref1, 68, 65, 240, 1, Ist2LGOBAD1(0)) 'LGOBAD
' Istwert
Res1 = S5LanRdW(Ref1, 68, 66, 240, 1, Ist2ALOHG11(0)) 'ALOHG1
' Istwert
Res1 = S5LanRdW(Ref1, 68, 67, 240, 1, Ist2ALOHG21(0)) 'ALOHG2
' Istwert
Res1 = S5LanRdW(Ref1, 68, 68, 240, 1, Ist2ALOHG31(0)) 'ALOHG3
' Istwert
Res1 = S5LanRdW(Ref1, 68, 69, 240, 1, Ist2ALOHG41(0)) 'ALOHG4
' Istwert
Res1 = S5LanRdW(Ref1, 68, 70, 240, 1, Ist2ALOHG51(0)) 'ALOHG5
' Istwert
Res1 = S5LanRdW(Ref1, 68, 71, 240, 1, Ist2ALOHG61(0)) 'ALOHG6
' Istwert
' Werte die für das Füllen der Textboxen(aktuelle Sollwerte) in
' SUA1-Wärme2.vb benötigt werden.
Res1 = S5LanRdW(Ref1, 68, 60, 232, 1, Soll4LGOHG11(0)) 'LGOHG1
' Sollwert
Res1 = S5LanRdW(Ref1, 68, 61, 232, 1, Soll4LGOHG21(0)) 'LGOHG2
' Sollwert
Res1 = S5LanRdW(Ref1, 68, 62, 232, 1, Soll4LGOHG31(0)) 'LGOHG3
' Sollwert
Res1 = S5LanRdW(Ref1, 68, 63, 232, 1, Soll4LGOHG41(0)) 'LGOHG4
' Sollwert
Res1 = S5LanRdW(Ref1, 68, 64, 232, 1, Soll4LGOHG51(0)) 'LGOHG5
' Sollwert
Res1 = S5LanRdW(Ref1, 68, 65, 232, 1, Soll4LGOBAD1(0)) 'LGOBAD
' Sollwert
Res1 = S5LanRdW(Ref1, 68, 66, 232, 1, Soll4ALOHG11(0)) 'ALOHG1
' Sollwert
Res1 = S5LanRdW(Ref1, 68, 67, 232, 1, Soll4ALOHG21(0)) 'ALOHG2
' Sollwert
Res1 = S5LanRdW(Ref1, 68, 68, 232, 1, Soll4ALOHG31(0)) 'ALOHG3
' Sollwert
Res1 = S5LanRdW(Ref1, 68, 69, 232, 1, Soll4ALOHG41(0)) 'ALOHG4
' Sollwert
Res1 = S5LanRdW(Ref1, 68, 70, 232, 1, Soll4ALOHG51(0)) 'ALOHG5
' Sollwert
Res1 = S5LanRdW(Ref1, 68, 71, 232, 1, Soll4ALOHG61(0)) 'ALOHG6
' Sollwert
End If
' Verbindung abbauen
Ref1 = S5LanClose(Ref1)
Ref1 = -1
End Sub
End Class Module:
Imports System.Data.OleDb
Imports System.Data
Imports System.Threading
Module Diverse
Public LadenS5Thread As New System.Threading.Thread(AddressOf _
S5Thread.ConnectS5)
Public S5Thread As New S5Thread
end module nächste Seite..... |