Ver a proveniência

从站设置

JXJAgvReake
pry há 1 ano
ascendente
cometimento
9a14ec46c4
1 ficheiros alterados com 6 adições e 2 eliminações
  1. +6
    -2
      BPASmartClient.MorkCL/Server/OtherServer.cs

+ 6
- 2
BPASmartClient.MorkCL/Server/OtherServer.cs Ver ficheiro

@@ -17,14 +17,18 @@ namespace BPASmartClient.MorkCL.Server
MyModbus = new ModbusRtu();
MyModbus.WithModbusRtu(PortName).UseConnected(() =>
{
ModbusRtu myDevice = (ModbusRtu)MyModbus;
TaskManage.GetInstance.StartLong(new Action(() =>
{
MyModbus.Read<bool[]>("LB100".ToModbusAdd(), 4).OnSuccess(s =>
//设置站号
myDevice.SlaveAddress = 1;

myDevice.Read<bool[]>("LB100".ToModbusAdd(), 4).OnSuccess(s =>
{
for (byte i = 0; i < s.Length; i++) BoxDetection[i] = s[i];
});

MyModbus.Read<float>("LW20".ToModbusAdd()).OnSuccess(s => { CurrentWeight = s; });
myDevice.Read<float>("LW20".ToModbusAdd()).OnSuccess(s => { CurrentWeight = s; });

Thread.Sleep(10);
}), $"其它外部设备-{PortName}", true);


Carregando…
Cancelar
Guardar