FB_Counter: Counter

Overview

The function block FB_Counter provides up and down counting of events.

The following graphic shows the pin diagram of the function block FB_Counter:

G-SE-0033404.1.jpg

 

 

I/O Variables Description

The TwidoEmulationSupport library provides a function block FB_Counter which calls the function block CTUD. The standard CTUD behavior is extended by a preset value handling and Twido-compliant overflow behavior.

For more information on counters refer to the CoDeSys online help in EcoStruxure Machine Expert Standard Library / Counter.

The table describes the input variables of the function block in the TwidoEmulationSupport library:

Input

Data Type

Description

i_xLoad

BOOL

Sets the current value to the preset value.

i_xReset

BOOL

Resets the input.

i_xCountUp

BOOL

Counts up the input.

i_xCountDown

BOOL

Counts down the input.

i_iPreset

INT

Preset value

Default: 32767

i_etMaxVal

ET_TimerCounterMaxVal

Counter and preset maximum value

The table describes the output variables of the function block in the TwidoEmulationSupport library:

Output

Data Type

Description

q_xUnderflow

BOOL

Counts down underflow / empty

q_xDone

BOOL

q_iCounterValue = i_iPreset / preset reached / done

q_iCounterValue

INT

Current value (0..32767)

q_xOverflow

BOOL

Up-count overflow full