Problem with Real type in CoDeSys 2.3

Claudio-Fi
2009-06-05
2010-06-25
  • Claudio-Fi - 2009-06-05

    I need to use a real value, in order to have a precision with 10 decimal figures, eg: 1234.567891

    The problem is that codesys truncates, my variable at 7 figures eg: 1234.568

    There is a way to use a "double precision" of a 64 bit Real number?

    I tryed to use the LREAL but when I try to build the project a message say me that LREAL is unsuported type.

    Thank you in advance,

    Claudio

    p.s.: I used like target device a ESX micro.

     
  • Avgur - 2009-06-08

    go to http://www.oscat.de/ get the latest Oscat.lib and work with double precision real numbers

     
  • spfeif - 2009-06-16

    Check the PROJECT-OPTIONS-BUILD menu from CoDeSys there is a check box for treat LREAL as REAL. Make sure your PLC supports LREAL. I had some problems in the past when a project would not compile. Why do you need 10 decimal places? In other words is this your calculation? Can you do this with interger math?

     
  • Anonymous - 2010-06-23

    Originally created by: Carmichael_keith

    Thanks Spfeif, just had a similar problem as this dude and ur idea solved it.

     
  • shooter - 2010-06-25

    a real has low precision by nature.

    better to solve it in INT or with textbased math like mathcad,

    if possible try indeed oscat for this, and if still having problems contact us again and we will do your math in text.

    almost inifinte precision is possible.

     

Log in to post a comment.