de:project_s7:str2dec

Differences

This shows you the differences between two versions of the page.

de:project_s7:str2dec [2020/10/30 22:02]
de:project_s7:str2dec [2022/04/21 15:01] ()
 1:  1:
 +====== Convert String to LInt and Real ======
 +{{:de:project_s7:uk.png?16|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:** \\
 +  - download str2dec.scl (text format)
 +  - file import in TIA Portal: (new data instert) by "externe sources" 
 +  - create block from source
 +  - check the numer of db "strDB" [DBxx]
 +  - instert db number (xx) to call "dbNr", example 12.
 +  - call fc "str2dec" from software, to example, from "main"
 +  - 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. \\ 
 +
 +{{:de:project_s7:de.png?16|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:** \\
 +  - str2dec.scl runterladen (text format)
 +  - Dateiinport in TIA Portal: (neues Daten einfügen) über "externen Quellen"
 +  - Bausteine aus Quelle erstellen
 +  - Überprüfen Sie die Nummer von DB "strDb" [DBxx]
 +  - Geben Sie die DB-Nummer (xx) ein, um "dbNr" aufzurufen, Beispiel 12
 +  - Rufen Sie FC "str2dec" von der Software auf, zum Beispiel von "main"
 +  - 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!
 +
 +{{:de:project_s7:hu.png?16|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** \\
 +  - töltse le az str2dec.scl fájlt (text format)
 +  - file import a TIA Portálban: "externe sources"
 +  - generálja le a forráskódot
 +  - másolja ki a generált DB "strDB" [DBxx] számát
 +  - illessze be a DB számát (xx) a "dbNr"-hez
 +  - hívja fel az "str2dec" FC-t a programból, például a "main"-ből
 +  - 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!
 +
 +===== TIA-Portal =====
 +|{{ :de:project_s7:str2dec_1.png?300 |}}|{{ :de:project_s7:str2dec_2.png?300 |}}|{{ :de:project_s7:str2dec_3.png?300 |}}|
 +|Enter dbNr (click to pic)|1st example: Temperature (click to pic)|2nd example: big value (click to pic)|
 +===== Download =====
 +
 +<WRAP center round download 80%>
 +**SCL-Programm download : **  {{ :de:project_s7:str2dec.scl |str2dec.scl}} \\  \\  
 +Inside: **"str2dec"** FC and **"strDB"** DB.
 +</WRAP>
 +
 +From file (from 2020.10.30) **{{dlcounter>file?de:project_s7:str2dec.scl}}** downloads.
 +
 +{{page>de:project_s7:foot}}