用VB编写的地磅程序,请高手给一个用VB 的mscomm控件编写的地磅程序,端口是串口com1的,希望给出说明 20
我们司的地磅是梅特勒托利多8142PRO+的,读取的地磅数据能在文本框中显示出来,如皮重,毛重等,谢谢请高手指点一下,以下VB代码,为何收到地磅数据是都为00008000...
我们司的地磅是梅特勒托利多 8142PRO+的,读取的地磅数据能在文本框中显示出来,如皮重,毛重等,谢谢
请高手指点一下,以下VB代码,为何收到地磅数据是都为0000 80 00000 00000 80
怎样才能收到正确的过磅数?
Dim abytReceive() As Byte
Dim s As Single
Private Sub Command1_Click()
Dim x As Integer
For i = 0 To UBound(abytReceive)
s = Hex(abytReceive(i))
Text1.Text = Text1.Text & s
Next i
End Sub
Private Sub Form_Load()
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
MSComm1.CommPort = 1
MSComm1.Settings = "9600,n,8,1"
MSComm1.InputLen = 1
MSComm1.InputMode = comInputModeBinary
MSComm1.InBufferSize = 1024
MSComm1.PortOpen = True
MSComm1.InBufferCount = 0
MSComm1.SThreshold = 1
'MSComm1.InputLen = 0
'Text1.Text = MSComm1.Input
Text1.Text = " "
End Sub
Private Sub MSComm1_OnComm()
abytReceive = MSComm1.Input()
End Sub 展开
请高手指点一下,以下VB代码,为何收到地磅数据是都为0000 80 00000 00000 80
怎样才能收到正确的过磅数?
Dim abytReceive() As Byte
Dim s As Single
Private Sub Command1_Click()
Dim x As Integer
For i = 0 To UBound(abytReceive)
s = Hex(abytReceive(i))
Text1.Text = Text1.Text & s
Next i
End Sub
Private Sub Form_Load()
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
MSComm1.CommPort = 1
MSComm1.Settings = "9600,n,8,1"
MSComm1.InputLen = 1
MSComm1.InputMode = comInputModeBinary
MSComm1.InBufferSize = 1024
MSComm1.PortOpen = True
MSComm1.InBufferCount = 0
MSComm1.SThreshold = 1
'MSComm1.InputLen = 0
'Text1.Text = MSComm1.Input
Text1.Text = " "
End Sub
Private Sub MSComm1_OnComm()
abytReceive = MSComm1.Input()
End Sub 展开
2012-03-02
展开全部
要 熟悉 梅特勒托利多 8142PRO+的 使用、参数等等 才行!
推荐看书
Visual_Basic与_RS-232_串行通信控制
推荐看书
Visual_Basic与_RS-232_串行通信控制
追问
Visual_Basic与_RS-232_串行通信控制 这书能发一下吗
追答
email 给 homewaygd@gmail.com
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询