comminit.vb

来自「为日本瑞萨苏州分公司做的一个温控系统」· VB 代码 · 共 17 行

VB
17
字号
Module CommInit
    ' 串行口初始化
    Public Sub SCIinit(ByRef MSComm1 As AxMSCommLib.AxMSComm, ByVal COMx As Byte, ByVal SCIFormat As String)
        If MSComm1.PortOpen = True Then
            MSComm1.PortOpen = False
        End If
        MSComm1.CommPort = COMx '串行口号
        MSComm1.Settings = SCIFormat '定义传输格式
        MSComm1.InputMode = MSCommLib.InputModeConstants.comInputModeBinary  '二进制数据格式
        MSComm1.RThreshold = 0 '关闭串行中断
        MSComm1.InputLen = 0 '一次读取缓冲区全部数据
        MSComm1.PortOpen = True '打开串行口
        MSComm1.InBufferCount = 0
    End Sub

End Module

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?