From 814323aa300f65154c299a9f3b1c44aa6cb5e9c6 Mon Sep 17 00:00:00 2001 From: 严智鑫 <test> Date: 星期五, 22 三月 2024 10:59:59 +0800 Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/Albania_Mes --- springboot-vue3/src/main/java/com/example/springboot/component/S7control.java | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java b/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java index 7878a32..d4a7529 100644 --- a/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java +++ b/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java @@ -18,7 +18,7 @@ S7PLC s7PLC; // PLC閫氳绫诲疄渚� private EPlcType plcType = EPlcType.S1500; // 瑗块棬瀛怭LC绫诲瀷 private String ip = "192.168.10.1"; // plc ip鍦板潃 - private int port = 65; // plc 绔彛鍙� + private int port = 102; // plc 绔彛鍙� private static volatile S7control instance = null; @@ -201,7 +201,6 @@ public List<Short> ReadWord(String address, int count) { if (s7PLC == null) return null; - List<String> addresslist = GetAddressList(address, count, 16); try { return s7PLC.readInt16(addresslist); @@ -211,7 +210,13 @@ return null; } } - + public byte[] Readbyte(String address, int count) { + byte[] byt=new byte[count]; + int wordcount=((count%2==0)?count/2:count+1); + List<Short> word=ReadWord(address,wordcount); + + return byt; + } /** * 鎸夋寚瀹氱殑鍦板潃 璇诲彇byte缁撴灉闆� * -- Gitblit v1.8.0