SPLIT_DT block
Short summary
Name |
SPLIT_DT |
→POU type |
|
Category |
|
Conform to →IEC-standard |
no restrictions |
Graphical interface |
|
Available since |
version 1.27.0 (for logi.CAD 3) |
Functionality
The block splits a date and time of day (DATE_AND_TIME) entered at input IN. The outputs return the split values.
Inputs, outputs
|
Identifier |
Description |
|
Inputs: |
IN |
DATE_AND_TIME |
date and time of day |
Outputs: |
YEAR |
UINT |
year |
MONTH |
USINT |
month (1-12) |
|
DAY |
USINT |
day (1-31) |
|
HOUR |
USINT |
hours (0-23) |
|
MINUTE |
USINT |
minutes (0-59) |
|
SECOND |
USINT |
seconds (0-59) |
|
MILLISECOND |
UINT |
milliseconds (0-999) |
Input EN and output ENO are available when →calling
the block. See "Execution control: EN, ENO" for information on input EN and output ENO.
Internal error diagnostic for block
The block checks the value connected to the inpu
t
before it is executed.
If the value is
> DT#2106-02-07-06:28:14.999
, the output ENO of the block is set to value FALSE (or an equivalent).
Example for usage within ST-editor
PROGRAM Test
VAR
resA1, resA7, resB1, resB7 : UINT;
resA2, resA3, resA4, resA5, resA6, resB2, resB3, resB4, resB5, resB6 : USINT;
CheckENOA, CheckENOB : BOOL;
END_VAR
SPLIT_DT(IN := DT#
2015
-
01
-
06
-
23
:
59
:
59.995
, YEAR => resA1, MONTH => resA2, DAY => resA3, HOUR => resA4, MINUTE => resA5, SECOND => resA6, MILLISECOND => resA7, ENO => CheckENOA);
(* The variable
'resA1'
evaluates to
'2015'
(the year),
'resA2'
to
'1'
(the month),
'resA3'
to
'6'
(the day). *)
(* The variable
'resA4'
evaluates to
'23'
(the hour),
'resA5'
and
'resA6'
to
'59'
(the minutes and seconds),
'resA7'
to
'995'
(the milliseconds). *)
(* The variable
'CheckENOA'
evaluates to
'TRUE'
. *)
SPLIT_DT(IN := DT#
2120
-
12
-
10
-
15
:
32
:
01.100
, YEAR => resB1, MONTH => resB2, DAY => resB3, HOUR => resB4, MINUTE => resB5, SECOND => resB6, MILLISECOND => resB7, ENO => CheckENOB);
(* The variable
'CheckENOB'
evaluates to
'FALSE'
. Reason:
'DT#2120-12-10-15:32:01.100'
is not within the valid range. *)
END_PROGRAM
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.