Few days ago , working on a Wago PFC controller (32bit ARM CPU), I get the need to manage a LREAL data (64bit)


With Codesys 3.5 and 64bit CPU, this can be simply solved by:

  • AB AT %MW0 : WORD;   --> input word 0
  • BC AT %MW1 : WORD;  --> input word 1
  • EF AT %MW2 : WORD;  --> input word 2
  • GH AT %MW3 : WORD; --> input word 3

 And here comes the issue: Codesys 2.3 doesn't have "%ML" instruction morevover Wago CPU doesn't manage 64bit...

By definitions this is the Double-precision 64bit floating point format:

So, to solve my needs all I have to do is to accept a precision losses (32bit-fraction lossis)


and this is the Codesys 2.3 source code

 LREAL to REAL Codesys 2.3 source code