STEP 7 PLC programming : DATA types used in Siemens PLC

Introduction to Data Types and Parameter Types All the data in a user program must be identified by a data type. The following data types are available: • Elementary data types provided by STEP 7 • Complex data types that you yourself can create by combining elementary data types • Parameter types with which you define parameters to be transferred to FBs or FCs General Information Statement List, Ladder Logic, and Function Block Diagram instructions work with data objects of specific sizes. Bit logic instructions work with bits, for example. Load and transfer instructions (STL) and move instructions (LAD and FBD) work with bytes, words, and double words. A bit is a binary digit “0” or “1.” A byte is made up of eight bits, a word of 16 bits, and a double word of 32 bits. Math instructions also work with bytes, words, or double words. In these byte, word, or double word addresses you can code numbers of various formats such as integers and floating-point numbers. When you use symbolic addressing, you define symbols and specify a data type for these symbols (see table below). Different data types have different format options and number notations. This chapter describes only some of the ways of writing numbers and constants. The following table lists the formats of numbers and constants that will not be explained in detail. Format Size in Bits Number Notation

Hexadecimal 8, 16, and 32 B#16#, W#16#, and DW#16#

Binary 8, 16, and 32 2#

date 16 D#

time 32 T#

Time of day 32 TOD#

Character 8 ‘A’


If im interested to unpack the TOD data type into separate variables with the Year,Month,Day, etc… how could i do it? or how does the bits represent this data?

Thank in advance, Greg_E.

[code] L L#16 //uhr L L#60 *D L L#60 *D L L#1000 *D T #hd1

L L#45 //minuten L L#60 *D L L#1000 *D L #hd1 +D T MD 504[/code]