HSCMain: HSC Main Function Block
This function block controls a Main type counter with the following functions:
oup/down counting
ofrequency meter
oadditional external I/O
othresholds
oevents
operiod meter
odual phase
The HSC Main function block is mandatory when using Main counter.
The function block instance name must match the name defined by configuration. Hardware related information managed by this function block is synchronized with the MAST task cycle.
|
UNINTENDED OUTPUT VALUES |
oOnly use the Function Block instance in the MAST task. oDo not use the same Function Block instance in a different task. |
Failure to follow these instructions can result in death, serious injury, or equipment damage. |
NOTE: Forcing the logical output values of the FB is allowed by EcoStruxure Machine Expert but it will have no impact on hardware related outputs if the function is active (executing).
To see the general representation in IL or ST language, refer to Function and Function Block Representation.
This table describes the input variables:
Input |
Type |
Description |
---|---|---|
EN_Enable |
BOOL |
TRUE = authorizes enabling of the counter using the Enable input (if configured in One shot, Modulo loop modes). |
EN_Sync |
BOOL |
TRUE = authorizes counter synchronization and start using the Sync input. |
EN_Cap |
BOOL |
TRUE = enables the Capture input (if configured in One shot, Modulo loop, Free large modes). |
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 Output0 to echo the Reflex0 value (if configured in One shot, Modulo loop, Free large modes). |
EN_Out1 |
BOOL |
TRUE = enables Output1 to echo the Reflex1 value (if configured in One shot, Modulo loop, Free large modes). |
F_Enable |
BOOL |
TRUE = authorizes changes to the current counter value. |
F_Sync |
BOOL |
On rising edge, authorizes counting function synchronization and start in the following counting modes: One-shot counter: to preset and start the counter Modulo loop counter: to reset and start the counter Free large counter: to preset and start the counter Event counter: to restart the internal time base at the beginning Frequency meter: to restart the internal timer relative to the time base. |
F_Out0 |
BOOL |
TRUE = forces Output0 to 1 (if configured in One-shot, Modulo loop, Free large modes). |
F_Out1 |
BOOL |
TRUE = forces Output1 to TRUE (if configured in One-shot, Modulo loop, Free large modes). |
ACK_Modulo |
BOOL |
On rising edge, resets Modulo_Flag (Modulo loop and Free large modes). |
ACK_Sync |
BOOL |
On rising edge, resets Sync_Flag. |
ACK_Cap |
BOOL |
On rising edge, resets the Cap_Flag (One-shot, Modulo loop, Free large modes). |
SuspendCompare |
BOOL |
TRUE = compare results are suspended: oPhysical Outputs Output0 and Output1 maintain their last value. oCompare events 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. |
|
Validity |
BOOL |
TRUE = indicates that output values on the function block are valid. |
HSC_Err |
BOOL |
TRUE = indicates that an error was detected. Use the HSCGetDiag function block to get more information about this detected error. |
Error |
BOOL |
TRUE = indicates that an error was detected. Use the HSCGetDiag function block to get more information about this detected error. |
CurrentValue |
DINT |
Current count value of the counter. |
Run |
BOOL |
TRUE = counter is running. In One-shot mode, the Run bit switches to 0 when CurrentValue reaches 0. |
TH0 |
BOOL |
TRUE = current counter value > Threshold 0 (if configured in One shot, Modulo loop, Free large modes). Only active when EN_Compare is set. |
TH1 |
BOOL |
TRUE = current counter value > Threshold 1 (if configured in One shot, Modulo loop, Free large modes). Only active when EN_Compare is set. |
Modulo_Flag |
BOOL |
Set to TRUE when the counter rolls over its limits in the following modes: oModulo loop counter: when the counter rolls over to the modulo or 0 oFree large counter: when the counter roll overs its limits |
Sync_Flag |
BOOL |
Set to TRUE by the synchronization of: oOne-shot counter: when the counter presets and starts oModulo loop counter: when the counter resets oFree large counter: when the counter presets oEvent counter: when the internal timer relative to the time base restarts oFrequency meter: when the internal timer relative to the time base restarts |
Cap_Flag |
BOOL |
TRUE = indicates that a value has been latched in the capture register. This flag must be reset before a new capture can occur. |
Reflex0 |
BOOL |
State of Reflex0 (if configured in One shot, Modulo loop, Free large modes). Only active when EN_Compare is set. |
Reflex1 |
BOOL |
State of Reflex1 (if configured in One shot, Modulo loop, Free large modes). Only active when EN_Compare is set. |
Out0 |
BOOL |
Indicates the state of Output0. |
Out1 |
BOOL |
Indicates the state of Output1. |