谁知道visual c++中如何实现对硬件I/O口操作?
望各位不吝赐教!!
谢谢!!
e-mail :[email protected]

解决方案 »

  1.   

    Input a byte (_inp), a word (_inpw), or a double word (_inpd) from a port.
    但是,要看什么OS了。9x可以直接访问硬件,在NT,2K,inp就没有用了。
      

  2.   

    也可以直接收发数据,用:_outp(),_outpw()...
                            _inp(),_inpw()...
    查查msdn
      

  3.   

    下载DLPortIO软件,在9X、2000、NT、下都可以读写端口,
    该软件还提供了很好的VC例程,非常好。 软件全称:
    DriverLINX Port I/O Driver for Win95 and WinNT
      

  4.   

    去这儿看看,对你因该有所帮助:http://www.gjwtech.com/
      

  5.   

    http://www.internals.com/utilities/winio.zipWhy should I use the WinIo library if I can simply call the _inp/_outp functions? 
    Port access under Windows 9x is possible as long as you refrain from accessing trapped ports. Several VxDs hook I/O ports to virtualize hardware and will block any attempt to modify these ports from a Windows application. If you wish to control a piece of hardware which is mapped to free addresses such as 300h, you can use the inp/outp functions with no fear. However, any attempt to access system ports (such as those reserved for the DMA chip, HD controller, etc.) will be to no avail. To control such ports from your application, you'll need to use the WinIo library which executes in ring 0 and bypasses Windows port trapping mechanism. Under Windows NT/2000, user mode applications are completely prohibited from accessing I/O ports. Any attempt to access an I/O port from a ring 3 application is terminated with a protection fault. Thus, the only way to overcome this limitation is by using a kernel-mode device driver, such as the one supplied with the WinIo library.
      

  6.   

    _outp(int port);
    _inp(int port);
      

  7.   

    直接插入汇编
    调用c的 _outp inp
    文件操作
    设计端口设备驱动程序