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

📄 winio.bas

📁 89S51系列编程器的资料,是学习开发编程器的好资料
💻 BAS
字号:
Attribute VB_Name = "Module1"
Option Explicit
Dim Result As Boolean
Dim Portval As Long

Declare Function GetPortVal Lib "WinIo.dll" (ByVal PortAddr As Integer, ByRef Portval As Long, ByVal bSize As Byte) As Boolean
Declare Function SetPortVal Lib "WinIo.dll" (ByVal PortAddr As Integer, ByVal Portval As Long, ByVal bSize As Byte) As Boolean
Declare Function InitializeWinIo Lib "WinIo.dll" () As Boolean
Declare Function ShutdownWinIo Lib "WinIo.dll" () As Boolean

Public Declare Function GetTickCount Lib "kernel32" () As Long
'延时 TT ms 子程序
Sub TimeDelay(TT As Long)
  Dim t As Long
  t = GetTickCount()
  Do
    DoEvents
    If GetTickCount - t < 0 Then t = GetTickCount
  Loop Until GetTickCount - t >= TT
End Sub
'将DataOut 输出到地址为Address的端口子程序
Public Sub DIO_OutputByte(ByVal Address As Integer, ByVal DataOut As Integer)
    Portval = DataOut
    Result = SetPortVal(Address, Portval, 1)
End Sub
'返回地址为Address 的端口的值
Public Function DIO_InputByte(ByVal Address As Integer) As Integer
  Result = GetPortVal(Address, Portval, 1)
  DIO_InputByte = Portval
End Function

⌨️ 快捷键说明

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