beiye1234
級別: 略有小成
|
請教各位關(guān)于VB6.0與S7-200以太網(wǎng)通訊(Winsock),本人剛接觸VB6.0。 要求:對Q0.3置1 VB6.0程序如下 Private Sub Command1_Click() Dim sendstr(7) As Byte sendstr(0) = &H1 '站地址 sendstr(1) = &H5 '功能碼 sendstr(2) = &H0 sendstr(3) = &H3 '目標(biāo)地址 sendstr(4) = &HFF sendstr(5) = &H0 '線圈置1 sendstr(6) = &H0 '校驗(yàn)碼 sendstr(7) = &H0 '校驗(yàn)碼 Dim astr As String Dim i As Integer For i = 0 To 7 astr = astr & Chr(sendstr(i)) Next SockServer.SendData astr End Sub Private Sub Form_Load() SockServer.LocalPort = 2000 SockServer.RemoteHost = "192.168.1.60" ‘PLC地址 SockServer.RemotePort = 1 ’PLC站地址 End Sub 用以太網(wǎng)鏈接測試,沒效果。 這個(gè)程序那個(gè)地方有問題?應(yīng)該怎么改。 [ 此帖被beiye1234在2011-04-16 11:21重新編輯 ] |
---|---|
|