11/18/2016 6:02 PM | |
Posts: 32 Rating:
|
Hi swiss , Thanks for your feedback . unfortunately i m using CFC V8.0+upd1 there which i could not found I_R blocks .. what should i do ? thanks , deepak |
11/18/2016 6:48 PM | |
Joined: 9/27/2006 Last visit: 8/17/2024 Posts: 12277 Rating:
|
Hello Deepak; Please tell us: are the values you recieve over Modbus in integer format, or are they half of a REAL variable? Cn you read the data as understandable integer values? What numerical value do you see wen you open each one? Normally Modbus will operate on 16-bit values per reister, which means that in order to send a REAL (floating-point) value it requires 2 (consecutive) registers. Usually you doi not try to convert the 2 integers to a RAL value, you simply read the 2 integers as a single REAL value. So if your Modbus slave sends you a REAL value in addresses 40001 and 40002, transfer them to a single 32-bit register and interpret them as REAL. If the bytes have not been swapped you should see a correct floating-point value. If you read an impossible value (say 1.03 e-27) try rearraging the byte order of the original registers. This is called the BIG ENDIAN problem, and is explained fiurther in the following FAQ (this document uses a S7-200 as an example, but is applicable to any PLC, although the byte changes might have to be done by your program): How can you convert a big-endian word or double-word into a little-endian word or double-word and vice versa? https://support.industry.siemens.com/cs/fr/en/view/29155499 Hope thois helps, Daniel Chartier |
Last edited by: dchartier at: 11/18/2016 6:49:50 PM |
|
8/8/2017 8:29 AM | |
Joined: 6/19/2017 Last visit: 8/5/2024 Posts: 8175 Rating:
|
New question published by derioeng is split to a separate thread with the subject How can convert 2 "(W#16#0)" in floating point in the S7 300?. Best regards |
My Forum is the place to personalize your profile, |
|
Follow us on