Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

integer to Real datatype conversion

2018-05-11
2018-05-14
  • joelprasad2014 - 2018-05-11

    I am trying to convert a data in integer datatype to Real datatype. I have tried many ways but not able to accomplish the task. Please suggest the correct method

    Thanks
    Joel

     
  • Anonymous - 2018-05-11

    Originally created by: rickj

    I think you're looking for Operator β€˜TO_<xxx></xxx>.

     
  • joelprasad2014 - 2018-05-12

    Which 'To xxxx' operator is the correct one? I have already tried with To Real, To ASCII.

     
  • Anonymous - 2018-05-14

    Originally created by: rickj

    TO_REAL should work for you. ASCII is not a valid data type but STRING is. This works for me...

    VAR
    Β  Β MyIntΒ  Β : INT:=42;
    Β  Β MyRealΒ  Β : REAL;
    END_VAR
    MyReal := TO_REAL(MyInt);
    
     

Log in to post a comment.