资源简介
简易的modbus通信
代码片段和文件信息
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;
using System.Windows;
using System.Runtime.InteropServices;
namespace ModbusApiTestForCsharp_1
{
public enum SoftElemType
{
//AM600
ELEM_QX = 0 //QX元件
ELEM_MW = 1 //MW元件
ELEM_X = 2 //X元件(对应QX200~QX300)
ELEM_Y = 3 //Y元件(对应QX300~QX400)
//H3U
REGI_H3U_Y = 0x20 //Y元件的定义
REGI_H3U_X = 0x21 //X元件的定义
REGI_H3U_S = 0x22 //S元件的定义
REGI_H3U_M = 0x23 //M元件的定义
REGI_H3U_TB = 0x24 //T位元件的定义
REGI_H3U_TW = 0x25 //T字元件的定义
REGI_H3U_CB = 0x26 //C位元件的定义
REGI_H3U_CW = 0x27 //C字元件的定义
REGI_H3U_DW = 0x28 //D字元件的定义
REGI_H3U_CW2 = 0x29 //C双字元件的定义
REGI_H3U_SM = 0x2a //SM
REGI_H3U_SD = 0x2b //
REGI_H3U_R = 0x2c //
}
public partial class Form1 : Form
{
#region //标准库
[DllImport(“StandardModbusApi.dll“ EntryPoint = “Init_ETH_String“ CallingConvention = CallingConvention.Cdecl)]
public static extern bool Init_ETH_String(string sIpAddr int nNetId = 0 int IpPort = 502);
[DllImport(“StandardModbusApi.dll“ EntryPoint = “Exit_ETH“ CallingConvention = CallingConvention.Cdecl)]
public static extern bool Exit_ETH(int nNetId = 0);
[DllImport(“StandardModbusApi.dll“ EntryPoint = “H3u_Write_Soft_Elem“ CallingConvention = CallingConvention.Cdecl)]
public static extern int H3u_Write_Soft_Elem(SoftElemType eType int nStartAddr int nCount byte[] pValue int nNetId = 0);
[DllImport(“StandardModbusApi.dll“ EntryPoint = “H3u_Read_Soft_Elem“ CallingConvention = CallingConvention.Cdecl)]
public static extern int H3u_Read_Soft_Elem(SoftElemType eType int nStartAddr int nCount byte[] pValue int nNetId = 0);
[DllImport(“StandardModbusApi.dll“ EntryPoint = “H3u_Read_Soft_Elem_Float“ CallingConvention = CallingConvention.Cdecl)]
public static extern int H3u_Read_Soft_Elem_Float(SoftElemType eType int nStartAddr int nCount float[] pValue int nNetId = 0);
[DllImport(“StandardModbusApi.dll“ EntryPoint = “Am600_Write_Soft_Elem“ CallingConvention = CallingConvention.Cdecl)]
public static extern int Am600_Write_Soft_Elem(SoftElemType eType int nStartAddr int nCount byte[] pValue int nNetId = 0);
[DllImport(“StandardModbusApi.dll“ EntryPoint = “Am600_Read_Soft_Elem“ CallingConvention = CallingConvention.Cdecl)]
public static extern int Am600_Read_Soft_Elem(SoftElemType eType int nStartAddr int nCount byte[] pValue int nNetId = 0);
#endregion
public Form1()
{
InitializeComponent();
}
pr
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 43008 2020-06-03 14:10 ModbusApiTestForCsharp_1\.vs\ModbusApiTestForCsharp_1\v14\.suo
文件 672 2020-03-04 16:07 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Debug\Api.log
文件 11776 2020-03-04 16:05 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Debug\ModbusApiTestForCsharp_1.exe
文件 26112 2020-03-04 16:05 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Debug\ModbusApiTestForCsharp_1.pdb
文件 22696 2020-06-03 14:05 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Debug\ModbusApiTestForCsharp_1.vshost.exe
文件 490 2018-09-15 15:29 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Debug\ModbusApiTestForCsharp_1.vshost.exe.manifest
文件 266752 2016-12-29 18:38 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Debug\ModbusTcpAPI.dll
文件 239616 2016-12-29 18:38 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Debug\StandardModbusApi.dll
文件 10240 2016-12-30 09:51 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Release\ModbusApiTestForCsharp_1.exe
文件 22016 2016-12-30 09:51 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Release\ModbusApiTestForCsharp_1.pdb
文件 11600 2016-12-30 09:45 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Release\ModbusApiTestForCsharp_1.vshost.exe
文件 490 2009-08-31 00:40 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Release\ModbusApiTestForCsharp_1.vshost.exe.manifest
文件 266752 2016-12-29 18:38 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Release\ModbusTcpAPI.dll
文件 239616 2016-12-29 18:38 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Release\StandardModbusApi.dll
文件 7710 2020-03-04 16:05 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\Form1.cs
文件 5017 2020-03-04 15:59 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\Form1.Designer.cs
文件 5817 2020-03-04 15:59 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\Form1.resx
文件 3707 2016-12-30 09:44 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1.csproj
文件 2870 2020-03-04 15:56 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7398 2020-06-03 14:04 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 2944 2020-06-03 14:05 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.csproj.FileListAbsolute.txt
文件 976 2020-03-04 15:59 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.csproj.GenerateResource.Cache
文件 9177 2020-03-04 15:59 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.csprojResolveAssemblyReference.cache
文件 11776 2020-03-04 16:05 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.exe
文件 180 2020-03-04 15:59 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.Form1.resources
文件 26112 2020-03-04 16:05 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.pdb
文件 180 2016-12-30 09:44 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.Properties.Resources.resources
文件 6272 2016-12-30 09:51 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Release\DesignTimeResolveAssemblyReferencesInput.cache
文件 750 2016-12-30 09:50 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Release\ModbusApiTestForCsharp_1.csproj.FileListAbsolute.txt
文件 975 2016-12-30 09:50 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Release\ModbusApiTestForCsharp_1.csproj.GenerateResource.Cache
............此处省略30个文件信息
- 上一篇:C#OPT光源通信
- 下一篇:使用C#实现的电子常用计算
相关资源
- 使用C#实现的电子常用计算
- C#OPT光源通信
- c# winform 打开网页(基于WebBrowser)
- C# USB HIF
- C#加载RAW、SMV图像数据转换为BMP
- C# 立马关机 代码
- 松下PLC 通讯(modbus)
- C# 动态 时钟用户控件(基于System.Dr
- C#多线程以及Socket通讯
- 泛型(generic)是C#语言2.0和通用语言
- 三菱Q-PLC与C#串口
- C#与三菱Q系列PLC以太网通信
- C# usb hid 设备控制
- C#实现Spy++
- Unity 房间游览
- 寿星万年历的c#实现版本sxtwl_csharp_t
- TcpClient C#2010读取PLC
- C# 远程开机和关机
- C#实现特殊主框架界面效果
- C#会员管理条码版(附数据库)
- C#获取U盘信息
- C#教程(非常基础)
- C#打开与获取网页源码
- C# Cad2006二次开发之图形扩展属性读写
- C# 棋牌室小软件(附数据库以及源码
- c# 串口通讯的(收发数据)
- C#-与西门子1200-1500-S7通讯(源码+文档
- C# 朗读文本文字(SpeechSynthesizer)
- C#_基础教程笔记(传智播客)-苏坤
- C#联合halcon实现鼠标滚轮事件
评论
共有 条评论