资源简介
MODUBUS C#代码
MODUBUS C#代码
代码片段和文件信息
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using Modbus.IO;
using Modbus.Utility;
namespace FtdAdapter
{
///
/// Specifies the number of stop bits used on the UsbPort object.
///
public enum FtdStopBits
{
///
/// One stop bit is used.
///
One = 1
///
/// 1.5 stop bits are used.
///
OnePointFive
///
/// Two stop bits are used.
///
Two
}
///
/// Specifies the parity used on the UsbPort object.
///
public enum FtdParity
{
///
/// No parity check occurs.
///
None = 0
///
/// Sets the parity bit so that the count of bits set is an odd number.
///
Odd
///
/// Sets the parity bit so that the count of bits set is an even number.
///
Even
///
/// Leaves the parity bit set to 1.
///
Mark
///
/// Leaves the parity bit set to 0.
///
Space
}
///
/// Specifies the result of a UsbPort operation.
///
internal enum FtdStatus
{
OK = 0
InvalidHandle
DeviceNotFound
DeviceNotOpened
IOError
InsufficientResources
InvalidParameter
InvalidBaudRate
DeviceNotOpenedForErase
DeviceNotOpenedForWrite
FailedToWriteDevice
EEPromReadFailed
EEPromWriteFailed
EEPromEraseFailed
EEPromNotPresent
EEPromNotProgrammed
InvalidArgs
OtherError
};
///
/// Wrapper class for the FTD2XX USB resource.
///
public class FtdUsbPort : ISerialResource IDisposable
{
[DllImport(FtdAssemblyName)]
static extern FtdStatus FT_Close(uint deviceHandle);
[DllImport(FtdAssemblyName)]
static extern FtdStatus FT_Open(uint deviceID ref uint deviceHandle);
[DllImport(FtdAssemblyName)]
static extern FtdStatus FT_SetBaudRate(uint deviceHandle uint baudRate);
[DllImport(FtdAssemblyName)]
static extern FtdStatus FT_SetDataCharacteristics(uint deviceHandle byte wordLength byte stopBits byte parity);
[DllImport(FtdAssemblyName)]
static extern unsafe FtdStatus FT_Read(uint deviceHandle void* buffer uint bytesToRead ref uint bytesReturned);
[DllImport(FtdAssemblyName)]
static extern unsafe FtdStatus FT_Write(uint deviceHandle void* buffer uint bytesToWrite ref uint bytesWritten);
[DllImport(FtdAssemblyName)]
static extern FtdStatus FT_SetTimeouts(uint deviceHandle uint readTimeout uint writeTimeout);
[DllImport(FtdAssemblyName)]
static extern FtdStatus FT_Purge(uint deviceHandle uint mask);
[DllImport(FtdAssemblyName)]
static extern FtdStatus FT_CreateDeviceInfoList(ref uint deviceCount);
private const string FtdAssemblyName = “FTD2XX.dll“;
private const byte PurgeRx = 1;
private const uint _infiniteTimeout = 0;
//priv
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-09-06 16:34 modbus\
目录 0 2011-09-06 16:34 modbus\bin\
文件 202048 2011-09-06 16:34 modbus\bin\FTD2XX.dll
文件 12288 2011-09-06 16:34 modbus\bin\FtdAdapter.dll
文件 270336 2011-09-06 16:34 modbus\bin\log4net.dll
文件 73728 2011-09-06 16:34 modbus\bin\Modbus.dll
目录 0 2011-09-06 16:34 modbus\source\
目录 0 2011-09-06 16:34 modbus\source\lib\
文件 202048 2011-09-06 16:34 modbus\source\lib\FTD2XX.dll
文件 270336 2011-09-06 16:34 modbus\source\lib\log4net.dll
文件 45056 2011-09-06 16:34 modbus\source\lib\nunit.fr
文件 210432 2011-09-06 16:34 modbus\source\lib\Rhino.Mocks.dll
文件 9573 2011-09-06 16:34 modbus\source\NModbus.build
文件 2891 2011-09-06 16:34 modbus\source\NModbus.shfb
目录 0 2011-09-06 16:34 modbus\source\src\
目录 0 2011-09-06 16:34 modbus\source\src\FtdAdapter\
目录 0 2011-09-06 16:34 modbus\source\src\FtdAdapter\bin\
目录 0 2011-09-06 16:34 modbus\source\src\FtdAdapter\bin\Debug\
文件 13312 2011-09-06 16:34 modbus\source\src\FtdAdapter\bin\Debug\FtdAdapter.dll
文件 30208 2011-09-06 16:34 modbus\source\src\FtdAdapter\bin\Debug\FtdAdapter.pdb
文件 135 2011-09-15 09:54 modbus\source\src\FtdAdapter\bin\Debug\FtdAdapter.xm
文件 270336 2011-09-06 16:34 modbus\source\src\FtdAdapter\bin\Debug\log4net.dll
文件 69120 2011-09-06 16:34 modbus\source\src\FtdAdapter\bin\Debug\Modbus.dll
文件 255488 2011-09-06 16:34 modbus\source\src\FtdAdapter\bin\Debug\Modbus.pdb
文件 64042 2011-09-06 16:34 modbus\source\src\FtdAdapter\bin\Debug\Modbus.xm
文件 3060 2011-09-06 16:34 modbus\source\src\FtdAdapter\FtdAdapter.csproj
文件 12921 2011-09-06 16:34 modbus\source\src\FtdAdapter\FtdUsbPort.cs
目录 0 2011-09-06 16:34 modbus\source\src\FtdAdapter\obj\
目录 0 2011-09-06 16:34 modbus\source\src\FtdAdapter\obj\Debug\
文件 591 2011-09-06 16:34 modbus\source\src\FtdAdapter\obj\Debug\FtdAdapter.csproj.FileListAbsolute.txt
文件 13312 2011-09-06 16:34 modbus\source\src\FtdAdapter\obj\Debug\FtdAdapter.dll
............此处省略267个文件信息
- 上一篇:ASP.NET MVC入门教程
- 下一篇:《C#程序设计教程第2版》配套源码
相关资源
- 104规约 C#实现代码
- .net C#代码生成器
- 成语接龙C#代码以前写的,暂时放这里
- SiriusCoder C#代码生成器
- 狂人代码生成器V3.0 C#代码生成器 实体
- C#代码生成二维码
- 影院售票系统(C#代码)
- A*逆向路径搜索算法C#代码以及地图文
- 关于图像格式转换的c#代码
- Halcon导出的C#代码的调用及讨论
- C#代码实现的库存管理系统
- C#课程设计学生管理系统
- ADB操作控制手机C#代码
- 学生选课系统C#代码
- C#课程设计源码
- C#海康识别抓拍回调(增加出入口LE
- Dot.NET Reactor 混淆加密工具 完美破解版
- C#代码混淆加密工具DotFuscatorpe 4.96 完
- 俄罗斯方块c#代码
- ASPNET学生选课系统C#代码
- C#代码_截屏工具(支持多显示器 含代
- 基于AE 的空间分析全部C#代码网络分析
- 最短路径 C#代码实现几个点之间的路
- 坦克大战C#代码
- 局域网内ping ip和获取mac地址的C#代码
- 手工添加的access2007 ole对象 批量导出
- 标准正态分布---由概率计算分位数C
- 比较C#代码文件 比较C#文件 比较C#代码
- c#代码混淆器,混淆单个文件和整个目
- Halcon生成的计算圆心C#代码
评论
共有 条评论