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
falls es dir aber nur ums anzeigen in der visualisierung geht kannst du einfach anstatt %s, wie man's mit 'ner string ausgabe machen würde, %2.4f angeben. so wird die real variable für die ausgabe formatiert.
aber das wird dir nicht helfen, wenn du die ausgabe als string brauchst...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hallo,
gibt es eine fertige Function, die eine Realzahl Formatiert in einen String konvertiert?
Statt '0,001251' erhalte ich mit REAL_TO_STRING '1.251e-003'.
Hätte gerne '_0,0012'.
gute frage,
sowas wäre doch was für die neue oscat lib
falls es dir aber nur ums anzeigen in der visualisierung geht kannst du einfach anstatt %s, wie man's mit 'ner string ausgabe machen würde, %2.4f angeben. so wird die real variable für die ausgabe formatiert.
aber das wird dir nicht helfen, wenn du die ausgabe als string brauchst...
Hallo
Ich habe aus der HBMUtils.lib eine NumToStr Funktion, die eigentlich alle Voraussetzungen erfüllen sollte.
Gruss
Erik
NUMTOSTR.zip [779 Bytes]
Das gabs übrigens schon mal.
l viewtopic.php?p=662#662 l
Sorry, da fehlt noch eine weitere Funktion.
FLOOR_DINT.zip [452 Bytes]
warum nicht mit real_to_string() und rückwaärts mit string_to_real()
ist laut iec61131-3 als std lib vorgeschrieben
musst also gar nix programmieren.
wenn du den real vorher rundest dann kannst du auch die nachkommastellen beeinflussen