发表于:2009/4/22 18:23:48
#0楼
Dim x1, k1, k2
Dim p11, p22 '定义变量
Dim aa() As Byte '定义数组
--------------------------------
Private Sub Timer1_Timer()
MSComm1.PortOpen = True
ReDim aa(0 To 5)
k1 = 0
If k1 = 0 Then MSComm1.Output = "1" + Chr(10) + Chr(13)
Do While MSComm1.InBufferCount = 0
Loop
aa = MSComm1.Input
If aa(0) > 64 Then GoTo xxx:
k2 = Int(aa(0) * 255 + aa(1) * 1)
Select Case k2
Case 1
p11 = Int(aa(2) * 255 + aa(3) * 1)
p22 = Int(aa(4) * 255 + aa(5) * 1)
Case Else
End Select
k1 = k1 + 1
If k1 > 2 Then k1 = 0
xxx:
MSComm1.PortOpen = False
End Sub
-------------------------------
如何让p11和p22显示浮点数?
请高手帮帮忙,回答一下!!!
谢谢!
Dim p11, p22 '定义变量
Dim aa() As Byte '定义数组
--------------------------------
Private Sub Timer1_Timer()
MSComm1.PortOpen = True
ReDim aa(0 To 5)
k1 = 0
If k1 = 0 Then MSComm1.Output = "1" + Chr(10) + Chr(13)
Do While MSComm1.InBufferCount = 0
Loop
aa = MSComm1.Input
If aa(0) > 64 Then GoTo xxx:
k2 = Int(aa(0) * 255 + aa(1) * 1)
Select Case k2
Case 1
p11 = Int(aa(2) * 255 + aa(3) * 1)
p22 = Int(aa(4) * 255 + aa(5) * 1)
Case Else
End Select
k1 = k1 + 1
If k1 > 2 Then k1 = 0
xxx:
MSComm1.PortOpen = False
End Sub
-------------------------------
如何让p11和p22显示浮点数?
请高手帮帮忙,回答一下!!!
谢谢!