SYS1 Change high-speed counter operation mode

This changes the operation mode of the high-speed counter based on the contents specified by the character constant.

Keyword setting

HSCn,UP

HSCn

High-speed counter setting

n: 0–9, A, B (FP-X C14R, C30/60R)

n: 0–7 (FP-X C14T, C30/60T)

n: 0–3 (FPS)

UP

UP: addition input setting

DOWN: subtraction input setting

Example: HSC1,UP

Remarks

  • If the corresponding HSC system register is set to Unused, an operation error occurs. Set the system register to Incremental input or Decremental input in advance.

  • Executing this instruction does not rewrite the contents of the system ROM in the control unit. As a result, turning the power supply off and then on again rewrites the contents of the system registers specified by the software tool.

  • We recommend to execute this instruction only once, e.g. in dependency of a rising or falling edge of an execution condition.

  • When UP or DOWN has been specified, the contents of the system registers change in accordance with the specification, so a verification error may occur in some cases when checking or compiling the program. When BOTH have been specified, the contents of the system registers do not change. Separate the first and the second keyword with a comma "," e.g. HSCB,UP; do not use spaces. Otherwise an operation error will occur.

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • If something that is not identical with a keyword is specified

  • If there is no comma between the first and the second keyword

  • If the letters used to specify the keyword are not capitalized

  • If the HSC system register is set to items other than the addition input or subtraction input

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if any character other than a keyword is specified

  • If there is no comma between the first and the second keyword

  • If the letters used to specify the keyword are not capitalized

  • If the HSC system register is set to items other than the addition input or subtraction input

Example

POU header

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
		bCountUp: BOOL:=FALSE;
		bCountDown: BOOL:=FALSE;
	END_VAR

POU body

When bCountUp is set to TRUE, the function is carried out. The system register for the specified channel is set to count up. When bCountDown is set to TRUE, the specified channel is set to count down.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_F,E_SET_RTC_DT!,Instance,20,1,28,5,,?DEN?DIN?AENO);
B(B_VARIN,,DT_value,18,3,20,5,);
B(B_CONTACT,,bSetEdge,7,2,9,4,R);
B(B_COIL,,bEno,37,2,39,4,);
L(1,3,7,3);
L(9,3,20,3);
L(28,3,37,3);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

if DF(bCountUp) then
    SYS1('HSC0,UP');
    SYS1('HSCB,UP');
End_If;
IF DF(bCountDown) Then
    SYS1('HSC0,DOWN');
    SYS1('HSC7,DOWN');
End_If;

Modified on: 2024-03-08Feedback on this pagePanasonic hotline