From a7ab44bca33c0bfc85b301f6edc7398aecb74a81 Mon Sep 17 00:00:00 2001 From: ZengTao <2773468879@qq.com> Date: 星期四, 14 九月 2023 17:03:13 +0800 Subject: [PATCH] 主界面添加1280*1024显示 --- springboot-vue3/src/main/java/com/example/springboot/component/S7control.java | 9 ++++++--- 1 files changed, 6 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 5942a98..dca9e9c 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 @@ -10,15 +10,17 @@ public class S7control { S7PLC s7PLC; // PLC閫氳绫诲疄渚� - private EPlcType plcType = EPlcType.S1200; // 瑗块棬瀛怭LC绫诲瀷 - private String ip = "127.0.0.1"; // plc ip鍦板潃 - private int port = 21; // plc 绔彛鍙� + private EPlcType plcType = EPlcType.S1500; // 瑗块棬瀛怭LC绫诲瀷 + private String ip = "192.168.10.1"; // plc ip鍦板潃 + private int port = 102; // plc 绔彛鍙� private static volatile S7control instance = null; private S7control() { if (s7PLC == null) s7PLC = new S7PLC(plcType, ip, port); + s7PLC.connect(); + System.out.println(ip); } // 鍗曚緥妯″紡 鑾峰彇绫荤殑鍞竴瀹炰緥 @@ -145,6 +147,7 @@ public List<Short> ReadWord(List<String> address) { if (!s7PLC.checkConnected()) return null; + return s7PLC.readInt16(address); } -- Gitblit v1.8.0