fixed the examples

This commit is contained in:
2016-11-20 11:29:09 +01:00
parent 61e7a690eb
commit 4256b6cef7
13 changed files with 203 additions and 209 deletions
+8 -12
View File
@@ -1,26 +1,22 @@
<?php
require_once dirname(__FILE__) . '/../Phpmodbus/ModbusMaster.php';
use PHPModbus\ModbusMaster;
// Create Modbus object
$modbus = new ModbusMaster("192.192.15.51", "UDP");
// Data to be writen
$data = array(-1000);
$dataTypes = array("INT");
try {
// FC6
$modbus->writeSingleRegister(0, 12288, $data, $dataTypes);
}
catch (Exception $e) {
// Print error information if any
echo $modbus;
echo $e;
exit;
// FC6
$modbus->writeSingleRegister(0, 12288, $data);
} catch (Exception $e) {
// Print error information if any
echo $modbus;
echo $e;
exit;
}
// Print status information
echo $modbus;
?>