The Main type is always managed by an HSCMain_TM3 function block.
NOTE: At build time, an error is detected if the HSCMain_TM3 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 Intern > IODrivers > TM3 HSC > HSC > HSCMain_TM3 in the list. |
2 |
Drag-and-drop the item onto the POU window. |
3 |
Edit the default Main type instance name to match the Instance name of the counter function block defined in the Configuration window. |
The tables below describe how the different pins of the function block are used in Period meter type.
This table describes the input variables:
Input |
Type |
Description |
---|---|---|
HSC_REF_TM3 |
HSC_REF_TM3 |
Reference to the HSC instance. |
EN_Enable |
BOOL |
When EN input is configured: if TRUE, authorizes the counter enable via the Enable input. |
EN_Preset |
BOOL |
Not used. |
EN_Cap |
BOOL |
Not used. |
EN_Compare |
BOOL |
TRUE = enables the comparison function (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) NOTE: This option is only available for TM3XF• expansion modules, which support external events. |
EN_Out |
BYTE |
Set bits to 1 to enable corresponding physical outputs to echo the configured function value (Reflex or Stop) as a result of the comparison function. Only active when outputs configured in HSC editor: oBit 0: Output 0 enabled. oBit 1: Output 1 enabled. oBit 2: Output 2 enabled. oBit 3: Output 3 enabled. oBits 4...7: Not used. Association of HSC output Outx with physical output Qy is done by configuration. |
F_Enable |
BOOL |
TRUE = activates counter and takes into account pulses on the counter input. |
F_Preset |
BOOL |
Not used. |
F_Out |
BYTE |
Set bits to 1 to force corresponding physical outputs to 1 if associated with HSC by configuration. Takes priority over EN_Out. Only active when outputs configured in HSC editor: oBit 0: Output 0 forced. oBit 1: Output 1 forced. oBit 2: Output 2 forced. oBit 3: Output 3 forced. oBits 4...7: Not used. Association of HSC output Outx with output terminal Qy is done by configuration. |
ACK_Modulo |
BOOL |
Not used. |
ACK_Preset |
BOOL |
Not used. |
ACK_Cap |
BOOL |
Not used. |
SuspendCompare |
BOOL |
TRUE = compare results are suspended: oThreshold, Reflex, and Out output bits of the function block maintain their last value. oEvents are masked. NOTE: EN_Compare, EN_Reflex, and F_Out remain operational while SuspendCompare is set. |
This table describes the output variables:
Outputs |
Type |
Comment |
---|---|---|
Run |
BOOL |
TRUE = Counter is activated. Edge to Edge: Set to 1 at rising edge detection, and reset to 0 at falling edge. Edge to Opposite: Set to 1 at first rising edge detection. It is only reset to 0 if the counter is disabled or an error is detected. |
Valid |
BOOL |
TRUE = indicates that output values on the function block are valid. |
Error |
BOOL |
TRUE = indicates that an error was detected. |
ErrorId |
HSC_ERROR_TM3 |
Indicates the value of the error detected. See HSC_ERROR_TM3 enumeration. |
Thresholds |
BYTE |
Bits set to 1 when CurrentValue ≥ Threshold: oBit 0: CurrentValue ≥ Threshold 0 oBit 1: CurrentValue ≥ Threshold 1 oBit 2: CurrentValue ≥ Threshold 2 oBit 3: CurrentValue ≥ Threshold 3 oBits 4...7: Not used Only active when EN_Compare is set. |
Modulo_Flag |
BOOL |
Not used. |
Preset_Flag |
BOOL |
Not used. |
Cap_Flag |
BOOL |
Not used. |
Reflex |
BYTE |
State of the reflex function: oBit 0: Reflex 0 oBit 1: Reflex 1 oBit 2: Reflex 2 oBit 3: Reflex 3 oBits 4...7: Not used |
Out |
BYTE |
State of the physical outputs: oBit 0: Out0 oBit 1: Out1 oBit 2: Out2 oBit 3: Out3 oBits 4...7: Not used Association of HSC output Outx with physical output Qy is done by configuration. |
CapturedValue |
DINT |
Not used. |
CurrentValue |
DINT |
The value of the counter. |