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. |
These table describes how the different pins of the function block are used in the mode Event.
The table describes the input variables:
Input |
Type |
Description |
---|---|---|
EN_Enable |
BOOL |
Not used |
EN_Sync |
BOOL |
When SYNC input is configured: if TRUE, allows the setting of the counter value to 0. |
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. |
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 |
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. HSCGetDiag function block may be 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 |
Not used |
TH1 |
BOOL |
Not used |
Modulo_Flag |
BOOL |
Not used |
Sync_Flag |
BOOL |
Set to TRUE 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 |