社区
硬件/系统
帖子详情
在WINDOWS下有什么办法可以读写任一个IO端口?
overflywing
2003-08-21 01:30:33
在WINDOWS下有什么办法可以读写任一个IO端口?除了写驱动外。
...全文
407
13
打赏
收藏
在WINDOWS下有什么办法可以读写任一个IO端口?
在WINDOWS下有什么办法可以读写任一个IO端口?除了写驱动外。
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
13 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
kittycai
2003-08-27
打赏
举报
回复
还是自己写个简单的驱动吧
spbabyba
2003-08-27
打赏
举报
回复
下载 winio吧,里面有说明我原程序.
spbabyba
2003-08-27
打赏
举报
回复
下载winio吧,里面有使用说明.
ajn_sailing
2003-08-26
打赏
举报
回复
不是的,98下可以,2000下不行的。
利用winio好些
AthlonxpX86
2003-08-26
打赏
举报
回复
CreateFile();只能打开驱动程序,通过驱动程序倒是能访问端口,但是前提是有驱动
lygfqy
2003-08-26
打赏
举报
回复
赞成使用CreateFile();
AthlonxpX86
2003-08-26
打赏
举报
回复
楼上的兄弟,这些函数只能访问串口,不能读写端口
AthlonxpX86
2003-08-26
打赏
举报
回复
是
#include <conio.h>
int _inp( unsigned short port );
unsigned short _inpw( unsigned short port );
unsigned long _inpd( unsigned short port );
int _outp( unsigned short port, int databyte );
unsigned short _outpw( unsigned short port, unsigned short dataword );
unsigned long _outpd( unsigned short port, unsigned long dataword );
98可以
///////////////////////////////
正好说反了,2000下可以,98下不可以,
另外这个不是太好的方法,可能会出错并受到限制,MSDN上介绍好像着使用的是DOS虚拟机上的函数,只是访问的虚拟的物理端口,然后驱动程序把虚拟端口映射到物理端口,所以在98和2000下最好都用驱动的方法,winio是这样做的,98下写了VXD驱动来操作端口,2000下用#include <conio.h>
int _inp( unsigned short port );
unsigned short _inpw( unsigned short port );
unsigned long _inpd( unsigned short port );
int _outp( unsigned short port, int databyte );
unsigned short _outpw( unsigned short port, unsigned short dataword );
等来操作端口,所以建议98下面用winio,2000下自己写驱动吧,如果2000下的不会写,我这里有http://yds_086.html.533.net/
nicepose
2003-08-26
打赏
举报
回复
最好使用window的api这样什么版本的windows都可以用了
通用性强,资料和实例也多
------------------------------------------
看一下以下几个函数和结构吧
OVERLAPPED
COMMTIMEOUTS
DCB
CreateFile
ReadFile
WriteFile
ClearCommError
PurgeComm
GetOverlappedResult
GetCommState
SetCommState
SetCommTimeouts
CreateEvent
SetEvent
WaitForSingleObject
AthlonxpX86
2003-08-26
打赏
举报
回复
楼上不信去看看winio代码
#include <windows.h>
#include <winioctl.h>
#include <conio.h>
#include "port32.h"
#include "..\drv\nt\winio_nt.h"
#include "..\drv\9x\winio_9x.h"
#include "winio.h"
bool _stdcall GetPortVal(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize)
{
tagPort32Struct Port32Struct;
DWORD dwBytesReturned;
if (!IsWinIoInitialized)
return false;
if (IsNT)//如果是winnt/2000/xp
{
switch (bSize)
{
case 1:
*pdwPortVal = _inp(wPortAddr);
break;
case 2:
*pdwPortVal = _inpw(wPortAddr);
break;
case 4:
*pdwPortVal = _inpd(wPortAddr);
break;
}
}
else//win9x
{
Port32Struct.bSize = bSize;
Port32Struct.wPortAddr = wPortAddr;
return DeviceIoControl(hDriver, WINIO_READPORT, &Port32Struct, sizeof(Port32Struct),
pdwPortVal, sizeof(DWORD), &dwBytesReturned, NULL);
}
return true;
}
在2000下的单布运行结果是调用了
switch (bSize)
{
case 1:
*pdwPortVal = _inp(wPortAddr);
break;
case 2:
*pdwPortVal = _inpw(wPortAddr);
break;
case 4:
*pdwPortVal = _inpd(wPortAddr);
break;
}
ndy_w
2003-08-22
打赏
举报
回复
用别人写好的驱动。google一下winio。
BSRONG
2003-08-21
打赏
举报
回复
是
#include <conio.h>
int _inp( unsigned short port );
unsigned short _inpw( unsigned short port );
unsigned long _inpd( unsigned short port );
int _outp( unsigned short port, int databyte );
unsigned short _outpw( unsigned short port, unsigned short dataword );
unsigned long _outpd( unsigned short port, unsigned long dataword );
98可以
balas
2003-08-21
打赏
举报
回复
98下可以,2000下不行。
_input();_output()
pyOpenLibSys,python
读写
Windows
硬件
端口
IO
,WinRing0x64 python 版本。
pyOpenLibSys,python
读写
Windows
硬件
端口
IO
。,WinRing0 Win
IO
python 版本。从服务加载WinRing0驱动。压缩文件包含: 1:py加载WingRing0的脚本代码 2:
一个
实例脚本代码,枚举本机PCI设备,读取PCI配置空间,读取硬盘ID相信。 3:驱动程序WingRingx32.sys WingRingx64.sys
驱动程序大作业-
Windows
XP下通用I/O
端口
读写
功能的WDM驱动程序
编写
一个
实现
Windows
XP下通用I/O
端口
读写
功能的WDM驱动程序及其应用层测试程序,该驱动程序的主要功能如下: 能够向指定的I/O
端口
写入
一个
或多个字节。 能够从指定的I/O
端口
读出
一个
或多个字节。 能够同时支持多个用户程序。 驱动程序大作业
c# serialport sample(1)
http://blog.csdn.net/wuyazhe/archive/2010/05/17/5598945.aspx 博客文章的配套代码。希望能帮助到你。
linux
io
端口
读写
,linux怎么获取磁盘
io
读写
呢 linux的
io
读写
端口
怎么使用呢
今天给大家带来linux怎么获取磁盘
io
读写
呢,linux的
io
读写
端口
怎么使用呢,让您轻松解决问题。 win系统可以通过鲁大师等硬盘检测工具来查看硬盘
读写
速度,那么linux下测试硬盘
IO
读写
情况怎么看?
io
top是linux系统下测试硬盘
IO
读写
的工具,本经验咗嚛以centos为例演示,
io
top如何安装使用测试硬盘速度具体方法如下:1
io
top检测是否已经安装对于完整安装或工作站的系...
Linux下如何访问
IO
端口
编程
在Linux中,
IO
端口
被视为设备文件的一部分。可以使用C语言编写的程序通过
读写
设备文件来访问和控制
IO
端口
。以下是
一个
简单的示例,演示如何使用C语言编写
一个
程序来读取和写入
IO
端口
。这是
一个
简单的示例,演示了在Linux下如何访问和控制
IO
端口
。在Linux系统中,可以使用编程语言来访问和控制
IO
端口
。函数的第
一个
参数是
IO
端口
地址,第二个参数是请求访问的
端口
数量,这里是1,第三个参数是设置访问权限,这里是1表示请求权限。请注意,为了运行上述代码,需要具有足够的权限。函数释放
IO
端口
的访问权限,并使用。
硬件/系统
2,644
社区成员
17,232
社区内容
发帖
与我相关
我的任务
硬件/系统
VC/MFC 硬件/系统
复制链接
扫一扫
分享
社区描述
VC/MFC 硬件/系统
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章