PHP code example of erikwang2013 / industrial-protocols-ethercat

1. Go to this page and download the library: Download erikwang2013/industrial-protocols-ethercat 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-ethercat example snippets


$bridge = new ExternalProcessBridge('/opt/ethercat-sdk/bin/ecat_master');
$conn = $kernel->getConnectionManager()->connect('ethercat-device', [
    'protocol' => 'ethercat', 'bridge' => $bridge,
]);
$result = $conn->read('0x6000:0x01');  // CoE SDO 读取