hi everyone!
Im trying to get and put data in a LOGO V8. Im programming with visual studio vb.net 2013.
I use the example given in \snap7-full-1.4.2\snap7-full-1.4.2\examples\dot.net\WinForm\VB7
and I changes a few parameters (like ip, add buttons to write data)
everything goes well except that thrown this error ISO : An error occurred during send TCP : Connection reset by peer.
this is de code
Private Sub ReadBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReadBtn.Click
' Declaration separated from the code for readability
Dim DBNumber As Integer
Dim Size As Integer
Dim Result As Integer
Dim c, y As Integer
Dim s As String
'
TxtDump.Text = ""
DBNumber = System.Convert.ToInt32(TxtDB.Text)
Size = System.Convert.ToInt32(TxtSize.Text)
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
Result = Client.DBRead(DBNumber, 0, Size, Buffer)
ShowResult(Result)
' If OK dumps the data (quick and dirty)
If Result = 0 Then
y = 0
For c = 0 To Size - 1
s = Hex$(Buffer(c))
If s.Length = 1 Then
s = "0" + s
End If
TxtDump.Text = TxtDump.Text + "0x" + s + " "
y = y + 1
If y = 8 Then
y = 0
TxtDump.Text = TxtDump.Text + Chr(13) + Chr(10)
End If
Next
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim result As Integer
Dim bait(1) As Byte
bait(0) = 1
bait(1) = 1
result = Client.DBWrite(1, 0, 2, bait)
ShowResult(result)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim result As Integer
Dim bait(1) As Byte
bait(0) = 0
bait(1) = 0
result = Client.DBWrite(1, 0, 2, bait)
ShowResult(result)
End Sub
i have 3 buttons, one for reading , and two for write to the LOGO.
i only have the pc and the LOGO over the net. NO TRAFFIC
Whats wrong?
thank you very much
someone tell me this
the logo needs to be "refreshed", the read/write frequency must be less then 10 sec. otherwise it disconnects
but I dont know how to do it.
please help
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi everyone!
Im trying to get and put data in a LOGO V8. Im programming with visual studio vb.net 2013.
I use the example given in \snap7-full-1.4.2\snap7-full-1.4.2\examples\dot.net\WinForm\VB7
and I changes a few parameters (like ip, add buttons to write data)
everything goes well except that thrown this error ISO : An error occurred during send TCP : Connection reset by peer.
this is de code
Private Sub ReadBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReadBtn.Click
' Declaration separated from the code for readability
Dim DBNumber As Integer
Dim Size As Integer
Dim Result As Integer
Dim c, y As Integer
Dim s As String
'
TxtDump.Text = ""
DBNumber = System.Convert.ToInt32(TxtDB.Text)
Size = System.Convert.ToInt32(TxtSize.Text)
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
Result = Client.DBRead(DBNumber, 0, Size, Buffer)
ShowResult(Result)
' If OK dumps the data (quick and dirty)
If Result = 0 Then
y = 0
For c = 0 To Size - 1
s = Hex$(Buffer(c))
If s.Length = 1 Then
s = "0" + s
End If
TxtDump.Text = TxtDump.Text + "0x" + s + " "
y = y + 1
If y = 8 Then
y = 0
TxtDump.Text = TxtDump.Text + Chr(13) + Chr(10)
End If
Next
End If
End Sub
i have 3 buttons, one for reading , and two for write to the LOGO.
i only have the pc and the LOGO over the net. NO TRAFFIC
Whats wrong?
thank you very much
someone tell me this
the logo needs to be "refreshed", the read/write frequency must be less then 10 sec. otherwise it disconnects
but I dont know how to do it.
please help