Attribute VB_Name = "Module1"
Rem 串行口初始化
Public Sub SCIinit(Msc1 As MSComm, ByVal COMx As Byte, ByVal SCIFormat As String)
   If Msc1.PortOpen = True Then
      Ms1.PortOpen = False
   End If
   Msc1.CommPort = COMx                   '串行口号
   Msc1.Settings = SCIFormat              '定义传输格式
   Msc1.InputMode = comInputModeBinary    '二进制数据格式
   Msc1.RThreshold = 0                    '关闭串行中断
   Msc1.InputLen = 2                      '一次读取缓冲区全部数据
   Msc1.PortOpen = True                   '打开串行口
   Msc1.InBufferCount = 0
End Sub

