资源简介
C#使用WinIo操作并口范例,可以通过计算机的并口(LPT1)输出12路电位,读取5路电位;
输出电位3.5-4.2V之间(经测试不同主板,输出电压不同);输入时高于2.1V为有效。
当然,你可以修改为输出8路,读取9路
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace GameDeceptionStuff
{
public partial class Form1 : Form
{
WinIo myIo = new WinIo();
byte[] myData = new byte[8];
byte[] MyControl = new byte[4];
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)
{
myData = new byte[8] { 0 0 0 0 0 0 0 0 };
foreach (int index in this.checkedListBox1.CheckedIndices )
{
myData[index] = 1;
}
myIo.setDataPort(myData);
}
private void button2_Click(object sender EventArgs e)
{
MyControl = new byte[4] { 0 0 0 0 };
foreach (int index in this.checkedListBox2.CheckedIndices)
{
MyControl[index] = 1;
}
myIo.setControlPort(MyControl);
}
private void button3_Click(object sender EventArgs e)
{
byte[] result = myIo.getStatePort();
for (int i = 0; i < result.Length; ++i)
{
bool flag = result[i] != 0;
this.checkedListBox3.SetItemChecked(i flag);
}
}
private void Form1_FormClosing(object sender FormClosingEventArgs e)
{
myIo.CloseWinIo();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 57856 2012-03-15 16:59 GameDeceptionStuff\C#并口.doc
文件 12800 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\bin\Debug\GameDeceptionStuff.exe
文件 30208 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\bin\Debug\GameDeceptionStuff.pdb
文件 14328 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\bin\Debug\GameDeceptionStuff.vshost.exe
文件 45568 2010-05-15 23:56 GameDeceptionStuff\GameDeceptionStuff\bin\Debug\WinIo32.dll
文件 6656 2010-05-08 23:16 GameDeceptionStuff\GameDeceptionStuff\bin\Debug\WinIo32.sys
文件 12288 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\bin\Release\GameDeceptionStuff.exe
文件 28160 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\bin\Release\GameDeceptionStuff.pdb
文件 14328 2012-03-15 16:55 GameDeceptionStuff\GameDeceptionStuff\bin\Release\GameDeceptionStuff.vshost.exe
文件 490 2007-07-21 01:33 GameDeceptionStuff\GameDeceptionStuff\bin\Release\GameDeceptionStuff.vshost.exe.manifest
文件 45568 2010-05-15 23:56 GameDeceptionStuff\GameDeceptionStuff\bin\Release\WinIo32.dll
文件 6656 2010-05-08 23:16 GameDeceptionStuff\GameDeceptionStuff\bin\Release\WinIo32.sys
文件 1602 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\Form1.cs
文件 7416 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\Form1.Designer.cs
文件 5814 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\Form1.resx
文件 3818 2012-03-13 16:08 GameDeceptionStuff\GameDeceptionStuff\GameDeceptionStuff.csproj
文件 817 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Debug\GameDeceptionStuff.csproj.FileListAbsolute.txt
文件 847 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Debug\GameDeceptionStuff.csproj.GenerateResource.Cache
文件 12800 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Debug\GameDeceptionStuff.exe
文件 180 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Debug\GameDeceptionStuff.Form1.resources
文件 30208 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Debug\GameDeceptionStuff.pdb
文件 180 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Debug\GameDeceptionStuff.Properties.Resources.resources
文件 833 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Release\GameDeceptionStuff.csproj.FileListAbsolute.txt
文件 847 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Release\GameDeceptionStuff.csproj.GenerateResource.Cache
文件 12288 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Release\GameDeceptionStuff.exe
文件 180 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Release\GameDeceptionStuff.Form1.resources
文件 28160 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Release\GameDeceptionStuff.pdb
文件 180 2012-03-15 17:13 GameDeceptionStuff\GameDeceptionStuff\obj\Release\GameDeceptionStuff.Properties.Resources.resources
文件 499 2012-03-13 13:22 GameDeceptionStuff\GameDeceptionStuff\Program.cs
文件 1382 2012-03-13 13:22 GameDeceptionStuff\GameDeceptionStuff\Properties\AssemblyInfo.cs
............此处省略21个文件信息
- 上一篇:DynamicDataDisplay.dll
- 下一篇:IrisSkin2.dll
相关资源
- IrisSkin2.dll
- C#调用matlab画图,解决图像嵌入Winfo
- c# word模板插入图片
- 基于C#的简易画板
- C#串口通信RS232SerialPort
- c#基础,上课必备29个
- C#读取psd格式图片
- TCP性能测试工具和C#高性能异步Socke
- 基于C#实现的三维显示
- c#拼图游戏可换图,选难度,计时,统
- C#调用SynoAPIEx.dll接口采集指纹信息+绘
- C#网络摄像头实现实时监控录像
- C# 基于ModBus RTU获取气象站数据
- C#个人日程管理系统_程序设计报告(
- 单张相片后方交会计算程序C#
- C#读取惯导数据的简单
- C# 堆栈 回溯 马踏棋盘演示程序
- C# 数据结构——三元组与十字链表—
- modbus的C#
- C#写的员工管理信息系统,有C#完整项
- C# 标准偏差STDEV与CPK的计算
- C#实时窗口截图
- C#仿360加速球
- C# wpf combobox带treeview的自定义控件
-
C# Updatela
yeredWindow()编写桌面透明 - C# GIS算法演示:道格拉斯压缩、线性
- Rs232串口调试信息传输(C#)
- DirectShowLib,最新的DirectShowLib插件,提
- 布尔莎七参数求解__C#源码
- C#调用灵云TTS
评论
共有 条评论