|
|
@ -11,7 +11,7 @@ public class DataExchangeHelper { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int[] decodedCH = new int[17]; |
|
|
public static int[] decodedCH = new int[16]; |
|
|
static double slope = 1000.0 / (1950 - 1500); |
|
|
static double slope = 1000.0 / (1950 - 1500); |
|
|
|
|
|
|
|
|
public static int[] getdecodedCH(byte[] receivedData) { |
|
|
public static int[] getdecodedCH(byte[] receivedData) { |
|
|
@ -103,12 +103,12 @@ public class DataExchangeHelper { |
|
|
} |
|
|
} |
|
|
System.arraycopy(byteArray, 0, bytesToSend, 0, byteArray.length); |
|
|
System.arraycopy(byteArray, 0, bytesToSend, 0, byteArray.length); |
|
|
|
|
|
|
|
|
ModbusRtuSlaveService.holdingRegisters[19] = (short) byteArray.length; |
|
|
ModbusRtuSlaveService.holdingRegisters[18] = (short) byteArray.length; |
|
|
//将数据转为小端发送
|
|
|
//将数据转为小端发送
|
|
|
for (int i = 0; i < modifyHoldingRegisterNum; i++) { |
|
|
for (int i = 0; i < modifyHoldingRegisterNum; i++) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ModbusRtuSlaveService.holdingRegisters[20 + i] = (short) ( |
|
|
ModbusRtuSlaveService.holdingRegisters[19 + i] = (short) ( |
|
|
((bytesToSend[2 * i + 1] & 0xFF) << 8) | // 高位字节
|
|
|
((bytesToSend[2 * i + 1] & 0xFF) << 8) | // 高位字节
|
|
|
bytesToSend[2 * i] & 0xFF); // 低位字节
|
|
|
bytesToSend[2 * i] & 0xFF); // 低位字节
|
|
|
|
|
|
|
|
|
|