登录
首页 » 通信 » c# plc modibus 通信

c# plc modibus 通信

于 2022-07-10 发布 文件大小:11.75 kB
0 217
下载积分: 2 下载次数: 1

代码说明:

c# 串口 以太网通信 modibus  连接 plc  从文本框输入负数 -2 补码=反+1=进位+原数 Vb 清除输入缓冲区 输出缓冲区 c#用不用清除??哪个函数?? //發送二進制數據 ?????????????? private void SendBytesData(SerialPort serialPort) { ////从 文本框取得数据 如果负数 -2 怎么办???? byte[] bytesSend = Encoding.Default.GetBytes(txtSend.Text); spcom.Write(bytesSend, 0, bytesSend.Length); } 通过MODBUS TCP读写PLC源码 功能模块一:读写PLC主模块 using System; using System.Net; using System.Net.Sockets; public static void WriteWord(int mwAddress,int mwValue) {写字到以太网 if (init_plc() == 0) { try { hi = mwAddress / 256; low = mwAddress - hi * 256; hi1 = mwValue / 256; ///////////16bit low1 = mwValue - hi * 256; sendBuf[7] = 6; sendBuf[8] = (byte)hi; sendBuf[9] = (byte)low; sendBuf[10]

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • almegal128串口编程
    almegal128串口编程-almegal128 Serial Programming
    2023-04-15 21:55:03下载
    积分:1
  • rfid 射频卡读写驱动
    详细的基于51 单片机的rfid 卡读写驱动,适用于S50非接触式IC卡性能简介(M1),  卡片的电气部分只由一个天线和ASIC组成。 天线:卡片的天线是只有几组绕线的线圈,很适于封装到IS0卡片中。 ASIC:卡片的ASIC由一个高速(106KB波特率)的RF接口,一个控制单元和一个      
    2023-08-15 03:55:03下载
    积分:1
  • 本程序仿真了LCMV算法的误码率,绝对好用!
    本程序仿真了LCMV算法的误码率,绝对好用!-This procedure simulated the bit error rate algorithm for LCMV, absolutely handy!
    2022-07-26 14:30:50下载
    积分:1
  • MSCOMM控件写的串口通讯程序
    MSCOMM控件写的串口通讯程序-MSCOMM Control write serial communication program
    2022-11-10 03:10:04下载
    积分:1
  • NEMA标准公布ps3.1(199X)医学数字成像和通信…
    NEMA标准出版PS3.1(199x) 医学数字影像和通讯(DICOM) 前言 iii 0 介绍 0.1历史 0.2 DICOM标准 0.3未来的方向 1 应用程序的范围和领域 2 规范的参考 3 定义 4 符号和缩写 5 DICOM标准的目的 6 DICOM标准的内容概述 6.1 文档结构 6.2 PART 2:遵从性 6.3 Part 3:信息对象定义 6.4 Part 4:服务类的规范 6.5 Part 5:数据结构和语义学 6.6 Part 6: 数据字典 6.7 Part 7:消息交换 6.8 Part 8:消息交换的网络通讯支持 6.9 Part 9:消息交换的点对点通讯支持 7 标准各部分的关系 -NEMA standards published PS3.1 (199x) Medical Digital Imaging and Communications (DICOM) before Introduction iii 0 history on 0.1 0.3 0.2 DICOM standards in the direction of a future application to the scope and leadership Domain 2 standard definition of reference 3 4 5 symbols and abbreviations DICOM standards aim 6 DICOM standards as outlined Document Structure 6.1 6.2 PART 2 : compliance 6.3 Part 3 : Information Object Definition 6.4 Part 4 : Service category norms 6.5 Part 5 : data structure and semantics 6.6 Part 6 : data dictionary 6.7 Part 7 : exchange 6.8 Part 8 : information exchange network communications supp
    2022-11-04 11:30:03下载
    积分:1
  • 绘制噪声
    用于绘制高斯噪声。这些程序都用在传输信号时的噪声信道的信噪比计算
    2022-05-26 09:46:58下载
    积分:1
  • MFC写的串口测试工具源码
    CSerialPort:: CSerialPort(){单独监禁= FALSE;m_hComm= NULL;//初始化重叠结构成员为零m_ov.Offset= 0;m_ov.OffsetHigh= 0;//创建活动m_ov.hEvent= NULL;m_hWriteEvent= NULL;m_hShutdownEvent= NULL;m_hErrorEvent= NULL;m_hSendCompleteEvent= NULL;m_bThreadAlive= FALSE;m_bSendNotify= FALSE;m_SendList.clear();//初始化关键部分:: InitializeCriticalSection(m_csCommunicationSync);:: InitializeCriticalSection(m_csSendList);}////删除动态内存//CSerialPort::〜CSerialPort(){ReleasePort();:: DeleteCriticalSection(m_csCommunicationSync);:: DeleteCriticalSection(m_csSendList);}无效CSerialPort:: ReleasePort(){而(m_bThreadAlive){而::休眠(1)(m_SendList.empty()!); //2012-09-27zhaoz修复停止仪器采集后数据报文发送不出去问题SetEvent的(m_hShutdownEvent);睡眠(1);}
    2022-02-25 01:02:02下载
    积分:1
  • 哈夫曼编译码程序,可以对任意给定的字符串进行编译码,并将生成的中间编码写入到文件...
    哈夫曼编译码程序,可以对任意给定的字符串进行编译码,并将生成的中间编码写入到文件-Huffman coding and decoding process can be arbitrary to the strings encryption and code generation into the middle of the document
    2022-09-25 14:50:03下载
    积分:1
  • j2me的手机游戏,支持任何型号的手机,安装wtk就可以运行了
    j2me的手机游戏,支持任何型号的手机,安装wtk就可以运行了-J2ME handset game, support any type of phone, can be installed wtk run
    2022-03-22 12:38:49下载
    积分:1
  • C程序计算在AWGN信道的BPSK调制的误码率性能…
    C program to calculate the BER performance of BPSK modulation in an AWGN channel. The program takes the file "BPSK" containing voltage levels and passes it in an AWGN channel with a given SNR. The received message is then Hard decision decoded and the bit error rate is calculated. The BER over different SNR is calculated. THe output values can be used to draw a BER vs SNR(dB) curve.
    2022-07-17 05:04:31下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载