Comments (3)
I'm sorry, but i have no cpu to test it.
Can anyone else please test and debug this issue?
from phosphor7.
thanks for your replay .
I tested it .
I have a cpu 1500
from phosphor7.
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 = new TSnap7MicroClient();
$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.
from phosphor7.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phosphor7.