Public Declare Sub SetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Sub ClrPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Sub NotPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Function GetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte) As Boolean
Public Const DataReg = &H278
Public Const StatusReg = &H279
Public Const CtlReg = &H27A
ClrPortBit CtlReg, 3
SetPortBit CtlReg, 2
ClrPortBit CtlReg, 5 '將DataPort設定為輸出
PortOut DataReg, Value '輸出命令
' For j = 1 To 20 '100
' Next j
'3向交握<以下>
Dim Ack As Boolean
'提出Request
ClrPortBit CtlReg, 2
ChkAck: '等待回應Ack
Ack = GetPortBit(StatusReg, 6)
If Ack = True Then GoTo ChkAck 作者: liyf 时间: 2015-11-12 09:50