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

Ergebnis Runden

zobas
2021-11-24
2021-11-26
  • zobas - 2021-11-24

    Gude,
    ich habe ein Ergebnis vom typ REAL. Diese mΓΆchte ich nach einer kommastelle runden. Wie mache ich das?

     
  • thommy54 - 2021-11-26

    Hallo,
    mit der oscat_basic-Lib ( von der Codesys-Seite kostenlos downloaden) mache ich sowas:

    my_string:= oscat_basic.REAL_TO_STRF(.r_Temperatur,1,'.');
    

    "1" .. 1 Stelle nach dem Komma
    "." .. Dezimal-Zeichen

    Will ich die REAL-Zahl mit einer Kommastelle erzeugen, muss ich den String wieder in Real verwandeln.

    my_real:=STRING_TO_REAL(oscat_basic.REAL_TO_STRF(.r_Temperatur,1,'.'));
    

    Grüße
    Thomas

     

Log in to post a comment.