From 892b13a55e27a950993f3d0fafb997be5360177d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 11 八月 2020 14:25:38 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/DevpThread.java | 41 +++++++++++++++++++++++++++++++++++++----
1 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/DevpThread.java b/src/main/java/com/zy/core/thread/DevpThread.java
index b8cfd82..03f028f 100644
--- a/src/main/java/com/zy/core/thread/DevpThread.java
+++ b/src/main/java/com/zy/core/thread/DevpThread.java
@@ -1,8 +1,9 @@
package com.zy.core.thread;
-import com.zy.common.HslCommunication.Core.Types.OperateResult;
-import com.zy.common.HslCommunication.Profinet.Siemens.SiemensPLCS;
-import com.zy.common.HslCommunication.Profinet.Siemens.SiemensS7Net;
+import HslCommunication.Core.Types.OperateResult;
+import HslCommunication.Core.Types.OperateResultExOne;
+import HslCommunication.Profinet.Siemens.SiemensPLCS;
+import HslCommunication.Profinet.Siemens.SiemensS7Net;
import com.zy.core.Slave;
import com.zy.core.ThreadHandler;
import com.zy.core.cache.MessageQueue;
@@ -52,6 +53,10 @@
break;
case 2:
break;
+ case 3:
+ break;
+ case 4:
+ break;
default:
break;
}
@@ -67,6 +72,8 @@
public boolean connect() {
boolean result = false;
siemensS7Net = new SiemensS7Net(SiemensPLCS.S1200, slave.getIp());
+ siemensS7Net.setRack((byte) 0);
+ siemensS7Net.setSlot((byte) 1);
OperateResult connect = siemensS7Net.ConnectServer();
if(connect.IsSuccess){
result = true;
@@ -82,14 +89,35 @@
* 璇诲彇宸ヤ綔鍙�
*/
private void readWorkNo(){
-
+ OperateResultExOne<int[]> read = siemensS7Net.ReadInt32("DB100", (short) 8);
+ if (read.IsSuccess) {
+ int staNo1 = read.Content[0];
+ int staNo2 = read.Content[1];
+ int staNo3 = read.Content[2];
+ int staNo4 = read.Content[3];
+ int staNo5 = read.Content[4];
+ int staNo6 = read.Content[5];
+ int staNo7 = read.Content[6];
+ int staNo8 = read.Content[7];
+ }
}
/**
* 璇诲彇鐩爣绔�
*/
private void readStaDest(){
+ OperateResultExOne<byte[]> read = siemensS7Net.Read("DB101", (short) 8);
+ if (read.IsSuccess) {
+ int staNo1 = siemensS7Net.getByteTransform().TransInt32(read.Content, 0);
+ int staNo2 = siemensS7Net.getByteTransform().TransInt32(read.Content, 4);
+ int staNo3 = siemensS7Net.getByteTransform().TransInt32(read.Content, 8);
+ int staNo4 = siemensS7Net.getByteTransform().TransInt32(read.Content, 12);
+ int staNo5 = siemensS7Net.getByteTransform().TransInt32(read.Content, 16);
+ int staNo6 = siemensS7Net.getByteTransform().TransInt32(read.Content, 20);
+ int staNo7 = siemensS7Net.getByteTransform().TransInt32(read.Content, 24);
+ int staNo8 = siemensS7Net.getByteTransform().TransInt32(read.Content, 28);
+ }
}
/**
@@ -106,6 +134,11 @@
}
+ private void writeWorkNo(){
+
+
+
+ }
@Override
public void close() {
--
Gitblit v1.9.1