From a8baebe7ac7d7e03ae833815e8d94b996dfd3b5e Mon Sep 17 00:00:00 2001 From: lss <Lss@HanInfo> Date: 星期五, 16 五月 2025 17:23:15 +0800 Subject: [PATCH] 叠盘机流程开发与问题优化 --- HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/device/S7Helper.cs | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/device/S7Helper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/device/S7Helper.cs index daf817e..9ebdd29 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/device/S7Helper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/device/S7Helper.cs @@ -67,8 +67,30 @@ //https://www.ad.siemens.com.cn/productportal/Prods/S7-1200_PLC_EASY_PLUS/SmartSMS/060.html //https://www.ad.siemens.com.cn/productportal/Prods/S7-1200_PLC_EASY_PLUS/07-Program/02-basic/01-Data_Type/09-String.html + /// <summary> + /// 鍚堣偉浣抽�璇诲彇鍙犵洏鏈�+ /// </summary> + /// <param name="pyl">鍋忕Щ閲忓湴鍧�紝浣抽�byte鍗犱綅鎵�互鍙互鐢ㄨ繖鏍锋柟寮忕洿鎺ヨ鍙栧啓鍏�DB200.DBX0.1</param> + /// <returns></returns> + public static int ReadDpj(string pyl) + { var plc = new Plc(CpuType.S71500, "192.168.1.1", 0, 1); + S7Helper.Link(plc); + return (int)plc.Read(pyl); + } + /// <summary> + /// 鍚堣偉浣抽�鍐欏叆鍙犵洏鏈�+ /// </summary> + /// <param name="pyl">鍋忕Щ閲忓湴鍧�紝浣抽�byte鍗犱綅鎵�互鍙互鐢ㄨ繖鏍锋柟寮忕洿鎺ヨ鍙栧啓鍏�DB200.DBX0.1</param> + /// <param name="value">鍐欏叆鍊�byte绫诲瀷鍙兘0 1</param> + /// <returns></returns> + public static int WriteDpj(string pyl,int value) + { + var plc = new Plc(CpuType.S71500, "192.168.1.1", 0, 1); + S7Helper.Link(plc); + return (int)plc.Write(pyl, value); + } internal static short[] ReadInt(string device, int db, int byteAddr, int count) { short[] result = null; try { @@ -115,8 +137,6 @@ } return result; } - - /// <summary> /// -- Gitblit v1.9.1