F167_HighSpeedCounter_Reset

Target value match OFF (high-speed counter)

If the elapsed value of the high-speed counter matches the target value, an interrupt process immediately turns the specified output to FALSE.

Parameters

Input

n_diHscChannel (DINT)

High-speed counter channel:

FP-S: 0–3

FP-X R: 0–11

FP-X T: 0–7

FP0: 0–3

F168_PulseOutput_Trapezoidal: 0–3

F171_PulseOutput_Trapezoidal: 0–5

s_diTargetValue (DINT)

specify a 32-bit data value for the target value within the following range:

FP0, F168_PulseOutput_Trapezoidal: -838808–+8388607

FPS, FP-X, F171_PulseOutput_Trapezoidal: -2147483467–+2147483648

Output

d_Y (BOOL)

output which turns to FALSE when the elapsed value matches the target value:

FP-S, FP0, F168_PulseOutput_Trapezoidal: Y0–Y7

FP-S (V3.1 or higher), F171_PulseOutput_Trapezoidal: Y0–Y1F

FP-X: Y0–Y29F

Remarks

Characteristics of target value match OFF control

  • -200 Target value
  1.  (1) Elapsed value of high-speed counter
  2.  (2) Execution condition
  3.  (3) High-speed counter control flag
  4.  (4) PLC output
  • The PLC output turns to FALSE when the elapsed value matches the target value. In addition, the high-speed counter control flag turns to FALSE and the instruction is deactivated.

  • If an output is specified that has not been implemented, only the internal memory of the corresponding WY address is set or reset.

Interrupt operation

The interrupt program will be executed when the elapsed value matches the target value. Any interrupt that has been entered into the Tasks list is automatically enabled.A special interrupt program number is assigned to each channel number.

Channels used by interrupt programs:

PLC type

FP0, FP-e

FPS, FP0H

FP-X (Relay types), FP-XH

FP-X (Transistor types)

FP0R

Interrupt0

Channel0

Channel0

Channel0

Channel0

Channel0

Interrupt1

Channel1

Channel1

Channel1

Channel1

Channel1

Interrupt2

Channel2

Channel2

Interrupt3

Channel2

Channel2

Channel3

Channel3

Channel2

Interrupt4

Channel3

Channel3

Channel4

Channel4

Channel3

Interrupt5

Channel5

Channel5

Interrupt6

Channel6

Channel6

Channel4

Interrupt7

Channel7

Channel7

Channel5

Interrupt8

Channel8

Interrupt9

Channel9

Interrupt10

Interrupt11

ChannelA

Interrupt12

ChannelB

General programming information

  • Select the high-speed counter input for the desired channel in the system registers.

  • FP-X, FP0R: When a high-speed counter instruction is executed, the high-speed counter control flag (e.g. sys_bIsHscChannel0ControlActive) for the channel used turns to TRUE. No other high-speed counter instruction using the same channel can be executed as long as the control flag is TRUE.

  • FP0, FP-e, FPS: The high-speed counter control flag (e.g. sys_bIsHscChannel0ControlActive) and the pulse output control flag (e.g. sys_bIsPulseChannel0Active) are assigned to the same special internal flag number (e.g. R903A). Therefore, when a high-speed counter instruction or a pulse output instruction is executed, both the high-speed counter control flag (e.g. sys_bIsHscChannel0ControlActive) and the pulse output control flag (e.g. sys_bIsPulseChannel0Active) for the channel used are TRUE. No other high-speed counter instruction or pulse output instruction can be executed as long as this flag is TRUE.

  • If both the main program and the interrupt program contain code for the same channel, make sure both are not executed simultaneously.

  • To set a PLC output to FALSE that was previously set to TRUE by this instruction, use an RST or MOVE instruction.

  • To cancel execution of an instruction, set bit 3 of the data register storing the high-speed counter control code (sys_wHscOrPulseControlCode) to TRUE. The high-speed counter control flag then changes to FALSE. To re-enable execution of the high-speed counter instruction, reset bit 3 to FALSE.

  • The status of the high-speed counter control flag or pulse output control flag may change while a scan is being carried out. For example, if the number of received bytes is read more than once different statuses may exist within one scan.

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if channel number or values of the data table are outside the permissible range
  • if high-speed counter has not been set in the system registers
sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if channel number or values of the data table are outside the permissible range
  • if high-speed counter has not been set in the system registers

Example

Global variables

In the global variable list you define variables that can be accessed by all POUs in the project.

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_EXTERNAL
		out_0: BOOL:=FALSE;
			(*output Y0 of PLC*)
	END_VAR
	VAR 
		start: BOOL:=FALSE;
			(*start condition*)
	END_VAR

POU body

When the variable start is set to TRUE, the function is carried out.

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_VARIN,,0,10,2,12,4,);
B(B_VARIN,,-200,10,3,12,5,);
B(B_CONTACT,,start,5,1,7,3,R);
B(B_VAROUT,,out_0,27,2,29,4,);
B(B_F,F167_HighSpeedCounter_Reset!,Instance,12,0,27,5,,?DEN?Hn_diHscChannel?Ds_diTargetValue?AENO?Cd_Y);
L(1,2,5,2);
L(7,2,12,2);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

LD body

ST body

IF DF(start) then
    F167_HighSpeedCounter_Reset(n_diHscChannel := 0, 
              s_diTargetValue := -200, 
              d_Y => out_0);
END_IF;
NOTE

Assign a number to the input variable (e.g. “Monitor” > “Monitor header”, click the variable, enter the value, press <Enter>), or replace the input variables with numbers.

Modified on: 2022-03-02Feedback on this pagePanasonic hotline