资源简介
台达PLC modbus通信上位机64位C#实例程序,vs2010亲测可用。台达PLC modbus通信上位机64位C#实例程序,vs2010亲测可用。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32; // for the registry table
using System.Net; // for the ip address
using System.Runtime.InteropServices; // for the P/Invoke
namespace WindowsApplication1
{
public partial class Form1 : Form
{
System.IntPtr hDMTDll; // handle of a loaded DLL
delegate void DelegateClose(int conn_num); // function pointer for disconnection
// About .Net P/Invoke:
// [DllImport(“XXX.dll“ CharSet = CharSet.Auto)]
// static extern int ABC(int a int b);
// indicates that “ABC“ function is imported from XXX.dll
// XXX.dll exports a function of the same name with “ABC“
// the return type and the parameter‘s data type of “ABC“
// must be identical with the function exported from XXX.dll
// and the CharSet = CharSet.Auto causes the CLR
// to use the appropriate character set based on the host OS
[DllImport(“kernel32.dll“ CharSet = CharSet.Auto)]
static extern IntPtr LoadLibrary(string dllPath);
[DllImport(“kernel32.dll“ CharSet = CharSet.Auto)]
static extern bool FreeLibrary(IntPtr hDll);
// Data Access
[DllImport(“DMT.dll“ CharSet = CharSet.Auto)]
static extern int RequestData(int comm_type int conn_num int slave_addr int func_code byte[] sendbuf int sendlen);
[DllImport(“DMT.dll“ CharSet = CharSet.Auto)]
static extern int ResponseData(int comm_type int conn_num ref int slave_addr ref int func_code byte[] recvbuf);
// Serial Communication
[DllImport(“DMT.dll“ CharSet = CharSet.Auto)]
static extern int OpenModbusSerial(int conn_num int baud_rate int data_len char parity int stop_bits int modbus_mode);
[DllImport(“DMT.dll“ CharSet = CharSet.Auto)]
static extern void CloseSerial(int conn_num);
[DllImport(“DMT.dll“ CharSet = CharSet.Auto)]
static extern int GetLastSerialErr();
[DllImport(“DMT.dll“ CharSet = CharSet.Auto)]
static extern void ResetSerialErr();
// Socket Communication
[DllImport(“DMT.dll“ CharSet = CharSet.Auto)]
static extern int OpenModbusTCPSocket(int conn_num int ipaddr int port);
[DllImport(“DMT.dll“ CharSet = CharSet.Auto)]
static extern void CloseSocket(int conn_num);
[DllImport(“DMT.dll“ CharSet = CharSet.Auto)]
static extern int GetLastSocketErr();
[DllImport(“DMT.dll“ CharSet = CharSet.Auto)]
static extern void ResetSocketErr();
[DllImport(“DMT.dll“ CharSet = CharSet.Auto)]
static extern int ReadSelect(int conn_num int millisecs);
// MODBUS Address Calculation
[DllImpo
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-12-06 10:07 Example_C# 2005\
目录 0 2016-12-05 20:14 Example_C# 2005\Backup\
目录 0 2016-12-05 20:14 Example_C# 2005\Backup\WindowsApplication1\
文件 946 2011-04-27 15:55 Example_C# 2005\Backup\WindowsApplication1.sln
文件 39424 2014-06-19 18:26 Example_C# 2005\Backup\WindowsApplication1.suo
文件 19935 2014-06-19 18:26 Example_C# 2005\Backup\WindowsApplication1\Form1.cs
文件 23945 2014-06-19 18:26 Example_C# 2005\Backup\WindowsApplication1\Form1.Designer.cs
文件 5814 2014-06-19 18:26 Example_C# 2005\Backup\WindowsApplication1\Form1.resx
文件 486 2011-04-27 15:55 Example_C# 2005\Backup\WindowsApplication1\Program.cs
目录 0 2016-12-05 20:14 Example_C# 2005\Backup\WindowsApplication1\Properties\
文件 1286 2011-04-27 15:55 Example_C# 2005\Backup\WindowsApplication1\Properties\AssemblyInfo.cs
文件 2867 2011-04-27 15:55 Example_C# 2005\Backup\WindowsApplication1\Properties\Resources.Designer.cs
文件 5612 2011-04-27 15:55 Example_C# 2005\Backup\WindowsApplication1\Properties\Resources.resx
文件 1104 2011-04-27 15:55 Example_C# 2005\Backup\WindowsApplication1\Properties\Settings.Designer.cs
文件 249 2011-04-27 15:55 Example_C# 2005\Backup\WindowsApplication1\Properties\Settings.settings
文件 3295 2011-04-28 19:32 Example_C# 2005\Backup\WindowsApplication1\WindowsApplication1.csproj
文件 168 2012-01-10 16:23 Example_C# 2005\Backup\WindowsApplication1\WindowsApplication1.csproj.user
文件 5685 2016-12-05 20:14 Example_C# 2005\UpgradeLog.xm
目录 0 2016-12-05 20:13 Example_C# 2005\WindowsApplication1\
文件 947 2016-12-05 20:14 Example_C# 2005\WindowsApplication1.sln
文件 49664 2016-12-05 21:01 Example_C# 2005\WindowsApplication1.suo
目录 0 2016-12-05 20:13 Example_C# 2005\WindowsApplication1\bin\
目录 0 2016-12-05 20:14 Example_C# 2005\WindowsApplication1\bin\Debug\
文件 177152 2014-07-16 11:16 Example_C# 2005\WindowsApplication1\bin\Debug\DMT.dll
文件 63062 2014-07-16 11:16 Example_C# 2005\WindowsApplication1\bin\Debug\DMT.lib
文件 23552 2016-12-05 20:33 Example_C# 2005\WindowsApplication1\bin\Debug\WindowsApplication1.exe
文件 44544 2016-12-05 20:33 Example_C# 2005\WindowsApplication1\bin\Debug\WindowsApplication1.pdb
文件 11608 2016-12-05 21:00 Example_C# 2005\WindowsApplication1\bin\Debug\WindowsApplication1.vshost.exe
文件 490 2010-03-17 22:39 Example_C# 2005\WindowsApplication1\bin\Debug\WindowsApplication1.vshost.exe.manifest
文件 151552 2014-04-28 14:30 Example_C# 2005\WindowsApplication1\DMT.dll
文件 19935 2016-12-05 20:33 Example_C# 2005\WindowsApplication1\Form1.cs
............此处省略32个文件信息
相关资源
- NModbu官方VB C# 全
- Modbus串口通信
- Modbus上位机控件MBAXP纯净版免安装、免
- modbus上位机C#类库
- C# 基于Modbus TCP的西门子S7200PLC读写例
- ModBUS TCP C#源码实现
- C# modbus RTU 通信
- c#与485MODBUS串口通信源代码
- C#对三菱PLC的以太网和串口通讯以及台
- C# 解决System.Data.SQLite兼容32位和64位系
- C#编成Modbus TCP连接PLC寄存器读取、写
- C#调用PC主板蜂鸣器小喇叭speaker发声
- Nmodbus TCP 初版 实现 winform
- NModbus RTU 成果初版 C# WINFROM
- c#与485MODBUS串口通信源代码.rar
- c# 串口设置及发送接收MODBUS数据程序
- C#modbus rtu绝对好用,绝对能用
- c# 通过int长度判断当前系统是64位还是
- dll文件32位/64位检测工具
- libmodbus-3.0.6.tar.gz(modbus协议源码)
- C#IEEE754协议 modbus 4位byte转float
- IE下获取XPATH小工具源码(支持32/64位
- MODBUS-CSharp socket测试小程序。MODBUS协议
- MODBUS C#串口通讯
- ModbusMonitor VS2010 winform Csharp 开发的一
- NModbus 用C#实现的modbus协议源码
- MODBUS C#写了一款上位机监控软件
- Modbus 用C#实现ModBus读写功能
- CSharp_Serial_Modbus C# 串口例子
- MODBUS(RTU)
评论
共有 条评论