Main type is always managed by an HSCMain function block.
NOTE: At build, 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 |
Drag the Libraries > Controller > HMISCU > HMISCU_HSC > HSCMain FB to the Application tree > HMISCUxx5 > POU and drop it on the Start Here box in the lower window. |
2 |
The instance name is located in the Variable field at the Device tree > HMISCU••5 > Embedded Functions > HSC > HSC0• with the HSC0• > Type that is set to Main. Using the input assistant, the HSC instance can be selected at the following path: Embedded Functions > HSC |
NOTE: This method is for ST, LD, or FBD languages. |
The tables describe how the different pins of the function block are used in Free-large mode.
The 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 |
When CAP input is configured: if TRUE, enables the Capture input. |
EN_Compare |
BOOL |
TRUE = enables the comparator operation (using Thresholds 0, 1): obasic comparison (TH0, TH1 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. |
F_Sync |
BOOL |
Forces the Sync condition |
F_Out0 |
BOOL |
TRUE = forces Output0 to TRUE (if Reflex0 is configured). |
F_Out1 |
BOOL |
TRUE = forces Output1 to TRUE (if Reflex1 is configured). |
ACK_Modulo |
BOOL |
On rising edge, resets Modulo_Flag. |
ACK_Sync |
BOOL |
On rising edge, resets Sync_Flag. |
ACK_Cap |
BOOL |
On rising edge, resets Cap_Flag. |
SuspendCompare |
BOOL |
TRUE = compare results are suspended: oTH0, TH1, Reflex0, Reflex1, Out0, Out1 output bits of the block maintain their last value. oPhysical outputs FQ0 and FQ1 maintain their last value oEvents are masked NOTE: EN_Compare, EN_Out0, EN_Out1, F_Out0, F_Out1 remain operational while SuspendCompare is set. |
The table describes the output variables:
Outputs |
Type |
Comment |
---|---|---|
HSC_REF |
Reference to the HSC. To be used with the HSC_REF_IN input pin of the function blocks. |
|
Validity |
BOOL |
TRUE = indicates that output values on the function block are valid. |
Error |
BOOL |
TRUE = indicates that an error was detected. Use the HSCGetDiag function block used to get more information about this detected error. |
CurrentValue |
DINT |
Current count value of the counter. |
Run |
BOOL |
TRUE = counter is running. |
TH0 |
BOOL |
[Counting Up] TRUE when CurrentValue ≥ Threshold 0. [Counting Down] FALSE when CurrentValue ≤ Threshold 0. |
TH1 |
BOOL |
[Counting Up] TRUE when CurrentValue ≥ Threshold 1. [Counting Down] FALSE when CurrentValue ≤ Threshold 1. |
Modulo_Flag |
BOOL |
Set to TRUE when the counter rollovers its limits |
Sync_Flag |
BOOL |
Set to TRUE by the synchronization of the counter |
Cap_Flag |
BOOL |
Set to TRUE 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 configured). |
Out1 |
BOOL |
State of physical outputs Output1 (if Reflex1 configured). |