You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 18, 2023. It is now read-only.
$buffer = "";
$c->DBRead(7, 48, 2, $buffer); // I want read value of energy
var_dump(bin2hex($buffer));
$c->Disconnect();
I have in output 477d but it is false ( because is not real)
The text was updated successfully, but these errors were encountered:
If you want lo read a float value (in PLC named REAL), use s7_phphelper::getS7_Real.
I test it on S7-300 CPU and work well.
Remember to read 4bytes for every REAL value.
require_once("../src/phosphor7.php");
require_once("../src/s7_phphelper.php");
$c = newTSnap7MicroClient();
$c->ConnectTo("192.168.1.216", 0, 2);
$floatBuff = "";
$c->DBRead(101, 38, 8, $floatBuff); // from DB101.DBB38 for 8 bytes$c->Disconnect();
$fVal = s7_phphelper::getS7_Real($floatBuff, 0);
echo"1st float: " . $fVal . "\n"; // 12.34 in my PLC$fVal = s7_phphelper::getS7_Real($floatBuff, 4);
echo"2nd float: " . $fVal . "\n"; // 5.6 in my PLC
For S7-1500 the data block must have the flag optimized block off.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
require_once("../src/phosphor7.php");
$c = new TSnap7MicroClient();
$c->ConnectTo("10.11.6.2", 0, 0);
$buffer = "";
$c->DBRead(7, 48, 2, $buffer); // I want read value of energy
var_dump(bin2hex($buffer));
$c->Disconnect();
I have in output 477d but it is false ( because is not real)
The text was updated successfully, but these errors were encountered: