资源简介
usb转rs-485,基于ModBus RTU获取气象站信息,包括简单数据库操作,使用vs2013,包括CRC校验,增加掉线检测,掉线重连

代码片段和文件信息
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO.Ports;
using System.Text;
using System.Threading;
using ModBus;
using TaskManager.Domain.Dal;
using TaskManager.Domain.Model;
using XXF.ProjectTool;
using MyUtil.log;
namespace ModBus
{
public class ModbusController
{
public static MyUtil.log.Log logger = LogFactory.GetLogger(System.Reflection.Methodbase.GetCurrentMethod().DeclaringType);
#region 属性
///
/// 状态
///
public AppStatus Status = AppStatus.停止;
///
/// COM操作对象
///
private SerialPort sp = new SerialPort();
///
/// 锁
///
private static object o = new object();
///
/// CRC验证表
///
public byte[] crc_table = new byte[512];
///
/// 数据集合
///
private Dictionary DicData = null;
///
/// 从机地址
///
private byte SlaveID = 0;
///
/// 数据发送对象配置信息
///
private ArrayList DataList = null;
///
/// COM口配置信息
///
private ComSetting Setting = null;
#endregion
#region 构造函数
///
/// 构造函数
///
public ModbusController(RecivedConfigurationTable configuration)
{
#region 初始化CRC
crc_table[0] = 0x0;
crc_table[1] = 0xC1;
crc_table[2] = 0x81;
crc_table[3] = 0x40;
crc_table[4] = 0x1;
crc_table[5] = 0xC0;
crc_table[6] = 0x80;
crc_table[7] = 0x41;
crc_table[8] = 0x1;
crc_table[9] = 0xC0;
crc_table[10] = 0x80;
crc_table[11] = 0x41;
crc_table[12] = 0x0;
crc_table[13] = 0xC1;
crc_table[14] = 0x81;
crc_table[15] = 0x40;
crc_table[16] = 0x1;
crc_table[17] = 0xC0;
crc_table[18] = 0x80;
crc_table[19] = 0x41;
crc_table[20] = 0x0;
crc_table[21] = 0xC1;
crc_table[22] = 0x81;
crc_table[23] = 0x40;
crc_table[24] = 0x0;
crc_table[25] = 0xC1;
crc_table[26] = 0x81;
crc_table[27] = 0x40;
crc_table[28] = 0x1;
crc_table[29] = 0xC0;
crc_table[30] = 0x80;
crc_table[31] = 0x41;
crc_table[32] = 0x1;
crc_table[33] = 0xC0;
crc_table[34] = 0x80;
crc_table[35] = 0x41;
crc_table[36] = 0x0;
crc_table[37] = 0xC1;
crc_table[38] = 0x81;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1228 2017-05-24 16:52 ModBus\ModBus\App.config
文件 270 2016-12-05 16:32 ModBus\ModBus\Helper\AppStatus.cs
文件 20482 2016-12-12 11:10 ModBus\ModBus\Helper\Common
文件 425 2016-12-05 16:33 ModBus\ModBus\Helper\ComSetting.cs
文件 508 2016-12-13 08:38 ModBus\ModBus\Helper\global.cs
文件 351 2016-12-05 17:04 ModBus\ModBus\Helper\RecivedConfigurationTable.cs
文件 251 2016-12-05 17:06 ModBus\ModBus\Helper\RecivedData.cs
文件 5339 2016-12-08 10:26 ModBus\ModBus\log4net.config
文件 5662 2016-12-20 08:54 ModBus\ModBus\ModBus.csproj
文件 478 2016-12-20 08:54 ModBus\ModBus\ModBus.csproj.user
文件 35252 2016-12-14 11:53 ModBus\ModBus\ModbusController.cs
文件 2740 2016-12-12 11:31 ModBus\ModBus\Program.cs
文件 1336 2016-12-05 09:14 ModBus\ModBus\Properties\AssemblyInfo.cs
文件 3331 2016-12-08 10:45 ModBus\ModBus.sln
..A..H. 143360 2017-05-16 17:12 ModBus\ModBus.v12.suo
文件 654 2016-12-08 09:08 ModBus\MyUtil\Log\Log.cs
文件 304640 2016-08-22 15:23 ModBus\MyUtil\Log\log4net.dll
文件 773 2016-12-08 10:22 ModBus\MyUtil\Log\LogFactory.cs
文件 5463 2016-12-08 10:19 ModBus\MyUtil\Log\LogFormat.cs
文件 340 2016-12-08 09:06 ModBus\MyUtil\Log\LogLevel.cs
文件 680 2016-12-08 10:22 ModBus\MyUtil\Log\LogMessage.cs
文件 2708 2016-12-19 18:00 ModBus\MyUtil\MyUtil.csproj
文件 1336 2016-12-08 09:05 ModBus\MyUtil\Properties\AssemblyInfo.cs
文件 187 2016-12-06 14:53 ModBus\Weather\App.config
文件 562 2016-12-06 14:53 ModBus\Weather\Program.cs
文件 1338 2016-12-06 14:53 ModBus\Weather\Properties\AssemblyInfo.cs
文件 552 2016-12-06 14:53 ModBus\Weather\Service1.cs
文件 1082 2016-12-06 14:53 ModBus\Weather\Service1.Designer.cs
文件 2811 2016-12-06 15:55 ModBus\Weather\Weather.csproj
目录 0 2016-12-13 08:38 ModBus\ModBus\Helper
............此处省略11个文件信息
相关资源
- c#实现Modbus tcp客户端
- C# Modbus调试工具源码(RTU协议)
- C# Modbus TCP通讯(S7200PLC)
- C# 台达PLC485通信
- Modbus类库C#版本
- c# EasyModbus Client
- Modbus调试工具源码
- modbus tcp 调试
- C#modbus通信
- 松下PLC 通讯(modbus)
- modbus通信
- Modbus通讯 串口通讯
- MODBUS通讯(TCP/Rtu)
- Modbus通讯协议-C#源码
- NModbus_net-3.5_1.11.0.0-source
- C# 开发modbus合集
- Modbus RTU TCP主站从站类库内有说明文档
- NModbusAPI说明文档中文的
- NModbusAPI说明文档中文的 实用
- NModbus说明文档API 中文英文+chm
- modbus tcp/rtu 基于C#的源码实现(老外的
- nmodbus官方例程 包括dllvb.net与C#
- C# 生成二维码名片 实例源码174850
- C#使用ModbusTcp协议与西门子1200PLC通讯
- ModBus Tcp 通讯C# +Demo
- C#编成Modbus TCP连接PLC寄存器读取、写
- Modbus_TCP .net C# 通信
- C#封装modbus
- 基于TCP的 modbus , C#源码
- Modbus RTU c#
评论
共有 条评论