About the data type conversion

skytianlin
2013-04-10
2013-04-10
  • skytianlin - 2013-04-10

    Hi! engineers:
    I want to kown whether I can take a funciton, such as "real_to_int" to convert the DINT to DWORD by CoDeSys.
    I have tried to use the keyword for DINT_TO_DWORD, but it can be realized by CoDeSys.

     
  • Anonymous - 2013-04-10

    Originally created by: M.Schaber

    Hi, skytianlin,

    skytianlin hat geschrieben:
    I want to kown whether I can take a funciton, such as "real_to_int" to convert the DINT to DWORD by CoDeSys.
    I have tried to use the keyword for DINT_TO_DWORD, but it can be realized by CoDeSys.

    The type conversion functions are documentet in the online help, there is a chapter about type conversion operators.

    In your case, the ANY_TO_INT() should work:

    re : REAL := 1.234; 
    i : INT := ANY_TO_INT(re)
    
     

Log in to post a comment.