FP_NTP_SET_TIME_ZONE

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 [Ethernet] > [Time synchronization] with a local time zone. This local time zone is used when the PLC time is set by FP_NTP_SYNCHRONIZE.

Parameters

Input

sTimeZone (STRING)

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:

  1. For France, Italy, Spain, Germany: '+0100'

  2. For Japan: '+0900'

  3. For Hawaii: '-1000'

Output

bError (BOOL)

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.

Remarks

  • 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.

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • 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.

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • 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.

sys_bIsCarry (turns to TRUE for one scan)

if the instruction is executed during the initialization of Ethernet, sys_iEthernetConnectionErrorCode is set to "11: Ethernet is being initialized".

POU 헤더

이 펑션 프로그램 시 사용한 모든 입력과 출력 변수는 POU 헤더에서 선언되었습니다.모든 프로그래밍 언어에 같은 POU 헤더를 사용합니다.

	VAR
		sTimeZone: STRING[32]:='+0100';
		bIsError: BOOL:=FALSE;
		bEnable: BOOL:=FALSE;
			END_VAR

LD 본문

시스템 변수 sys_bIsEthernetInitializingFALSE이고 변수 bEnableFALSE에서 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

ST 본문

if (NOT (sys_bIsEthernetInitializing) AND DF(bEnable)) then
    FP_NTP_SET_TIME_ZONE(sTimeZone := sTimeZone,
    bError => bIsError);
end_if;

최종 수정일: 2024-03-11이 페이지에 대한 피드백Panasonic 직통 전화