Programming the Simple Type

Overview

A Simple type is always managed by an HSCSimple function block.

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

Adding a HSCSimple Function Block

Step

Description

1

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

Select Controller > M218 > M218 HSC > Counter > HSCSimple 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: Global Variables > <MyController> > Embedded Functions > HSC.

G-SE-0006153.1.gif-high.gif

 

 

G-SE-0074953.1.gif

 

 

I/O Variables Usage

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

This table describes the input variables:

Input

Type

Comment

Enable

BOOL

TRUE = authorizes changes to the current counter value.

Sync

BOOL

On rising edge, presets and starts the counter.

ACK_Modulo

BOOL

On rising edge, resets Modulo_Flag.

This table describes the output variables:

Output

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.

Validity

BOOL

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

Error

BOOL

TRUE = indicates that an error was detected.

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

Run

BOOL

TRUE = indicates counter is running.

Modulo_Flag

BOOL

Set to TRUE when the counter rolls over the Modulo value.

CurrentValue

DWORD

Current value of the counter.