Programming the Simple Type

Overview

A Simple type counter is always managed by an HSCSimple_M241 function block.

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

Adding an HSCSimple Function Block

Step

Description

1

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

Select Controller > M241 > M241 HSC > HSC > HSCSimple_M241 in the list, drag-and-drop the item onto the POU window.

2

Type the Simple 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: <MyController> > Counters.

G-SE-0030638.1.gif-high.gif

 

 

I/O Variables Usage

The tables below describe how the different pins of the function block are used in One-shot mode.

This table describes the input variables:

Input

Type

Comment

Sync

BOOL

On rising edge, presets and starts the counter

ACK_Modulo

BOOL

Not used in one-shot mode.

This table describes the output variables:

Output

Type

Comment

HSC_REF

EXPERT_REF

Reference to the HSC.

To be used as input of Administrative function blocks.

HSC_Err

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 the output values on the function block are valid.

Run

BOOL

Set to 1 when the counter is running.

Switches to 0 when CurrentValue reaches 0. A synchronization is needed to restart the counter.

Modulo_Flag

BOOL

Not used in one-shot mode.

CurrentValue

DWORD

Current count value of the counter.