Signal range of data type real
I have two questions.
I have had a problem reading REAL numbers through ModBus and always get the sem error [-5] in the MBTCPRead block. Does anyone know what this error stands for because it is not in the manual? When I swich over to read DINT I have no problems.
I'm trying to read from ABB ANR96 Measuring station and since I'm not able to read REAL I wanted to read the 64bit INT and convert to REAL but then I found out I could not write value higher than 2147483147 (MaxDInt). Why can I not write higher value in REAL variable that I thought was in IEEE-754 format that should have maximum representable IEEE 754 floating-point value (2 − 2^ (-23) ) × 2^ (127) ≈ 3.402823 × 10^ (38) ?
Thanks for quick answers,
Voted best answer
As I know, you can't read dirctly REAL trough Modbus. Modbus supports only 16-bits transfer - e.g. INT or WORD.
Error -5 means that you used the wrong data format for read variables, set at MBTCPRead block (for example WORD). You have to use only INT or DINT for these parameters.
I'm reading the 32-bit real trough Modbus by means of 2 consequent INT variables, then use 2 blocks INT_TO_WORD and then WORDS_TO_REAL (using correct big endian format).
Respectively DINT_TO_WORD or DINT_TO_REAL have some disadvantages - please look in CBM help for this.
In order to read 64-bit real by means of Modbus, you can look in the post
That is another beer.
In CBM Editor, in case you put initial value for real variable, you have to put a decimal point ! Especially if the value is greater than 2147483147
A/ 214748314722 (bigger than 2147483147) = report Error 1040 : Variables : Bad number: 214748314722
B/ 214748314722.0 = no error
As principle, it is a good idea the real values to be written as real number -> 1.0 instead of 1