using System;
using System.Runtime.InteropServices;
public class PortAccess
{
[DllImport("inpout32.dll", EntryPoint="Out32")]
public static extern void Output(int adress, int value);
[DllImport("inpout32.dll", EntryPoint="Inp32")]
public static extern int Input(int adress);
}
//Output函数为给端口传送数据,Input是从端口读取数据 如:
PortAccess.Input( 888 );//从888(即0x378)端口读取数据
PortAccess.Output( 888, 4 )//把4从888端口输出
C#并口操作
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
C# - JSON操作
Newtonsoft.dll插件 洪大师二次封装: 对象直接转化为json字符串: json字符串转化为已知的对象
json json字符串 .net 封装 编程