The Main type is always managed by an HSCMain function block.
NOTE: At build time, an error is detected 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 > LMC058 > LMC058 Expert IO > HSC > HSCMain_LMC058 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: ![]() Using the input assistant, the HSC instance can be selected at the following path: Global Variables > <MyController> > PLC Logic > IoConfig_Globals. |
The tables below describe how the different pins of the function block are used in Free-large mode.
This table describes the input variables:
Input |
Type |
Description |
---|---|---|
EN_Enable |
BOOL |
When EN input is configured: if TRUE, authorizes the counter enable via the Enable input. |
EN_Preset |
BOOL |
When SYNC input is configured: if TRUE, authorizes the counter synchronization and start via the Sync input. |
EN_Cap |
BOOL |
When CAP input is configured: if TRUE, enables the Capture input. |
EN_Compare |
BOOL |
TRUE = enables the comparison 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 physical output Output0 to echo the Reflex0 value (if configured). |
EN_Out1 |
BOOL |
TRUE = enables physical output Output1 to echo the Reflex1 value (if configured). |
F_Enable |
BOOL |
Forces the Enable condition. Takes priority over EN_Enable input. |
F_Preset |
BOOL |
Forces the Preset condition. Takes priority over EN_Preset input. |
F_Out0 |
BOOL |
TRUE = forces Output0 to 1 (if Reflex0 is configured in HSC Embedded Functions). Takes priority over EN_Out0. |
F_Out1 |
BOOL |
TRUE = forces Output1 to 1 (if Reflex1 is configured in HSC Embedded Functions). Takes priority over EN_Out1. |
ACK_Modulo |
BOOL |
On rising edge, resets Modulo_Flag. |
ACK_Preset |
BOOL |
On rising edge, resets Preset_Flag. |
ACK_Cap |
BOOL |
On rising edge, resets Cap_Flag. |
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. oEvents 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 |
Reference to the HSC. To be used with the EXPERT_REF_IN input pin of the 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 output values on the function block are valid. |
Run |
BOOL |
Not used. |
TH0 |
BOOL |
|
TH1 |
BOOL |
|
TH2 |
BOOL |
|
TH3 |
BOOL |
|
Modulo_Flag |
BOOL |
Set to 1 when the counter rolls over its limits. |
Preset_Flag |
BOOL |
Set to 1 by the preset of the counter |
Cap_Flag |
BOOL |
Set to 1 when a new capture value is stored in the Capture register. This flag must be reset before a new capture can occur. |
Reflex0 |
BOOL |
|
Reflex1 |
BOOL |
|
Out0 |
BOOL |
State of physical outputs Output0 (if Reflex0 is configured in HSC Embedded Function, otherwise FALSE if not configured). |
Out1 |
BOOL |
State of physical outputs Output1 (if Reflex1 is configured in HSC Embedded Function, otherwise FALSE if not configured). |
CurrentValue |
DINT |
The value of the counter. |