EasyManua.ls Logo

YASKAWA MP3000 Series - Page 355

YASKAWA MP3000 Series
435 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
2.12 Communications with a Windows PC (Visual Basic Application)
Using Automatic Reception with the MP3000 as a Slave
2-337
Ethernet Communications
'---- Set the reference number ----
sbuf(18) = CByte(Adr And &HFF) 'Adr(L)
sbuf(19) = CByte((Adr And &HFF00)\256) 'Adr(H)
'---- Set the number of registers ----
sbuf(20) = CByte(DataNum And &HFF) 'DataNum(L)
sbuf(21) = CByte((DataNum And &HFF00) \256) 'DataNum(H)
'---- Convert from Byte to String ----
For i = 0 To 21
Swork = Hex(sbuf(i))
If Len(Swork) = 1 Then
Swork = "0" + Swork
End If
Ssbuf = Ssbuf + Swork
Next
Return 0
End Function
'------------------------------------------------------------------------------
’Check response data
'------------------------------------------------------------------------------
Function ChkRspData(ByVal rlen As Short, ByRef Srbuf As String) As Short
Dim i, j As Integer
Dim rcvDATAi As Short
Dim rc As Short
rc = 0
'---- Convert from String to Byte ----
j = 0
For i = 0 To rlen - 1
rbuf(i) = Val("&H" & Mid(Srbuf, j + 1, 2))
j = j + 2
Next
'---- Check the total data length ----
If rlen = (18 + sbuf(20) 2) 2 Then
rc = -1
Return (rc)
End If
'---- Check the packet type ----
If (rbuf(0) <> &H19) Then
rc = -2
Return (rc)
End If

Table of Contents

Other manuals for YASKAWA MP3000 Series

Related product manuals