我试图访问通过ModbusTcp发送的int16数据,但我只收到2倍的int8 (作为两个而不是一个寄存器)。谁知道如何将可读寄存器从2倍int8改为1倍int16?提前谢谢。
https://github.com/krakorj/phpmodbus/blob/cebe783e922232100b9f1b74f33613cdbd4bc809/Phpmodbus/ModbusMaster.php发布于 2018-07-26 21:19:59
使用PhpType类将接收到的Modbus数据(字节数组)转换为PHP数据类型。
$array = $modbus->readMultipleRegisters(1, 1, 1);
$val_signedInt = PhpType::bytes2signedInt($array);https://stackoverflow.com/questions/51497068
复制相似问题