Enhanced IOReadWrite() Extension to MATLAB
(Fix for Slow Port I/O in Cogent 2000)


The inportb() and outportb() functions for accessing hardware I/O ports provided by Cogent 2000 are highly limited in their utility.  To begin with they are very slow - demonstrating latencies of 100 msec.  In addition, they can only access hardware ports located in the very lowest reaches of the 64K I/O port address space (i.e., 0x000-0x3FF).  Windows' Plug 'n Play manager usually maps add-in PCI cards to regions much higher in the address space.  As a result, these PCI cards can not be accessed using the built-in Cogent 2000 commands.

In order to accomplish very fast port I/O using a NO COST extension to MATLAB, we have developed a Java class called IOReadWrite that uses native methods to access low-level hardware.  Once installed, it then becomes simple to import the Java IOReadWrite() class into MATLAB and access its constituent methods for reading (IOReadWrite.read) and writing (IOReadWrite.write) to I/O port locations anywhere in the 64K address space using a 3rd party kernel-level driver for Windows NT/2000/XP named INPOUT32.DLL.  A simple benchmark test (iotimer_inpout32.m) reveals that port I/O latencies of approximately 0.06 msec (i.e., 60 microseconds) can be achieved from within MATLAB using this approach (Most of this latency is due to overhead from the MATLAB and Java interpreters rather than from the I/O driver, per se)

The instructions for installing and testing the enhanced version of IOReadWrite can be found here.
The software (IOReadWrite.jar, usdportio.dll and inpout32.dll) can be found here.

Additional information about the INPOUT32.DLL driver for Windows NT/2000/XP can be found here.

Information about an earlier version of IOReadWrite that uses the UserPort.sys driver can be found here.

Information about an even faster approach to MATLAB port I/O using a C++ mex-file is available here
(This link describes the currently preferred approach to performing port I/O from Cogent 2000)


Professor Schieber's Home Page - Previous Page