Private Function sumchk(data$) As String '求校驗和函數(shù)
Dim i&
Dim chk&
For i = 1 To Len(dats)
chk = chk + Asc(Mid(dats, i, 1))
Next i
sumchk = Right(Hex$(chk), 2)
End Function
Private Sub Form_Load() '初始化
MSComm1.PortOpen = True
MSComm1.CommPort = 1
MSComm1.Settings = "9600,e,7,1"
MSComm1.InputLen = 0
MSComm1.InBufferCount = 0
MSComm1.OutBufferCount = 0
Dim sd As String
Dim rd As String
sd = "00" + "FF" + "BR" + "0" + "Y0000" + "08"
MSComm1.Output = Chr$(5) + djsd + sumchk(sd)
Do
DoEvents
Loop Until MSComm1.InBufferCount >= 13
rd = MSComm1.Input
請問PLC返回數(shù)據(jù)是什么類型的??假設(shè)Y0--Y7的值為10110111
PLC返回到VB的緩沖區(qū)的值是10110111 還是31H 30H 31H 31H 30H 31H 31H 31H ??
請各位指教!!!