dathlin / HslCommunication

A very popular industrial Internet of Things communication plug-in. Using this dll can be very convenient, stable, and fast to obtain data from PLC equipment of multiple brands, and also supports redis, mqtt, websocket, etc., which can let your data on the network Free transmission, reducing enterprise development costs.
http://www.hslcommunication.cn
1.64k stars 630 forks source link

西门子S7-300批量采集BOOL数据值解析有误 #21

Open Uchiha-Peng opened 3 years ago

Uchiha-Peng commented 3 years ago

image

逐条采集代码

Console.WriteLine((await siemensTcpNet.ReadBoolAsync("I2.3")).Content);
                Console.WriteLine((await siemensTcpNet.ReadBoolAsync("I2.4")).Content);

批量采集代码

   var result = await siemensTcpNet.ReadAsync(addressArray, lenArray);
            var byteArray = result.Content;

    case "BOOL":
                    result = siemensS7Net.ByteTransform.TransBool(byteArray, startIndex);
                    break;

用两种方式采集的数据,核对发现一次性采集BOOL类型的值解析有误。

Uchiha-Peng commented 3 years ago

付费用户,请协助解决。