用mscomm控件写的串口通信程序,在本机上运行正常。但在没有装vb的电脑上就不行了。错误提示为:compouent mscomm32.ocx or one of its dependencies not correctly registered a file is missing or invalid
这是连接了一个有rs232-c接口的数字万用表。用于开关电源产品测试。
源代码如下:
望各位高手指点一下:谢谢!!
Private Sub Command1_Click()
    With MSComm1
    
    If .PortOpen = False Then
    .CommPort = 1
    .Settings = "9600,n,8,1"
    .PortOpen = True
    Else
    Exit Sub
    End If
    End With
End Sub
Private Sub Command2_Click()
    With MSComm1
    .Output = "*RST"
    .Output = ":TRAN:TERM 1"
    .Output = ":VOLT:AUTO OFF;RANGE 300"
    .Output = ":CURR:AUTO OFF;RANGE 2"
    .Output = ":RESPONSE FAST"
    .Output = ":scale:pt 1;ct 1:sc 1"
    .Output = ":rect 1"
    .Output = ":integ:time 1,0,0"
    .Output = "*ese 0:*sre 0"
    .Output = ":ese0 32;:ese1 0;:ese2 0"
    .Output = ":data:time 0,1,0:item 7,9"
    .Output = "*cls"
    .Output = ":integ:stat start"
    .Output = "*stb?"
    .Output = "DISPLAY V,A,W,HZ"
    .Output = "*cls"
    .Output = ":MEAS? V,A,HZ,W"
    .InputMode = comInputModeText
    .InputLen = 0
    .RThreshold = 2
    .RTSEnable = True
    End With
    
End Sub
Private Sub Form_Load()
    With MSComm1
    
    If .PortOpen = False Then
    .CommPort = 1
    .Settings = "9600,n,8,1"
    .PortOpen = True
    Else
    Exit Sub
    End If
    End With
End Sub
Private Sub MSComm1_OnComm()
  
   Select Case MSComm1.CommEvent
Case comEvReceive
        ReceByte = ReceByte & MSComm1.Input
        D$ = Mid$(ReceByte, 44, 11)
        fl = Val(D$)
        Text1.Text = fl
End Select
End Sub



 
											





 
	    

 
	
 
											
 6rUpeJBM.rar
6rUpeJBM.rar
