Set local time zone of NTP server
Setting a local time zone is only necessary for flexible time zones.
This FP instruction temporarily overwrites the time zone set by system register 530 FP_NTP_SYNCHRONIZE.
with a local time zone. This local time zone is used when the PLC time is set byInput
Specifies the time zone based on GMT (Greenwich Mean Time).
Syntax:+HHMM
/-HHMM
Values: format: sign (+/-) and HHMM (HH=hours (00–23), MM=minutes (00–59))
Examples:
For France, Italy, Spain, Germany: '+0100'
For Japan: '+0900'
For Hawaii: '-1000'
Output
Set to TRUE when the operation ends abnormally without execution, e.g. when sys_bIsEthernetInitializing is TRUE
When an error occurs, check the system variable sys_iEthernetConnectionErrorCode for the error code number.
This instruction is not available in interrupt programs.
This instruction does not delete or permanently overwrite the time zone set in system register 530, but replaces it temporarily by the value specified by sTimeZone.
The PLC returns to the settings from the system registers in the following cases:
The power is turned off.
You switch from [PROG mode] to [RUN mode].
You switch to a different project.
The setting data will not be lost even if the instruction FP_IPV4_SET_ADDRESS is executed.
Before you execute the instruction, make sure that sys_bIsEthernetInitializing is FALSE. sys_bIsEthernetInitializing turns to TRUE when the instruction is executed. When you execute the instruction while sys_bIsEthernetInitializing is TRUE, an error occurs.
When this instruction has been executed successfully, the system variables sys_bIsCarry and sys_iEthernetConnectionErrorCode are reset.
When an error occurs, check the system variable sys_iEthernetConnectionErrorCode for the error code number.
if a value specified for a parameter is outside the permissible range.
if the instruction is executed in an interrupt program
if the system is synchronizing the time with the NTP server.
if a value specified for a parameter is outside the permissible range.
if the instruction is executed in an interrupt program
if the system is synchronizing the time with the NTP server.
if the instruction is executed during the initialization of Ethernet, sys_iEthernetConnectionErrorCode is set to "11: Ethernet is being initialized".
이 펑션 프로그램 시 사용한 모든 입력과 출력 변수는 POU 헤더에서 선언되었습니다.모든 프로그래밍 언어에 같은 POU 헤더를 사용합니다.
VAR
sTimeZone: STRING[32]:='+0100';
bIsError: BOOL:=FALSE;
bEnable: BOOL:=FALSE;
END_VAR
시스템 변수 sys_bIsEthernetInitializing이 FALSE이고 변수 bEnable가 FALSE에서 TRUE로 설정되면 펑션이 실행됩니다.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 7 ;
NETWORK_BODY
B(B_CONTACT,,sys_bIsEthernetInitializing,6,4,8,6,N);
B(B_CONTACT,,bEnable,14,4,16,6,R);
B(B_F,FP_NTP_SET_TIME_ZONE!,,18,3,31,7,,?DEN?DsTimeZone?AENO?AbError);
B(B_VARIN,,sTimeZone,16,5,18,7,);
B(B_VAROUT,,bIsError,31,5,33,7,);
L(1,0,1,7);
L(1,5,6,5);
L(8,5,14,5);
L(16,5,18,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if (NOT (sys_bIsEthernetInitializing) AND DF(bEnable)) then
FP_NTP_SET_TIME_ZONE(sTimeZone := sTimeZone,
bError => bIsError);
end_if;