⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module1.bas

📁 keilc程序+proteus+vb+串口调试
💻 BAS
字号:
Attribute VB_Name = "Module1"
'*************************************************************************
'*                      声明引用 ZlgComPort API函数
'*************************************************************************
                
        '------------------------------------------------------------
        '说明:  设置通信波特率
        '参数:  Baud  波特率(bit)
        '返回:  True 设置波特率成功、False 设置波特率失败
        '------------------------------------------------------------
Declare Function SetCommBaud Lib "ZlgComPort.dll" (ByVal Baud As Integer) As Boolean

        '------------------------------------------------------------
        '说明:  设置通信端口
        '参数:  Port  通信端口号(1-4)
        '返回:  True 设置通信端口成功、False 设置通信端口失败
        '------------------------------------------------------------
Declare Function SetCommPort Lib "ZlgComPort.dll" (ByVal Port As Integer) As Boolean

        '------------------------------------------------------------
        '说明:  打开通信端口
        '参数:  无
        '返回:  0 打开通信端口成功、非0打开通信端口失败
        '------------------------------------------------------------
Declare Function OpenPort Lib "ZlgComPort.dll" () As Integer

        '------------------------------------------------------------
        '说明:  关闭当前通信端口
        '参数:  无
        '返回:  0 关闭当前通信端口成功、非0关闭当前通信端口失败
        '------------------------------------------------------------
Declare Function ClosePort Lib "ZlgComPort.dll" () As Integer

        '------------------------------------------------------------
        '说明:  发送数据命令
        '参数:  pOrderBuff  发送数据首地址、pAckBuff 接收数据首地址、
        '       nTimeOuts 发送命令超时
        '返回:  0 发送数据成功、非0发送数据失败
        '------------------------------------------------------------
Declare Function SendOrder Lib "ZlgComPort.dll" (ByRef pOrderBuff As Byte, ByRef pAckBuff As Byte, ByVal nTimeOuts As Integer) As Integer




'*************************************************************************
'*                      声明引用系统API函数
'*************************************************************************
        
        '------------------------------------------------------------
        '说明:  挂起当前线程
        '参数:  dwMilliseconds  挂起时间(毫秒)
        '返回:  无
        '------------------------------------------------------------
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)




'*************************************************************************
Private Declare Function CreatePair Lib "VSPDCTL.DLL" (ByVal Port1$, ByVal Port2$) As Boolean
Private Declare Function DeletePair Lib "VSPDCTL.DLL" (ByVal Port$) As Boolean
Private Declare Function DeleteAll Lib "VSPDCTL.DLL" () As Boolean
Private Declare Function SetStrictBaudrateName Lib "VSPDCTL.DLL" (ByVal Port$, ByVal StrictBaudrate As Boolean) As Boolean
Private Declare Function SetStrictBaudrateHandle Lib "VSPDCTL.DLL" (ByVal Handle As Long, ByVal StrictBaudrate As Boolean) As Boolean
Private Declare Function SetStrictBaudrate Lib "VSPDCTL.DLL" (ByVal Port$, ByVal StrictBaudrate As Boolean) As Boolean
Private Declare Function SetBreak Lib "VSPDCTL.DLL" (ByVal Port$, ByVal bBreak As Boolean) As Boolean
Private Declare Function QueryBus Lib "VSPDCTL.DLL" (ByVal InBuffer As String, sizeInBuffer As Long, ByVal OutBuffer As String, sizeOutBuffer As Long) As Boolean
Private Declare Function SetWiring Lib "VSPDCTL.DLL" (ByVal Port1$, ByVal Buffer As String, sizeBuffer As Long) As Boolean

⌨️ 快捷键说明

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