📄 winio.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 + -