PHP code example of erikwang2013 / industrial-protocols-hart

1. Go to this page and download the library: Download erikwang2013/industrial-protocols-hart library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

erikwang2013 / industrial-protocols-hart example snippets


$conn = $kernel->getConnectionManager()->connect('hart-device');
$conn->read('pv');             // 主变量
$conn->read('loop_current');   // 回路电流
$conn->read('device_info');    // 厂商/型号/版本

'devices' => [
    'hart-device' => [
        'protocol' => 'hart',
        'device' => '/dev/ttyUSB1',  // HART 调制解调器
        'address' => 0,              // 0=单点, 1-15=多点
        'timeout' => 5000,
    ],
],