资源简介
C# Mudbus通讯详解,包含开发包和开发例程..
代码片段和文件信息
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 2018-11-22 20:18 MUDBUS\
目录 0 2018-11-22 20:15 MUDBUS\24415425NModbus_1.6.0.0-source\
目录 0 2018-11-22 20:15 MUDBUS\24415425NModbus_1.6.0.0-source\bin\
文件 202048 2008-03-10 18:53 MUDBUS\24415425NModbus_1.6.0.0-source\bin\FTD2XX.dll
文件 12288 2008-03-10 19:02 MUDBUS\24415425NModbus_1.6.0.0-source\bin\FtdAdapter.dll
文件 270336 2008-03-10 18:53 MUDBUS\24415425NModbus_1.6.0.0-source\bin\log4net.dll
文件 73728 2008-03-10 19:02 MUDBUS\24415425NModbus_1.6.0.0-source\bin\Modbus.dll
文件 283445 2008-03-10 19:03 MUDBUS\24415425NModbus_1.6.0.0-source\NModbus.chm
文件 1633 2008-03-10 18:54 MUDBUS\24415425NModbus_1.6.0.0-source\README.txt
目录 0 2018-11-22 20:15 MUDBUS\24415425NModbus_1.6.0.0-source\source\
目录 0 2018-11-22 20:15 MUDBUS\24415425NModbus_1.6.0.0-source\source\lib\
文件 202048 2008-03-10 18:53 MUDBUS\24415425NModbus_1.6.0.0-source\source\lib\FTD2XX.dll
文件 270336 2008-03-10 18:53 MUDBUS\24415425NModbus_1.6.0.0-source\source\lib\log4net.dll
文件 45056 2008-03-10 18:53 MUDBUS\24415425NModbus_1.6.0.0-source\source\lib\nunit.fr
文件 210432 2008-03-10 18:53 MUDBUS\24415425NModbus_1.6.0.0-source\source\lib\Rhino.Mocks.dll
文件 9573 2008-03-10 18:56 MUDBUS\24415425NModbus_1.6.0.0-source\source\NModbus.build
文件 2891 2008-03-10 18:54 MUDBUS\24415425NModbus_1.6.0.0-source\source\NModbus.shfb
目录 0 2018-11-22 20:15 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\
目录 0 2018-11-22 20:15 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\FtdAdapter\
文件 3060 2008-03-10 18:54 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\FtdAdapter\FtdAdapter.csproj
文件 12921 2008-03-10 18:54 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\FtdAdapter\FtdUsbPort.cs
目录 0 2018-11-22 20:15 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\FtdAdapter\Properties\
文件 1377 2008-03-10 18:54 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\FtdAdapter\Properties\AssemblyInfo.cs
目录 0 2018-11-22 20:15 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\Modbus\
目录 0 2018-11-22 20:15 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\Modbus.IntegrationTests\
文件 907 2008-03-10 18:54 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\Modbus.IntegrationTests\App.config
目录 0 2018-11-22 20:15 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\Modbus.IntegrationTests\CustomMessages\
文件 2237 2008-03-10 18:54 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\Modbus.IntegrationTests\CustomMessages\CustomReadHoldingRegistersRequest.cs
文件 1839 2008-03-10 18:54 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\Modbus.IntegrationTests\CustomMessages\CustomReadHoldingRegistersResponse.cs
文件 2838 2008-03-10 18:54 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\Modbus.IntegrationTests\CustomMessages\CustomWriteMultipleRegistersRequest.cs
文件 1982 2008-03-10 18:54 MUDBUS\24415425NModbus_1.6.0.0-source\source\src\Modbus.IntegrationTests\CustomMessages\CustomWriteMultipleRegistersResponse.cs
............此处省略2262个文件信息
- 上一篇:C#简单的教材管理系统不含数据库
- 下一篇:Asp.net语言写的三层架构的校园论坛
相关资源
- C# 调用win32 api函数-user32.dll详细说明
- C# 调用BarTender打印条码DEMO
- 大型比赛竞赛抽签系统 可打印 c# vs
- C#编写的Gerber查看器
- lua C# .Net4.0 vs2010 LuaInterface
- C#十六进制编辑器
- 明华URF-35H读卡器 C#读写源码 为大家
- C#文件流读取CSV文件
- c#读写PDF文件sql
- C# winform Socket大文件传输
- c#车牌识别系统附30张测试图片
- 《C#面向对象程序设计》源代码(CS)
- 金旭亮《C#面向对象程序设计》教案
- 试题库管理系统毕业论文(C#)源程序
- 学校网站原代码(C#.NET)
- C#-数据库操作技术-员工管理系统
- c#web开发入门经典
- C#与Matlab混合编程的几种方式
- c# 开发与 mysql数据库实现的增删改查
- C#异步操作 异步查询数据库 异步处理
- Basler相机通过IO触发源码
- [源代码] 《领域驱动设计 (C# 2008 实
- 松下PLC与C#通讯串口调试入门教程.z
- USB 继电器控制器 LCUS-1 保证能用 c#
- C# AES加密解密小工具
- C#圆形按钮,非常漂亮动态~~
- [精]C#仿QQ右下角弹出提示框()
- C#进程间通信-共享内存代码
- 有史以来最简单的三层(C#)
- vb调用c#编写的串口DLL文件(vb源码
评论
共有 条评论