readMultipleRegisters(0, 12288, 10); if(!$recData) { // Print error information if any echo "
Error:
" . $modbus->errstr . "
"; exit; } // Received data echo "

Received Data

"; print_r($recData); // Conversion echo "

32 bits types

"; // Chunk the data array to set of 4 bytes $values = array_chunk($recData, 4); // Get float from REAL interpretation echo "

REAL to Float

"; foreach($values as $bytes) echo PhpType::bytes2float($bytes) . "
"; // Get integer from DINT interpretation echo "

DINT to integer

"; foreach($values as $bytes) echo PhpType::bytes2signedInt($bytes) . "
"; // Get integer of float from DINT interpretation echo "

DWORD to integer (or float)

"; foreach($values as $bytes) echo PhpType::bytes2unsignedInt($bytes) . "
"; echo "

16 bit types

"; // Chunk the data array to set of 4 bytes $values = array_chunk($recData, 2); // Get signed integer from INT interpretation echo "

INT to integer

"; foreach($values as $bytes) echo PhpType::bytes2signedInt($bytes) . "
"; // Get unsigned integer from WORD interpretation echo "

WORD to integer

"; foreach($values as $bytes) echo PhpType::bytes2unsignedInt($bytes) . "
"; ?>