Introduction

NOTE

The high-speed counter and pulse output instructions can be used with the following FP Series PLCs: FP0, FP-e, FPS, FP-X, FP0R.

Introduction

Control FPWIN Pro offers two concepts for programming with high-speed counter instructions:

The tool instructions are universal instructions which are supported by all PLC types of the FP series. They offer new and comfortable features including information functions for evaluating status flags and settings, control functions for configuring high-speed counters and pulse outputs, PLC-independent functions and DUTs, as well as variable channel numbers.

When should you use tool instructions instead of F instructions?

However, the F instructions may be easier to use for beginners or users familiar with FPWIN GR.

Most of the information, which is accessible via information and control functions, is stored in special internal flags and special data registers. These flags and registers can also be accessed using PLC-independent system variables.

To take advantage of the features you prefer, the instructions of both libraries can be mixed.

NOTE

When programming with the tool instructions, be sure to refer to the detailed information provided via the links to the related F instructions.

Main features

F instructions Tool instructions

Pre version 6.4 support

l

Use of inline functions

l

Use of FPWIN GR function names

l

Less code with constant channel numbers

l

Control codes

l

Control functions

l

Information functions

l

Variable channel numbers

l

Universal functions for all PLCs

l

For use in universal user function blocks

l

Common channel configuration DUT for all PLCs and all pulse output instructions

l

Comparison between programming with F instructions and Tool instructions

F instructions Tool instructions

(1)

Supports only constant channel numbers, in this example channel 2.

(1)

Supports variable channel numbers, in this example channel 2.

(2)

Outputs with explicit user addresses in the Y area

(2)

Access to outputs with explicit user addresses via a pointer variable. This pointer variable can also be applied via inputs of user-defined function blocks.

(3)

System variables are used to read special data registers for channel 2.

(3)

The name of the output variable g_bHsc_TargetValueMatch_Channel2_ YA_MotorOff must follow a certain pattern, please refer to Hsc_TargetValueMatch_Set.

(4)

PLC-specific control code settings are required, e.g. for clearing a high-speed counter instruction

Conclusion:

  • Depends on PLC type

  • Constant channel number

  • High maintenance effort, e.g. to change the channel number

Conclusion:

  • Independent of PLC type

  • Variable channel number

  • Self-explanatory function block names and variables

  • Can be called by user-defined function blocks with variable channel numbers

  • Channel number easy to change

  • Requires more programming steps

Typical applications

Use the high-speed counter instructions to count input pulses from sensors or encoders, and to turn outputs to TRUE or FALSE once a specified target value has been reached.

When used with a motor driver, the pulse output instructions enable typical positioning operations such as trapezoidal control, home return, and JOG operation.

Specifications

The number of channels for the built-in high-speed counter and for pulse output, the counting range, the input and output numbers, as well as performance specifications differ depending on the PLC type. For details, please refer to the corresponding hardware manual.

Required system register settings

When using a high-speed counter instruction: Select the high-speed counter input for the desired channel in the system registers.

Counter input modes

To specify the counter input mode, select the high-speed counter inputs in the system registers.

  1.  (1) High-speed counter input
  2.  (2) Counter value
  3.  (3) Reset input

Input mode

Input signals

Incremental

Decremental

Two-phase

Incremental counting

Decremental counting

Incremental/decremental

(a)

Increasing

(b)

Decreasing

Incremental/decremental control

(a)

Increasing

(b)

Decreasing

Count for reset (incremental)

(a)

Rising edge: count disabled, elapsed value cleared

(b)

Falling edge: count enabled

(c)

Count prohibited

The reset at (3) is executed by the interruption at (a) (rising edge) and (b) (falling edge).The reset input can be enabled/disabled using bit 2 of sys_wHscOrPulseControlCode.

Writing control codes

Control codes are used to perform special counter operations.

Writing and reading the elapsed value

The elapsed value is stored as a double word in the special data registers.

Control flags

The high-speed counter and pulse output status is stored in special internal flags. To access the special internal flags, use the PLC-independent system variables.

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.

When a pulse output instruction is executed and pulses are being output, the pulse output control flag (e.g. sys_bIsPulseChannel0Active) of the corresponding channel is TRUE. No other pulse output instruction can be executed as long as this flag is TRUE.

System variables

To access special data registers and special internal flags, use the PLC-independent system variables.

Related topics:

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