资源简介
上位机与PLC通讯软件(C#),里面包含所需要的三菱DLL,引用后直接使用,已经经过调试,接口可用,需要用MX_Component 软件进行链接配置
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
namespace PLCconnect
{
public class ConnectPLC
{
public bool isPLCConnected = false;
System.String[] arrData = new string[32]; //Array for ‘Data‘
public short[] arrDeviceValue = new short[32]; //Data for ‘DeviceValue‘
public int iReturnCode = 0;
object plcLock = new object();
/*The declaration of instance value for ACT controls************************/
// When you use Dot controls by ‘References‘ you should program as follows;
public ActUtlTypeLib.ActUtlType lpcom_ReferencesUtlType = new ActUtlTypeLib.ActUtlType();
//public ConnectPLC()
//{
// /* Create instance for ACT Controls*************************************/
// lpcom_ReferencesUtlType = new ActUtlTypeLib.ActUtlType();
// /* Set EventHandler for ACT Controls************************************/
// // Create EventHandler(ActUtlType)
// /**************************************************************************/
//}
///
/// 断开PLC连接
///
public void ClosePLC()
{
int iReturnCode; //Return code
//Displayed output data is cleared.
//
//Processing of Close method
//
try
{
//When ActProgType is selected by the radio button
//The Close method is executed.
iReturnCode = lpcom_ReferencesUtlType.Close();
//When The Close method is succeeded enable the TextBox of ‘LogocalStationNumber‘.
if (iReturnCode == 0)
{
isPLCConnected = false;
}
lpcom_ReferencesUtlType = null;
//The return code of the method is displayed by the hexadecimal.
}
//Exception processing
catch (Exception exception)
{
MessageBox.Show(exception.Message ““ MessageBoxButtons.OK MessageBoxIcon.Error);
return;
}
}
#region “PLC连接“
public void connectPLC()
{
int iReturnCode; //Return code
int iLogicalStationNumber = 0; //LogicalStationNumber for ActUtlType
//
//Processing of Open method
//
try
{
//Set the value of ‘LogicalStationNumber‘ to the property.
lpcom_ReferencesUtlType.ActLogicalStationNumber = iLogicalStationNumber;
相关资源
- PLC通讯170294
-
欧姆龙PLC通讯程序源码(HOST li
nk 实 - 三菱plc上载最终程序.gxw
- C# 实现 信捷PLC通讯协议
- C# SHAP7与西门子PLC通讯及模拟
- C#与西门子PLC通讯测试DOME.rar
- 三菱PLC与C#等通讯
- C#与各种PLC通讯测试
- VS C#语言编写的与plc通讯的OPC代码完整
- PLC通讯实现-C#访问三菱PLCCPU-R04-MxCom
- C#实现各大厂商PLC通讯
- 上位机C#以太网连接三菱PLC
- 上位机(C#)MX Component以太网连接三菱
- PLC通讯实现-C#访问OPCUA实现读写PLC
- C#使用ModbusTcp协议与西门子1200PLC通讯
- 基恩士PLC通讯.rar
- 上位机与PLC通讯dll.zip
- C#和西门子1200PLC通讯.zip
- C# 松下PLC通讯协议标准模块
- 松下PLC标准通讯协议C#
- c#与三菱PLC通讯读写
- C# Winform,FX3U-32M,FX3u-ENET-ADP,MC协议
- C#与三菱PLC通讯.rar
- C#与三菱Q系列PLC通讯
- 通过KEPServer opc与PLC通讯程序。
- AB PLC 连接源码c#
- C#对三菱PLC的以太网和串口通讯以及台
- C# 三菱PLC FX5U 通信DEMO
- c#通过MX component连接三菱PLC源代码
- C# 基于以太网使用MX Component控件读写
评论
共有 条评论