小弟正在做一个实时数据采集系统,其中一个关键是
通过板卡的硬件地址直接读取/发出数据,在Win95/98下
可通过In/out(汇编语言)或_inputb和_outputb函数进行
控制,而Win NT/2000却禁用这些方法,写DDK时间太长,
不知各位有什么快速或简单的方法,请告诉小弟,万分
感谢。。

解决方案 »

  1.   

    可以用MSCOMM6.0控件
    或者用openfile readfile writefile来操作
    很简单的
      

  2.   

    最近几期的《电脑编程技巧与维护》有一篇文章就是讲解决2000如何访问16位串口函数的问题,之中用到了MSCOMM控件。
      

  3.   

    WINIO  我用过的以下是附带的readme.txt 看看列出的功能是否能用                        WinIo v1.2                          
        Direct Hardware Access Under Windows 9x/NT/2000         
                Copyright 1998-2000 Yariv Kaplan                
                    http://www.internals.com                    
    ------------------------------------------------------------The WinIo library allows 32-bit Windows applications to directly
    access I/O ports and physical memory. It bypasses Windows protection
    mechanisms by using a combination of a kernel-mode device driver and
    several low-level programming techniques.Under Windows NT, the WinIo library can only be used by applications
    that have administrative privileges. If the user is not logged on as
    an administrator, the WinIo DLL is unable to install and activate the
    WinIo driver. It is possible to overcome this limitation by installing
    the driver once through an administrative account. In that case, however,
    the ShutdownWinIo function must not be called before the application
    is terminated, since this function removes the WinIo driver from the
    system's registry.The library exports 8 functions:----------------------------------------------------------------------------bool _stdcall InitializeWinIo();This function initializes the WinIo library.For applications running under Windows NT/2000, this function
    must be called before calling any other function in the library.Windows 9x applications are not required to call this function.If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. ----------------------------------------------------------------------------void _stdcall ShutdownWinIo();This function performs cleanup of the WinIo library.For applications running under Windows NT/2000, this function
    must be called before terminating the application or when the
    WinIo library is no longer required.Windows 9x applications are not required to call this function.----------------------------------------------------------------------------bool _stdcall GetPortVal(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize);Use this function to read a BYTE/WORD/DWORD value from an I/O port.Parameters:  wPortAddr - I/O port address  pdwPortVal - Pointer to a DWORD variable that receives the value
                   obtained from the port.  bSize - Number of bytes to read.
              Can be 1 (BYTE), 2 (WORD) or 4 (DWORD).  If the function succeeds, the return value is nonzero.  If the function fails, the return value is zero. ----------------------------------------------------------------------------bool _stdcall SetPortVal(WORD wPortAddr, DWORD dwPortVal, BYTE bSize);Use this function to write a BYTE/WORD/DWORD value to an I/O port.Parameters:  wPortAddr - I/O port address  dwPortVal - A DWORD value to be written to the port  bSize - Number of bytes to write.
              Can be 1 (BYTE), 2 (WORD) or 4 (DWORD).  If the function succeeds, the return value is nonzero.  If the function fails, the return value is zero. ----------------------------------------------------------------------------PBYTE _stdcall MapPhysToLin(PBYTE pbPhysAddr, DWORD dwPhysSize, HANDLE *pPhysicalMemoryHandle)Use this function to map a region of physical memory into the linear address 
    space of a 32-bit Windows application.Here is an example:PBYTE pbLinAddr;
    HANDLE PhysicalMemoryHandle;pbLinAddr = MapPhysToLin(0xA0000, 65536, &PhysicalMemoryHandle);The function will map physical addresses 0xA0000 - 0xAFFFF into the linear
    address space of the application. The value returned is a linear address
    corresponding to physical address 0xA0000. In case of an error, the return
    value is NULL.Parameters:  pbPhysAddr - Pointer to the physical address
      
      dwPhysSize - Number of bytes to map  pPhysicalMemoryHandle - Points to a variable that will receive the physical memory section
                              handle if this call is successful. This handle is later used as
                              the first parameter when calling the UnmapPhysicalMemory function.----------------------------------------------------------------------------bool _stdcall UnmapPhysicalMemory(HANDLE PhysicalMemoryHandle, PBYTE pbLinAddr)Use this function to unmap a region of physical memory which was previously mapped
    to the linear address space of the application using the MapPhysToLin function.Windows 9x applications are not required to call this function.Parameters:  PhysicalMemoryHandle - Handle to the physical memory section which was returned
                             from the call to the MapPhysToLin function.  pbLinAddr - Linear address which was returned from the call to the MapPhysToLin
                  function.----------------------------------------------------------------------------bool _stdcall GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal);This function reads one DWORD from the specified physical address.Parametes:  pbPhysAddr - Pointer to the physical address
      
      pdwPhysVal - Pointer to a DWORD variable that receives the value
                   obtained from the physical memory location.  If the function succeeds, the return value is nonzero.  If the function fails, the return value is zero. ----------------------------------------------------------------------------bool _stdcall SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal);This function writes one DWORD to the specified physical address.Parametes:  pbPhysAddr - Pointer to the physical address
      
      pdwPhysVal - Specifies a DWORD value to be written to the physical
                   memory location.  If the function succeeds, the return value is nonzero.  If the function fails, the return value is zero. ----------------------------------------------------------------------------
                              A NOTE FOR VB USERS
    ----------------------------------------------------------------------------To use winio.dll with a 32-bit Visual-Basic application you need to:1. Place winio.dll and winio.sys in the same directory as your executable file.2. Add winio.bas to your project.----------------------------------------------------------------------------
                                  LEGAL STUFF             
    ----------------------------------------------------------------------------The following terms apply to all files associated with the software
    unless explicitly disclaimed in individual files.The author hereby grants permission to use, copy, modify, distribute,
    and license this software and its documentation for any purpose, provided
    that existing copyright notices are retained in all copies and that this
    notice is included verbatim in any distributions. No written agreement,
    license, or royalty fee is required for any of the authorized uses.IN NO EVENT SHALL THE AUTHOR OR DISTRIBUTORS BE LIABLE TO ANY PARTY
    FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
    ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
    DERIVATIVES THEREOF, EVEN IF THE AUTHOR HAVE BEEN ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.THE AUTHOR AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
    IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHOR AND DISTRIBUTORS HAVE
    NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
    MODIFICATIONS.
    I can be reached at: [email protected] Kaplan
      

  4.   

    MSCOM是串口控件,是不能访问别的地址的。楼上的东东才对。我也有,要就留Mail.
      

  5.   

    你可以直接调用变速齿轮程序中的动态连接库输出函数NTPORT.dll和*.sys WDM驱动程序),可以使用View Depenendency察看该库的输出函数,函数为两个参数,参数类型很容易猜出来。也可以参考本人在《电脑编程技巧与维护》2001/2002年关于NT环境下端口读写两篇拙作。一篇为Windows NT环境下的Direct IO ,另一篇采用也是采用WDM编写的程序实现NT环境下的IO直接读写(程序用于读写40h 42h 43h,这些IO口在NT环境下都是禁止直接读写的)。关于源程序和编译好的程序(提供了简单的动态连接库接口,接口和变速齿轮差不多。如果你需要,也可以把它封装成COM组件,以简化调用)你可以从WWW.COMPRG.COM.CN下载。另外,你可以参考《Undocumented Windows NT》一书(国家图书馆有)。好像又一个TVICPORT(记不太清了)的控件也支持直接读写硬件端口。
      

  6.   

    port_IO  under win9x & ME can  refer CIH source code ,
    Ring3 ->Ring0->IO( in al,61h;and al,0f6h;out 61h,al;mov al,0b6h;out 43h ,0b6,mov ax,bx;out 42h,al; mov al,ah; out 42h,al )->Ring3
      

  7.   

    To: liqi(sniper)
    我想要,[email protected]
      

  8.   

    谢谢你:lj_csdn(大笨蛋) 、 microran2000() 
    不知谁有WinIO或NTPORT,给小弟发一份[email protected]
    有感激分相赠
      

  9.   

    WinIO我也想要。NTPort我有,但需要注册,用起来不方便。[email protected]
      

  10.   

    NTPort注册要30$,谁有注册过的吗?要购买可去ProgramHeaven网站,
    各位大哥,谁能免费相赠[email protected]
      

  11.   

    WinIO我找到啦http://www.internals.com
      

  12.   

    WINIO  我用过的以下是附带的readme.txt 看看列出的功能是否能用->>>>>                http://www.internals.com
      

  13.   

    非常好,谢谢你lj_csdn(大笨蛋)  送你20分
      

  14.   

    对不起,lj_csdn(大笨蛋) 我没有权限给你捐分