Programming the Main Type

Overview

The Main type is always managed by an HSCMain function block.

NOTE: At build time, a detected error code is given if the HSCMain function block is used to manage a different HSC type.

Adding the HSCMain Function Block

Step

Description

1

Select the Libraries tab in the Software Catalog and click Libraries.

Select Controller > M218 > M218 HSC > Counter > HSCMain in the list, drag-and-drop the item onto the POU window.

2

Type the Main type instance name (defined in configuration) or select the function block instance by clicking:

G-SE-0005277.1.gif-high.gif

Using the input assistant, the HSC instance can be selected at the following path: Global Variables > <MyController> > Embedded Functions > HSC.

G-SE-0008014.1.gif-high.gif

 

 

I/O Variables Usage

These tables describe how the different pins of the function block are used in the mode Event.

This table describes the input variables:

Input

Type

Description

EN_Enable

BOOL

Not used.

EN_Sync

BOOL

When SYNC input is configured: if TRUE, authorizes the counter synchronization and start via the Sync input.

EN_Cap

BOOL

Not used.

EN_Compare

BOOL

Not used.

EN_Out0

BOOL

Not used.

EN_Out1

BOOL

Not used.

F_Enable

BOOL

Forces the Enable condition. Takes priority over EN_Enable input.

F_Sync

BOOL

Forces the Sync condition

F_Out0

BOOL

Not used.

F_Out1

BOOL

Not used.

ACK_Modulo

BOOL

Not used.

ACK_Sync

BOOL

On rising edge, resets Sync_Flag.

ACK_Cap

BOOL

Not used.

SuspendCompare

BOOL

Not used.

NOTE: EN_Compare, EN_ReflexO, EN_Reflex1, F_Out0, F_Out1 remain operational while SuspendCompare is set.

This table describes the output variables:

Outputs

Type

Comment

HSC_REF

HSC_REF

Reference to the HSC.

To be used with the HSC_REF_IN input pin of the Administrative function blocks.

Error

BOOL

TRUE = indicates that an error was detected.

HSCGetDiag function block may be used to get more information about this detected error.

Validity

BOOL

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

CurrentValue

DINT

Current count value of the counter.

Run

BOOL

TRUE = Counter is running.

TH0

BOOL

Not used.

TH1

BOOL

Not used.

Modulo_Flag

BOOL

Not used.

Sync_Flag

BOOL

Set to 1 by the synchronization of the counter.

Cap_Flag

BOOL

Not used.

Reflex0

BOOL

Not used.

Reflex1

BOOL

Not used.

Out0

BOOL

Not used.

Out1

BOOL

Not used.