de:project_s7:str2dec

No renderer 'pdf' found for mode 'pdf'

Convert String to LInt and Real

english The program converts the fraction that first occurs in the (TIA-Portal) String chain to LInt and REAL numbers. The number and decimal part can be up to 19 digits. In the case of a negative number, the REAL value will also be negative, but in the case of LINT, the program will only indicate that the value is negative. There can be no space between the negative sign and the number. The number can be preceded or followed by any size text (max 253 char). The decimal position must be indicated by a dot (for example, 12.3).

install code:

  1. download str2dec.scl (text format)
  2. file import in TIA Portal: (new data instert) by externe sources
  3. create block from source
  4. check the numer of db strDB [DBxx]
  5. instert db number (xx) to call dbNr, example 12.
  6. call fc str2dec from software, to example, from main
  7. use values from strDB

Parameters of the str2dec function:

inStr (String): input String, must contain the number looking for (max. 253 characters)
dbNr: input, enter the number of strDB after compilation, for example for strDB [DB2]: 2.
error: output until the DB number isn't good, TRUE.

Values of strDB (outputs):

str (String): the input string (copy from str2dec))
strLenght (Int): the total length of the string
firstNumberPos (Int): the position of the first number in the string
wholepos (Int): the number of integer-positions
fractionpos (Int): the number of fraction-positions
realOut (Real): the REAL output (with sign)
negativeVal (Bool): the sign is negative (true)
intWhole (LInt): LINT whole without sign
intFrac (LInt): LINT fraction without sign

Important! The strDB DB cannot be an optimized DB because it cannot be used with direct addressing! You can check this here:

strDB - right klick - properties… - General - Attributes - optimize block access

This feature cannot be enabled.

deutsch Das Programm konvertiert den Bruchzahl, der zuerst in der (TIA-Portal) String-Kette auftritt, in LInt- und Real-Typ. Die Zahl und der Dezimalteil können bis zu 19 Stellen betragen. Im Falle einer negativen Zahl ist der REAL-Wert ebenfalls negativ, im Fall von LINT zeigt das Programm jedoch nur an, dass der Wert negativ ist. Zwischen dem negativen Vorzeichen und der Zahl darf kein Leerzeichen stehen. Der Nummer kann ein beliebiger Text vorangestellt oder gefolgt werden (max. 253 Zeichen). Die Dezimalstelle muss durch einen Punkt angegeben werden (z. B. 12.3).

Installations:

  1. str2dec.scl runterladen (text format)
  2. Dateiinport in TIA Portal: (neues Daten einfügen) über externen Quellen
  3. Bausteine aus Quelle erstellen
  4. Überprüfen Sie die Nummer von DB strDb [DBxx]
  5. Geben Sie die DB-Nummer (xx) ein, um dbNr aufzurufen, Beispiel 12
  6. Rufen Sie FC str2dec von der Software auf, zum Beispiel von main
  7. Verwenden Sie Werte aus strDb

Parameter der Funktion str2dec :

inStr (String): Dieses String muss die gesuchte Nummer enthalten (max. 253 Zeichen)
dbNr: Eingabe, geben Sie die Anzahl der strDB nach der Kompilierung ein, z. B. für strDB [DB2]: 2.
error: Ausgabe bis die DB-Nummer NiO, TRUE.

Werte von strDB (Ausgänge):

str (String): die Eingabe-String (Kopie von str2dec)
strLenght (Int): die Gesamtlänge der Zeichenfolge
firstNumberPos (Int): die Position der ersten Zahl in der Zeichenfolge
wholepos (Int): die Anzahl der ganzen Zahlen
fractionpos (Int): die Anzahl der Bruhzahlen
realOut (Real): der REAL-Ausgang (mit Vorzeichen)
negativeVal (Bool): das Vorzeichen ist negativ (true)
intWhole (LInt): LINT Ganzzahl-Teil ohne Vorzeichen
intFrac (LInt): LINT Bruchzahl-Teil ohne Vorzeichen

Wichtig! Die strDB DB kann keine optimierte DB sein, da ist nicht mit direkter Adressierung verwendet werden kann!

magyar A program a (TIA-Portál) String-láncban először előforduló törtszámot alakítja át LInt és Real típusú számokká. A szám és a tizedesrész maximum 19 jegyű lehet. Negatív szám esetén a REAL érték is negatív lesz, az LINT-nél viszont csak jelzi a program, hogy az érték negatív. A negatív jel és a szám között nem lehet space. A szám előtt és után akármekkora szöveg is szerepelhet (max 253 char). A tizedespozícót pont (például 12.3) kell, hogy jelölje.

telepítés

  1. töltse le az str2dec.scl fájlt (text format)
  2. file import a TIA Portálban: externe sources
  3. generálja le a forráskódot
  4. másolja ki a generált DB strDB [DBxx] számát
  5. illessze be a DB számát (xx) a dbNr-hez
  6. hívja fel az str2dec FC-t a programból, például a main-ből
  7. használhatja az strDB értékeket

Az str2dec funkció paraméterei:

inStr (String): bementi String, ebben kell lennie a keresett számnak (max. 253 karakter)
dbNr: bemenet, ide kell megadni az strDB számát a lefordítás után, például strDB [DB2] esetén: 2.
error: kimenet, amíg a DB szám nem jó, addig: TRUE.

Az strDB DB értékei (kimeneti értékek):

str (String): a bemeneti string (másolat az str2dec felől)
strLenght (Int): a string teljes hossza
firstNumberPos (Int): az első szám pozíciója a stringben
wholepos (Int): az egészértékek száma
fractionpos (Int): a törtértékek száma
realOut (Real): a real kimenet (előjellel)
negativeVal (Bool): az előjel negatív (true)
intWhole (LInt): LINT egészrész előjel nélkül
intFrac (LInt): LINT törtrész előjel nélkül

Fontos! Az strDB DB nem lehet optimalizált DB, mert így nem használható direkt címzéssel!

Enter dbNr (click to pic)1st example: Temperature (click to pic)2nd example: big value (click to pic)

SCL-Programm download : str2dec.scl

Inside: str2dec FC and strDB DB.

From file (from 2020.10.30) downloads.

Donate

If you have any further questions or have any issues that you can't handle, please contact me! » Impressum

~~socialite~~

2022/04/21 15:01
  • de/project_s7/str2dec.txt
  • 2022/04/21 15:01
  • ()