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:
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.
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:
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!
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
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!
SCL-Programm download : str2dec.scl
Inside: str2dec FC and strDB DB.
From file (from 2020.10.30) downloads.
If you have any further questions or have any issues that you can't handle, please contact me! » Impressum
~~socialite~~
Themen:
- Simatic S7 SCL reference
- Simatic datatypes
- S7 error- and statuscodes
- TIA Portal know-how
Communication:
- S7-1500 - IntesisBox Modbus
- S7-1500 - Arduino Modbus
Diagnose:
- Scalance Modul diagnose
Partial solutions:
- INIT only one times w. delay
- DT to words and bytes
Conversions:
- Data types
- 16 BOOL → WORD/BYTE
- WORD → 16 BOOL
- BYTE → 8 BOOL
- STRING → DB REGS
- DB REGS → STRING
- REAL → WORD
- WORD → REAL
- DT → WORD/BYTE
- DT → STRING
- STRING → REAL/LINT