File modules/modbusy/request/MultipleHoldingRegistersReader.class.php
Last commit: Thu Dec 26 19:50:18 2024 +0100 Jan Dankert New: ModbusTCP for later use in the scriptbox.
1 <?php 2 namespace modbusy\request; 3 4 5 class MultipleHoldingRegistersReader extends MultibyteRequest 6 { 7 public function __construct() 8 { 9 parent::__construct(); 10 $this->functionCode = 3; 11 } 12 13 /** 14 * @param $startAdress 15 * @param $byteCount 16 * @return false|string 17 */ 18 public function readFrom($startAdress,$byteCount ) 19 { 20 return parent::request( 21 pack('n',$startAdress). // 2 bytes: start address 22 pack("n",ceil((9+$byteCount)/2)) // 2 bytes: number of bytes to read 23 ); 24 } 25 }
Downloadmodules/modbusy/request/MultipleHoldingRegistersReader.class.php
History Thu, 26 Dec 2024 19:50:18 +0100 Jan Dankert New: ModbusTCP for later use in the scriptbox.