LREAL Data Type in Control Logix L71

Ihtisham

Member
Join Date
Aug 2023
Location
Pakistan
Posts
3
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?

Is there any workaround?

Image 1.jpg Image 2.jpg
 
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.
 
... Is there any workaround?

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.

  1. COPy the high three Modbus words into the first three words of an an ARRAY[4] of INTs or UINTs, call it intarray
    1. the least significant word is first
    2. figuring out the Modbus device's word order is left as an exercise
  2. BSL (Bit-Shift Left) the 64 bits of the intarray three times
    1. OTU ctl.EN CTU intarray[0] ctl anybit 64 OTU ctl.EN CTU intarray[0] ctl anybit 64 OTU ctl.EN CTU intarray[0] ctl anybit 6
    2. The value of the source bit boolean anybit does not matter.
  3. Transfer the sign and high exponent bits of the original LREAL back three bits
    1. XIC intarray[3].2 OTE intarray[2].15
    2. XIC intarray[3].1 OTE intarray[2].14
  4. COPy the middle two words to a REAL
    1. 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.
      • If it works, you are essentially done;
      • if not, get out your tap shoes.
References

 
Last edited:
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.
Untitled.png
 

Similar Topics

I'm writing some structured text that's handling a data structure that comes from a PC. The PC structure is in the "new" LREAL 64-bit floating...
Replies
3
Views
493
I am needing to convert the low DWORD of a timestamp into a LREAL. The DWORD is a 32bit unsigned number. In TwinCat2, I keep getting a negative...
Replies
3
Views
1,688
Hello. I have a db which is 1000 INT, and this db is represented in WinCC as a raw data type set of 5x 400 Bytes. This set is read with a script...
Replies
0
Views
31
So i've been at this for a long while, i have Citect Scada 2018, i have full access to everything but i can't seem to find any option or...
Replies
0
Views
50
Hello I have a s7-1200 and I would like to read the tags present in this controller with my controllogix controller. The two controllers don't use...
Replies
5
Views
161
Back
Top Bottom