IOTOOLS工具的使用

返回
 

IOTOOLS工具概况

为了避开 Windows 对底层硬件操作的屏蔽,特别是为了从底层操作瑞博华公司提供各种板卡,瑞博华公司提供了 WDM 方式下 ( 从而可同时支持 Windows 98/Me/2000/XP 环境,也有相应的 VXD 版本,供 Windows 95/98/Me 使用 ) 操作硬件端口的驱动程序 IOTOOLS 。应用程序通过直接调用 IOTOOLS.DLL( 正确安装后位于 Windows\system 或 Winnt\system32 目录 ) 来实现对硬件端口的访问。

IOTOOLS 驱动程序主要提供了按字节、字、双字读和写硬件端口的 inport/outport 函数。同样的函数在 ADCard 驱动程序和 RBHIO.DLL 中也提供,用户可以自由选择。

编程所需文件

用户程序为使用 IOTOOLS 驱动程序,直接调用 IOTOOLS.DLL 中的函数即可。为在 C 、 C++ 语言中调用 IOTOOLS ,头文件为 IOTOOLS.H ,也可直接借用 ADCard.H 。 VC 的库文件为 IOTOOLS.LIB , C++Builder 的库文件为 _IOTOOLS.LIB 。 VB 下使用模块文件 IOTOOLS.BAS 即可。 Delphi 下使用单元文件 IOTOOLS.PAS 即可。

C/C++下的头文件 iotools.h 定义为

#ifdef __cplusplus

extern "C" {

#endif

//IO tools function

void __stdcall outportb(WORD port, WORD value);

WORD __stdcall inportb(WORD port);

void __stdcall outport(WORD port, WORD value);

WORD __stdcall inport(WORD port);

void __stdcall outportdw(WORD port, DWORD value);

DWORD __stdcall inportdw(WORD port);

#ifdef __cplusplus

}

#endif

VB下模块文件 iotools.bas 的内容为

Declare Sub DllOutportB Lib "IOTOOLS.DLL" Alias "_outportb@8" (ByVal Port As Integer, ByVal Value As Integer)

Declare Sub DllOutport Lib " IOTOOLS.DLL" Alias "_outport@8" (ByVal Port As Integer, ByVal Value As Integer)

Declare Sub DllOutportDW Lib " IOTOOLS.DLL" Alias "_outportdw@8" (ByVal Port As Integer, ByVal Value As Long)

Declare Function DllInportB Lib " IOTOOLS.DLL" Alias "_inportb@4" (ByVal Port As Integer) As Integer

Declare Function DllInport Lib " IOTOOLS.DLL" Alias "_inport@4" (ByVal Port As Integer) As Integer

Declare Function DllInportDW Lib " IOTOOLS.DLL" Alias "_inportdw@4" (ByVal Port As Integer) As Long

Delphi下的单元定义文件 IOTOOLS.PAS 的内容为

unit IOTools;

interface

uses

Windows;

{Function declaration or IOTools.DLL}

//IO tools function

procedure outportb(port:word; value:word);stdcall; external 'iotools.dll' name '_outportb@8';

function inportb(port:word):word; stdcall; external 'iotools.dll' name '_inportb@4';

procedure outport(port:word; value:word);stdcall; external 'iotools.dll' name '_outport@8';

function inport(port:word):word; stdcall; external 'iotools.dll' name '_inport@4';

procedure outportdw(port:word; value:longword);stdcall; external 'iotools.dll' name '_outportdw@8';

function inportdw(port:word):longword; stdcall; external 'iotools.dll' name '_inportdw@4';

implementation

end.

IOTOOLS编程示例

瑞博华公司提供使用 IOTOOLS 的 C 语言 Console 模式 (IO_Test) 、 VC(VCTestIO) 、 VB 等的使用示例程序。

演示 IO700 板功能的 VC 示例程序 VC_Test700 综合使用了 IOTools 和 LocatePCI 工具。同样功能的 VB 版演示程序见 VB_Test700 , Delphi 版的演示程序见 Dtest700 。