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.