Check whether the TIME_OF_DAY is valid
IS_VALID_TOD_INT checks whether the combination of INT values for hour, minute, second, and millisecond is a valid time of day value. The Boolean output flag is set if the time of day value is valid.
Input
1st input: hour
2nd input: minute
3rd input: second
4th input: millisecond
Output
set to TRUE if the resulting time of day value is valid
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
HOUR_value: INT:=18;
MINUTE_value: INT:=29;
SECOND_value: INT:=59;
MILLISECOND_value: INT:=0;
VALID: BOOL:=FALSE;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 6 ;
NETWORK_BODY
B(B_VAROUT,,VALID,22,1,24,3,);
B(B_VARIN,,HOUR_value,10,1,12,3,);
B(B_VARIN,,MINUTE_value,10,2,12,4,);
B(B_VARIN,,SECOND_value,10,3,12,5,);
B(B_VARIN,,MILLISECOND_value,10,4,12,6,);
B(B_F,IS_VALID_TOD_INT!,Instanz,12,0,22,6,,?DHOUR?DMINUTE?DSECOND?DMILLISECOND?C);
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
END_BODY
VALID := IS_VALID_TOD_INT(HOUR := HOUR_value,
MINUTE := MINUTE_value,
SECOND := SECOND_value,
MILLISECOND := MILLISECOND_value);