HSCMain: HSC Main Function Block

Function Block Description

This function block controls a Main type counter with the following functions:

oup/down counting

ofrequency meter

othresholds

oevents

operiod meter

odual phase

The HSC Main function block is mandatory when using Main counter.

The function block instance name must match the name defined by configuration. Hardware related information managed by this function block is synchronized with the MAST task cycle.

Warning_Color.gifWARNING

UNINTENDED OUTPUT VALUES

oOnly use the Function Block instance in the MAST task.

oDo not use the same Function Block instance in a different task.

Failure to follow these instructions can result in death, serious injury, or equipment damage.

NOTE: Forcing the logical output values of the FB is allowed by EcoStruxure Machine Expert but it will have no impact on hardware related outputs if the function is active (executing).

Graphical Representation

G-SE-0003850.1.gif-high.gif

 

 

IL and ST Representation

To see the general representation in IL or ST language, refer to Function and Function Block Representation.

I/O Variables Description

This table describes the input variables:

Input

Type

Description

EN_Enable

BOOL

TRUE = authorizes enabling of the counter using the Enable input.

EN_Preset

BOOL

TRUE = authorizes counter synchronization and start using the Sync input.

EN_Cap

BOOL

TRUE = enables the Capture input (if configured in One shot, Modulo loop, Free large modes).

EN_Compare

BOOL

TRUE = enables the comparator operation (using Thresholds 0, 1, 2, 3):

obasic comparison (TH0, TH1, TH2, TH3 output bits)

oreflex (Reflex0, Reflex1 output bits)

oevents (to trigger external tasks on threshold crossing)

EN_Out0

BOOL

TRUE = enables Output0 to echo the Reflex0 value (if configured in One shot, Modulo loop, Free large modes).

EN_Out1

BOOL

TRUE = enables Output1 to echo the Reflex1 value (if configured in One shot, Modulo loop, Free large modes).

F_Enable

BOOL

TRUE = activates counter and takes into account pulses on the counter input.

F_Preset

BOOL

On rising edge, authorizes counting function synchronization and start in the following counting modes:

One-shot counter: to preset and start the counter

Modulo loop counter: to reset and start the counter

Free large counter: to preset and start the counter

Event counter: to restart the internal time base at the beginning

Frequency meter: to restart the internal timer relative to the time base.

F_Out0

BOOL

TRUE = forces Output0 to 1 (if configured in One-shot, Modulo loop, Free large modes).

F_Out1

BOOL

TRUE = forces Output1 to TRUE (if configured in One-shot, Modulo loop, Free large modes).

ACK_Modulo

BOOL

On rising edge, resets Modulo_Flag (Modulo loop and Free large modes).

ACK_Preset

BOOL

On rising edge, resets Preset_Flag.

ACK_Cap

BOOL

On rising edge, resets the Cap_Flag (One-shot, Modulo loop, Free large modes).

SuspendCompare

BOOL

TRUE = compare results are suspended:

oTH0, TH1, TH2, TH3 , Reflex0, Reflex1, Out0, Out1 output bits of the block maintain their last value.

oPhysical Outputs Output0 and Output1 maintain their last value.

oCompare events are masked.

NOTE: EN_Compare, EN_Out0,EN_Out1,F_Out0,F_Out1 remain operational while SuspendCompare is set.

This table describes the output variables:

Outputs

Type

Comment

HSC_REF

EXPERT_REF

Reference to the HSC.

Error

BOOL

TRUE = indicates that an error was detected.

Use the EXPERTGetDiag function block to get more information about this detected error.

Validity

BOOL

TRUE = indicates that output values on the function block are valid.

In the Period Meter Type, if the time-out value is exceeded, Validity = FALSE.

Run

BOOL

TRUE = counter is running.

In One-shot mode, the Run bit switches to 0 when CurrentValue reaches 0.

TH0

BOOL

TRUE = current counter value > Threshold 0 (if configured in One shot, Modulo loop, Free large modes).

Only active when EN_Compare is set.

TH1

BOOL

TRUE = current counter value > Threshold 1 (if configured in One shot, Modulo loop, Free large modes).

Only active when EN_Compare is set.

TH2

BOOL

TRUE = current counter value > Threshold 2 (if configured in One-shot, Modulo loop, Free large modes).

Only active when EN_Compare is set.

TH3

BOOL

TRUE = current counter value > Threshold 3 (if configured in One-shot, Modulo loop, Free large modes).

Only active when EN_Compare is set.

Modulo_Flag

BOOL

Set to TRUE when the counter rolls over its limits in the following modes:

oModulo loop counter: when the counter rolls over to the modulo or 0

oFree large counter: when the counter roll overs its limits

Preset_Flag

BOOL

Set to TRUE by the synchronization of:

oOne-shot counter: when the counter presets and starts

oModulo loop counter: when the counter resets

oFree large counter: when the counter presets

oEvent counter: when the internal timer relative to the time base restarts

oFrequency meter: when the internal timer relative to the time base restarts

Cap_Flag

BOOL

TRUE = indicates that a value has been latched in the capture register.

This flag must be reset before a new capture can occur.

Reflex0

BOOL

State of Reflex0 (if configured in One shot, Modulo loop, Free large modes).

Only active when EN_Compare is set.

Reflex1

BOOL

State of Reflex1 (if configured in One shot, Modulo loop, Free large modes).

Only active when EN_Compare is set.

Out0

BOOL

Indicates the state of Output0.

Out1

BOOL

Indicates the state of Output1.

CurrentValue

DINT

The value of the counter.