Jump to conversions: Konvertern
The following table summarizes the supported and unsupported data types:
data type | name | memory requirements | supported | value range | converters |
---|---|---|---|---|---|
binary numbers | |||||
BOOL | bool | 1bit (S7-1500 opt: 1 byte) | S7-300/400, S7-1200, S7-1500 | FALSE or TRUE BOOL#0 or BOOL#1 BOOL#FALSE or BOOL#TRUE | 16 BOOL → WORD and BYTE WORD → 16 BOOL BYTE → 8 BOOL |
BYTE | byte | 8 bit | S7-300/400, S7-1200, S7-1500 | 8 bit bit pattern, Dec: 0..255, Hex: 00..FF | 16 BOOL → WORD und BYTE BYTE → 8 BOOL DT → WORD/BYTE |
WORD | word | 16 bit | S7-300/400, S7-1200, S7-1500 | 16 bit bit pattern | 16 BOOL → WORD and BYTE WORD → 16 BOOL STRING → DB REGS DB REGS → STRING DT → WORD/BYTE WORD → REAL REAL → WORD |
DWORD | double word | 32 bit | S7-300/400, S7-1200, S7-1500 | 32 bit bit pattern | |
LWORD | long word | 64 bit | S7-1200, S7-1500 | 64 bit bit pattern | |
Integers
| |||||
SINT | short integer | 8 bit | S7-1200, S7-1500 | Dec: -128..127, Hex: 0..7F | |
INT | integer | 16 bit | S7-300/400, S7-1200, S7-1500 | Dec: -32768..32767, Hex: 0..7FFF |
|
DINT | double integer | 32 bit | S7-300/400, S7-1200, S7-1500 | Dec: -2147483648..+2147483647, Hex: 0..#7FFFFFFF |
|
USINT | unsigned short integer | 8 bit | S7-1200, S7-1500 | Dec: 0..255, Hex: 00..FF | |
UINT | unsigned integer | 16 bit | S7-1200, S7-1500 | Dec: 0..65535, Hex: 0000..FFFF | |
UDINT | unsigned double integer | 32 bit | S7-1200, S7-1500 | Dec: 0..4294967295, Hex: 00000000..FFFFFFFF |
|
LINT | long integer | 64 bit | S7-1500 | Dec: -9223372036854775808.. +9223372036854775807, Hex: 0000000000000000.. 7FFFFFFFFFFFFFFF |
|
ULINT | unsigned long integer | 64 bit | S7-1500 | Dec: 0..18446744073709551615, Hex: 0000000000000000.. FFFFFFFFFFFFFFFF |
|
floating point numbers
| |||||
REAL | real | 32 bit | S7-300/400, S7-1200, S7-1500 | -3.402823e+38..-1.175 495e-38 and +1.175 495e-38..+3.402823e+38 | WORD → REAL REAL → WORD |
LREAL | long real | 64 bit | S7-1200, S7-1500 | -1.7976931348623158e+308 ..-2.2250738585072014e-308 and +2.2250738585072014e-308 ..+1.7976931348623158e+308 |
|
S5 Time
| |||||
S5TIME | S5 time | 16 bit | S7-300/400, S7-1500 | S5T#0H_0M_0S_0MS.. S5T#2H_46M_30S_0MS |
|
S7 Time
| |||||
TIME | time | 32 bit | S7-300/400, S7-1200, S7-1500 | T#-24d20h31m23s648ms.. T#+24d20h31m23s647ms |
|
LTIME | long time | 64 bit | S7-1500 | LT#-106751d23h47m 16s854ms775us808ns.. LT#+106751d23h47m 16s854ms775us807ns |
|
Characters
| |||||
CHAR | character | 8 bit | S7-300/400, S7-1200, S7-1500 | ASCII character set | |
WCHAR | word char | 16 bit | S7-1200, S7-1500 | 16 bit Unicode | |
STRING | string | Long + 2 byte | S7-300/400, S7-1200, S7-1500 | 0 to 254 characters | STRING → DB REGS DB REGS → STRING STRING → REAL/LINT DT → STRING |
WSTRING | word string | Long + 2 word | S7-1200, S7-1500 | 0 to 16382 characters | |
Date types
| |||||
DATE | date | 16 bit | S7-300/400, S7-1200, S7-1500 | D#1990-01-01..D#2168-12-31 | |
TOD | time_of_day | 32 bit | S7-300/400, S7-1200, S7-1500 | TOD#00:00:00.000.. TOD#23:59:59.999 |
|
LTOD | long time_of_day | 64 bit | S7-1500 | LTOD#00:00:00.000000000 .. LTOD#23:59:59.999999999 |
|
DT | date_and_time | 64 bit | S7-300/400, S7-1500 | Min.: DT#1990-01-01-0:0:0 Max.: DT#2089-12-31-23:59:59.999 | DT → WORD/BYTE DT → STRING |
LDT | long date_and_time | 64 bit | S7-1500 | Min.: LDT#1970-01-01-0:0:0.000000000, 16#0 Max.: LDT#2262-04-11-23:47:16.854775807, 16#7FFF_FFFF_FFFF_FFFF |
|
DTL | date time long | 96 bit | S7-1200, S7-1500 | Min.: DTL#1970-01-01-00:00:00.0 Max.: DTL#2554-12-31-23:59:59.999999999 |
|
Pointer | |||||
POINTER | pointer | 48 bit | S7-300/400, S7-1500 | - | |
ANY | any type | 80 bit | S7-300/400, S7-1500 | - | |
VARIANT | variant | - | S7-1200, S7-1500 | example: P#M100.0 BYTE 10 P#DB1.DBX0.0 BYTE 10 |
What is not included in the table:
BCD numbers, BCD16 and BCD32. BCD numbers do not have their own data type. For a BCD number, use the data type WORD or DWORD and enter only the digits 0 to 9 and 0 or F for the sign in the format in hex W#16#xxxx or W#16#xxxx_xxxx. You can also use the notation c#0 through C#999 for a positive three-decade decimal number.
PLC data type (UDT), Anonymous structures (STRUCT), ARRAY, Parameter types (TIMER, COUNTER,..), System data types (IEC_TIMER, IEC_SCOUNTER,..)
The TIA Portal offers many conversions (and doesn't offer many more). These are summarized in the following table:
type | solution | conversions |
---|---|---|
Int | CONV | DInt, Real, Bcd16, USint, UInt, UDint, SInt, LReal und Char |
DInt | CONV | Int,Real, Bcd32, USint, UInt, UDint, SInt, LReal und Char |
Real | CONV | Int, DInt, USint, UInt, UDint, SInt und LReal |
USint | CONV | Int, DInt, Real, UInt, UDint, SInt, LReal und Char |
UInt | CONV | Int, DInt, Real, USint, UDint, SInt, LReal und Char |
UDint | CONV | Int, DInt, Real, USint, UInt, SInt, LReal und Char |
SInt | CONV | Int, DInt, Real, USint, UInt, UDint, LReal und Char |
LReal | CONV | Int, DInt, Real, USint, UInt, UDint, SInt |
Char | CONV | Int, DInt, USint, UInt, UDint, SInt und Char |
Bcd16 | CONV | Int |
Bcd32 | CONV | DInt |
Install converters in TIA Portal:
Converter_Name | Download | Description | Image_of_TIA |
---|---|---|---|
16 BOOL → WORD und BYTE | SCL Download | Convert up to 16 bits to word and bytes (HI and LO) device tested with TIA 15.1. For WORD to BYTE conversion use only the first eight bits and set the rest to (fix) 0. | |
WORD → 16 BOOL | SCL Download | Split word into 16 bits. Block tested with TIA 15.1. | |
BYTE → 8 BOOL | SCL Download | Split byte into 8 bits. Block tested with TIA 15.1. | |
STRING → DB REGS | SCL Download | The purpose of the program is to prepare the text (string) for Modbus communication. The string is written to the target DB character by character. Attention! The program does not contain internal DB check (is there DB or DB length). The PLC can stop due to bad parameterization! Block tested with TIA 15.1. Parameters: text: input (string) write_db_nr: Target DB number (DInt) write_db_offset: Offset in DB in bytes (DInt) fill_char : fill additional text area with this char (char) | |
DB REGS → STRING | SCL Download | The purpose of the program is to read the text (string) from the Modbus communication. The string is assembled from the Modbus registers. Attention! The program does not contain internal DB check (is there DB or DB length). The PLC can stop due to bad parameterization! Block tested with TIA 15.1. Parameters: read_db_nr: Source DB number (DInt) read_db_offset: Offset in DB in bytes (DInt) fill_char: empty (00) bytes replaced with this Char (Char) textOut: output (String) \\ | Reads 64 characters from register 32 (of DB6). |
REAL → WORD | SCL Download | Unscale Real to Word. Block tested with TIA 16. |
|
WORD → REAL | SCL Download | Scale Word to Real. Block tested with TIA 16. |
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