资源简介
PLC 通讯 demo
代码片段和文件信息
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();
textBox1.Te
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 32256 2020-09-01 15:17 ModbusApiTestForCsharp_1\.vs\ModbusApiTestForCsharp_1\v14\.suo
文件 4940 2020-09-02 14:00 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Debug\Api.log
文件 14336 2020-09-02 14:03 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Debug\ModbusApiTestForCsharp_1.exe
文件 30208 2020-09-02 14:03 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Debug\ModbusApiTestForCsharp_1.pdb
文件 22696 2020-09-02 14:01 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\bin\Debug\ModbusApiTestForCsharp_1.vshost.exe
文件 490 2019-03-19 12:46 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:44 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
文件 11138 2020-09-02 14:02 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\Form1.cs
文件 9379 2020-09-02 13:59 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\Form1.Designer.cs
文件 5817 2020-09-02 13:59 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\Form1.resx
文件 3707 2016-12-30 09:44 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1.csproj
文件 2870 2020-09-01 15:12 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7268 2020-09-02 11:03 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 3046 2020-09-02 14:03 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.csproj.FileListAbsolute.txt
文件 1012 2020-09-02 14:03 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.csproj.GenerateResource.Cache
文件 14336 2020-09-02 14:03 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.exe
文件 180 2020-09-02 14:03 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.Form1.resources
文件 30208 2020-09-02 14:03 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Debug\ModbusApiTestForCsharp_1.pdb
文件 180 2020-09-02 14:03 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
文件 10240 2016-12-30 09:51 ModbusApiTestForCsharp_1\ModbusApiTestForCsharp_1\obj\x86\Release\ModbusApiTestForCsharp_1.exe
............此处省略29个文件信息
相关资源
- socket通讯实例(入门级)58873
- C#多线程以及Socket通讯
- 三菱plc上载最终程序.gxw
- 三菱Q-PLC与C#串口
- C#与三菱Q系列PLC以太网通信
- TcpClient C#2010读取PLC
- c# 串口通讯的(收发数据)
- C#-与西门子1200-1500-S7通讯(源码+文档
- Csharp串口通讯
- TCP/IP通讯 (附服务端以及客户端)
- plc通信(vb+c#+说明文档)
- C# 实现 信捷PLC通讯协议
- C# SHAP7与西门子PLC通讯及模拟
- C# 通过S7.NET方式实现与西门子PLC通信
- 物联网设备通讯协议实现客户端(I
- udp通讯(需修改客户端链接服务端时
- 网络通讯程序源码(附客户端以及服
- 串口通讯工具源码
- C#串口通讯
- 简单tcp 通讯网口工具客户端
- 基于webapi的PLC软件控制(softplc)
- 梅特里托利多天平称XP系列指令通讯
- 上位机语音识别控制PLC源码(附西门
- Modbus通讯 串口通讯
- C# 串口通讯源码(简易串口助手)
- HMI-with-WPF-part-3-Communication-with-multipl
- MODBUS通讯(TCP/Rtu)
- C#通讯调试工具源码
- 纯C#的DICOM读取和通讯
- 松下PLC与C#通讯串口调试入门教程.z
评论
共有 条评论