Home > other >  Modbus TCP
Modbus TCP

Time:10-04

Private Sub cmdSend_Click ()
On Err GoTo ErrProc
Dim SendStr (11) As Byte
Dim RcvStr () As Byte
SendStr (0)=0
SendStr (1)=0
SendStr (2)=0
SendStr (3)=0
SendStr (4)=0
SendStr (5)=6
SendStr (6)=1
SendStr (7)=& amp; H1
SendStr=3 (8)
SendStr (9)=& amp; HE8
SendStr (10)=0
SendStr (11)=& amp; HA
Dim aStr As String
Dim As Integer I
For I=0 To 11
AStr=aStr & amp; CRH (SendStr (I))
Next
Winsock1. SendData publishes the event aStr
The Exit Sub
ErrProc:
MsgBox "data transmission failure," vbCritical, "network"
End Sub
This code is I want to achieve is:
Tx: 465-50 5 a 00 00 00 06 01 03 01 E8 00 0 a
Rx: 466-50 5 a 00 00 00 05 01 01 00 02 01
Tx: 467-50 5 b 00 00 00 6 01 03 01 E8 00 0 a
Rx: 468-50 5 b 00 00 00 05 01 01 00 02 01
Tx: 469-50 5 00 00 00 c 06 01 03 01 E8 00 0 a
Rx: 470-50 5 00 00 00 c 05 01 01 00 02 01
But I use moabus slave test out error:
000290 - Rx: 00 00 00 00 00 06 00 0 01 03 01 3 f a
000291 - Tx: 00 00 00 00 00 03 01 81 02
Ask ace to give directions
  • Related