Is there a way to use LREAL Data type on L71. I am getting 64 bit Double (IEEE754 Double precision 64-bit) data from a modbus device onto PLC via Prosoft gateway. However I am unable to interpret this as the L71 controller does not support this data type?
As JeremyM mentions, the LREAL type (along with a few others) were introduced at around v32, for ControlLogix L8x controllers and CompactLogix 5069 controllers only. Those types are not available in the L7 at any firmware revision.
A hack workaround would be to mash a select 32 bits the high three words (48 bits) of the Modbus LREAL-equivalent to a 32-bit REAL, if that is good enough. The accuracy will be one part in eight million instead of one part in two quadrillion, but unless you are counting atoms it may be good enough.
COPy the high three Modbus words into the first three words of an an ARRAY[4] of INTs or UINTs, call it intarray
the least significant word is first
figuring out the Modbus device's word order is left as an exercise
BSL (Bit-Shift Left) the 64 bits of the intarray three times
OTU ctl.ENCTU intarray[0] ctl anybit 64 OTU ctl.ENCTU intarray[0] ctl anybit 64 OTU ctl.ENCTU intarray[0] ctl anybit 6
The value of the source bit boolean anybit does not matter.
Transfer the sign and high exponent bits of the original LREAL back three bits
XIC intarray[3].2 OTE intarray[2].15
XIC intarray[3].1 OTE intarray[2].14
COPy the middle two words to a REAL
COP intarray[1] realtag 1
The value of realtag will be the same as the value of the LREAL from the Modbus device, assuming the LREAL value can be represented by the REAL format.
Caveats
This assumes the L71 is LSByte-first
If that is not the case, a similar approach with a bit more tap dancing will be required,
But the simplest thing to do would be to code a test as above with four Modbus values for a known LREAL value on the Modbus device and see if it works.
At that point, it may be sane to preface your work with: "We had to forgo hardware performance do soft floating-point to navigate artificial type limitations. Sorry."
At that point, it may be sane to preface your work with: "We had to forgo hardware performance do soft floating-point to navigate artificial type limitations. Sorry."
Here it is the workaround OP is looking for in RSLogix 500 (Micro Started Lite), running on a MicroLogix 1100.
The four rungs of subroutine LREAL2REAL implements the workaround; the instructions on the four branches of Rung 0000 can be on one rung with no branches in RSLogix/Studio 5000.
The other subroutines are for emulating the Modbus transfer, testing, and validation.