资源简介
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.IO.Ports;
using System.Threading;
using System.Drawing;
public class XinJie //信捷PLC通信协议
{
SerialPort Port = new SerialPort();
private int PortBusy;
private byte cmdType;
public object LockcomportObj = new object();
private int returnValue;
private int dataCnt = 1;
private int[] returnArr;
public double comErrorCnt = 0;
public bool bConnection = false;
public string comStatus = “OK“;
private byte modbus = 0x01;
public bool readM(int address out bool M)
{
int[] re = new int[0];
bool result;
result = comPLC(0x01 address 1 1 ref re);
if (result == true)
{
if (re[0] == 1) M = true;
else M = false;
return true;
}
else
{
M = false;
return false;
}
}
public bool writeM(int address bool state)
{
int[] re = new int[0];
bool result;
if (state == true)
{
result = comPLC(0x05 address 1 1 ref re);
}
else
{
result = comPLC(0x05 address 0 1 ref re);
}
if (result == true)
{
return true;
}
else
{
return false;
}
}
public bool writeHM(int address bool state)
{
int[] re = new int[0];
bool result;
if (state == true)
{
result = comPLC(0x105 address 1 1 ref re);
}
else
{
result = comPLC(0x105 address 0 1 ref re);
}
if (result == true)
{
return true;
}
else
{
return false;
}
}
public bool readSingleD(int address out int Data)
{
bool result;
int[] re;
re = new int[0];
result = comPLC(0x03 address 1 1 ref re);
if (result == true)
{
Data = re[0];
return true;
}
else
{
Data = 0;
return false;
}
}
public bool readDoubleD(int address out int Data)
{
bool result;
int[] re;
re = new int[0];
result = comPLC(0x20 address 1 1 ref re);
if (result == true)
{
Data = re[0];
return true;
}
else
{
Data = 0;
return false;
}
}
public bool readMultipleD(int address int cnt out int[] Data)
{
bool result;
int[] re;
re = new int[0];
result = comPLC(0x20 address 1 cnt ref re);
if (result == true)
{
Data = re;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 32573 2020-08-05 13:59 XinJie.cs
相关资源
- C# SHAP7与西门子PLC通讯及模拟
- C# 通过S7.NET方式实现与西门子PLC通信
- 物联网设备通讯协议实现客户端(I
- 基于webapi的PLC软件控制(softplc)
- 上位机语音识别控制PLC源码(附西门
- HMI-with-WPF-part-3-Communication-with-multipl
- 松下PLC与C#通讯串口调试入门教程.z
- 用C#实现PC与西门子PLC串行通讯
- C#与西门子PLC通讯测试DOME.rar
- Modbus通讯协议-C#源码
- 西门子 S7-200 PLC 通信DLL
- S7.NET-EXE.rar
- PCQQ协议 C#版本
- BacNet协议应用软件
- 三菱PLC与C#等通讯
- 安卓QQ5.8协议 C#版本
- 宏电DTU的DDP协议GPRS DSC中心源代码DE
- C#与各种PLC通讯测试
- ISO15693协议读写器开发源码
- VS C#语言编写的与plc通讯的OPC代码完整
- 松下PLC与C#上位机通讯库含程序.rar
- 欧姆龙PLC网络通信程序
- 通过http协议上传文件
- C#读取ABPLC驱动程序和ABPLC模拟器
- C#基于OPC服务器读写欧姆龙PLC数据
- DELTA DVP Series PLC.zip
- PLC通讯实现-C#访问三菱PLCCPU-R04-MxCom
- C#与三菱FX通过串口RS232通讯
- C#实现各大厂商PLC通讯
- 0237 C#通过OPC连接PLC读写数据源码.ra
评论
共有 条评论