Documentation

Time Conversion (B100)

Block name

B100_TIME_CONVERSION

ST call

PROGRAM B100_TEST
VAR
XSEC, XMIN, XHOUR: UDINT;
YSEC ,YMIN, YHOUR: UDINT;
FB: LIB.CORE.V1_0.B100_TIME_CONVERSION;
END_VAR

FB(SEC := XSEC MIN := XMIN, HOUR := XHOUR, YSEC => YSEC, YMIN => YMIN, YHOUR => YHOUR);
END_PROGRAM

Library

LIB\CORE

Version

V1.0

Description

The block is used for conversions of time and date values to the required formats.

Inputs

Input Type Description Default value
SEC UDINT any number of seconds 0
MIN UDINT any number of minutes 0
HOUR UDINT any number of hours 0
DAY UDINT any number of days 0
MON UDINT any number of months 0
YEAR UDINT any number of years 0

Outputs

Output Type Description
YSEC UDINT number of seconds
YMIN UDINT number of minutes
YHOUR UDINT number of hours
YDAY UDINT number of days
YMON UDINT number of months
YYEAR UDINT number of years

Function

The input signals may have any value greater or equal zero. The output returns date and time in the equivalent correct format. A month is considered to have 30 days. A year is considered to have 365,25 days.

Application example

The function adds inputs 85 s, 75 min and 5 hours. The result is a sensible value of 6 hours,16 mins and 25 s.