From fdda48e034b2da82fb100ec04f5b51351477e2bb Mon Sep 17 00:00:00 2001 From: yantian yue <306727702@qq.com> Date: 星期五, 29 十二月 2023 14:31:09 +0800 Subject: [PATCH] 更新 --- YX/wt/Frmwt.cs | 32 +++++++++++++++----------------- YX/obj/Debug/YX.exe | 0 YX/bin/Debug/YX.exe | 0 .vs/YX/v16/.suo | 0 YX/obj/Debug/YX.pdb | 0 YX/bin/Debug/YX.pdb | 0 YX/obj/Debug/DesignTimeResolveAssemblyReferences.cache | 0 7 files changed, 15 insertions(+), 17 deletions(-) diff --git a/.vs/YX/v16/.suo b/.vs/YX/v16/.suo index 4deea29..197766c 100644 --- a/.vs/YX/v16/.suo +++ b/.vs/YX/v16/.suo Binary files differ diff --git a/YX/bin/Debug/YX.exe b/YX/bin/Debug/YX.exe index bbb01cd..a008bf6 100644 --- a/YX/bin/Debug/YX.exe +++ b/YX/bin/Debug/YX.exe Binary files differ diff --git a/YX/bin/Debug/YX.pdb b/YX/bin/Debug/YX.pdb index b9fedcc..00f81e3 100644 --- a/YX/bin/Debug/YX.pdb +++ b/YX/bin/Debug/YX.pdb Binary files differ diff --git a/YX/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/YX/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 63094c9..588a70b 100644 --- a/YX/obj/Debug/DesignTimeResolveAssemblyReferences.cache +++ b/YX/obj/Debug/DesignTimeResolveAssemblyReferences.cache Binary files differ diff --git a/YX/obj/Debug/YX.exe b/YX/obj/Debug/YX.exe index bbb01cd..a008bf6 100644 --- a/YX/obj/Debug/YX.exe +++ b/YX/obj/Debug/YX.exe Binary files differ diff --git a/YX/obj/Debug/YX.pdb b/YX/obj/Debug/YX.pdb index b9fedcc..00f81e3 100644 --- a/YX/obj/Debug/YX.pdb +++ b/YX/obj/Debug/YX.pdb Binary files differ diff --git a/YX/wt/Frmwt.cs b/YX/wt/Frmwt.cs index 31a0d79..8ab97a3 100644 --- a/YX/wt/Frmwt.cs +++ b/YX/wt/Frmwt.cs @@ -13,7 +13,7 @@ using System.Windows.Forms; using System.Threading; using System.Configuration; -using EasyModbus; // 寮曞叆EasyModbusTCP搴� ***** +using EasyModbus; // 寮曞叆EasyModbusTCP搴� using System.IO.Ports; using System.Net.NetworkInformation; @@ -84,26 +84,24 @@ ConnectServer(ipAddress, port1); int[] data = tcpClient.ReadHoldingRegisters(startingAddress, quantity); // 璇诲彇瀵勫瓨鍣ㄦ暟鎹� string strData = ""; // 瀛樺偍瀛楃涓叉暟鎹� - //string str = ""; - //string str1 = ""; - //string str2 = ""; + string str = ""; + string str1 = ""; + string str2 = ""; for (int i = 0; i < quantity; i++) { - //str= data[i].ToString("X"); - //if (str.Length == 4) - //{ - // str1 = str.Substring(2, 2); - // str2 = str.Substring(0, 2); - // strData += str1 + str2; - //} - //if (str.Length == 2) - //{ - // strData += str; - //} - strData += data[i].ToString("X"); + str = data[i].ToString("X"); + if (str.Length == 4) + { + str1 = str.Substring(2, 2); + str2 = str.Substring(0, 2); + strData += str1 + str2; + } + if (str.Length == 2) + { + strData += str; + } } - string str66 = hexStrToStr(strData); return hexStrToStr(strData); ; } -- Gitblit v1.9.3