MSComm1.Output 在vb.net里变成什么了?
Dim Val_Run() As Byte '定义发送的数据为字节为元素的数组。
Dim i As Integer
Dim Temp() As String
Const Temp_Str = "68 21 21 68 02 00 7C 32 01 00 00 00 00 00 14 00 00 28 00 00 00 00 00 00 FD 00 00 09 50 5F 50 52 4F 47 52 41 4D BA 16"
MSComm1.RThreshold = 1
Temp = Split(Temp_Str, " ")
ReDim Val_Run(UBound(Temp))
For i = 0 To UBound(Temp)
Val_Run(i) = Val("&H" & Temp(i))
Next i
PLC_Cmd = "Run"
MSComm1.Output = Val_Run
以上代码中的MSComm1.Output 在vb.net里变成什么了?不是 serialport1.Write吧?
[解决办法]
见:VB.NET 串口工程