Introduction
The High Speed Counter function block can be configured by SoMachine Basic to perform any one of the following functions:
The High Speed Counter function block uses dedicated inputs and auxiliary inputs and outputs. Refer to the M221 Logic Controller - Hardware Guide for more information on inputs and outputs.
You must initialize the High Speed Counter function in the Configuration tab using the High Speed Counter Assistant before using an instance of the function block. Refer to Configuring High Speed Counters.
Graphical Representation
Inputs
The High Speed Counter function block has the following inputs:
The High Speed Counter function block is associated with the following input objects:
Outputs
The High Speed Counter function block has the following outputs:
The High Speed Counter function block is associated with the following output objects:
Properties
The High Speed Counter function block has the following properties:
Special Cases
This table shows a list of special operating of the High Speed Counter function block:
- Dual Phase [A=Pulse, B=Direction] (or Up/Down counter)
- Dual Phase [Quadrature X2] (or Bi-phase counter)
- Single Counter
- Frequency Meter
The High Speed Counter function block uses dedicated inputs and auxiliary inputs and outputs. Refer to the M221 Logic Controller - Hardware Guide for more information on inputs and outputs.
You must initialize the High Speed Counter function in the Configuration tab using the High Speed Counter Assistant before using an instance of the function block. Refer to Configuring High Speed Counters.
Graphical Representation
Inputs
The High Speed Counter function block has the following inputs:
Label | Description | Value |
---|---|---|
IN | Activate (required) At state 1, the counting function or frequency measurement is activated. At state 0, the current value is held at its last value. | 0 or 1 |
S | Preset input. At state 1:
| 0 or 1 |
The High Speed Counter function block is associated with the following input objects:
Object | Type | Description | Value |
---|---|---|---|
%HSCi.P %HSCi.PD | WORD DOUBLE WORD | Preset value | See Auxiliary Inputs. |
%HSCi.S0 %HSCi.S0D | WORD DOUBLE WORD | Threshold 0 | See Output Threshold in Counting Modes. |
%HSCi.S1 %HSCi.S1D | WORD DOUBLE WORD | Threshold 1 | See Output Threshold in Counting Modes. |
%HSCi.T | WORD | Time base | See High Speed Counter in Frequency Meter Mode. |
%HSCi.R | BOOL | Activate reflex output 0 | At state 1 activates the reflex output 0. |
%HSCi.S | BOOL | Activate reflex output 1 | At state 1 activates the reflex output 1. |
Outputs
The High Speed Counter function block has the following outputs:
Label | Description | Value |
---|---|---|
F | Overflow Set to 1 if an arithmetic overflow occurs. | 0 or 1 |
U | Counting direction Set by the system, this bit is used by the Dual Phase counting functions to indicate the direction of counting. | 0: Down counting 1: Up counting |
TH0 | Threshold bit 0 Set to 1 when the current value is greater than or equal to the threshold value S0 (%HSCi.S0). Test this bit only once in the program because it is updated in real time. The user application is responsible for the validity of the value at its time of use. | 0 or 1 |
TH1 | Threshold bit 1 Set to 1 when the current value is greater than or equal to the threshold value S1 (%HSCi.S1). Test this bit only once in the program because it is updated in real time. | 0 or 1 |
The High Speed Counter function block is associated with the following output objects:
Object | Type | Description | Value |
---|---|---|---|
%HSCi.V %HSCi.VD | WORD DOUBLE WORD | Current value | See High Speed Counter in Counting Modes. |
%HSCi.C %HSCi.CD | WORD DOUBLE WORD | Capture value | See Auxiliary Inputs. |
%HSCi.U | BOOL | Counting direction | 0: Down counting 1: Up counting |
%HSCi.F | BOOL | Overflow | 0: No overflow 1: Counter overflow |
Properties
The High Speed Counter function block has the following properties:
Property | Value | Description |
---|---|---|
Used | Activated / deactivated checkbox | Indicates whether the address is in use. |
Address | %HSCi, where i is from 0 to 3, depending on the type(s) of counters configured. | i is the instance identifier. Refer to the M221 Programming Guide for the maximum number of High Speed Counter objects. |
Symbol | User-defined text | The symbol that uniquely identifies this object. For details, refer to the SoMachine Basic Operating Guide (Defining and Using Symbols). |
Preset |
| Preset value to initialize the HSC current value (%HSCi.P, %HSCi.PD). Not valid for the Frequency Meter. |
S0 |
| Threshold value 0 is used as a comparator with the current value. The value of S0 must be less than S1 (%HSCi.S1). |
S1 |
| Threshold value 1 is used as a comparator with the current value. The value of S1 must be greater than S0 (%HSCi.S0). |
Time Base | 100 ms or 1 s for %HSCi.T | Frequency measurement time base |
Comment | User-defined text | A comment to associate with this object. |
Special Cases
This table shows a list of special operating of the High Speed Counter function block:
Special Case | Description |
---|---|
Effect of cold restart (%S0=1) | Resets all the High Speed Counter attributes with the values configured by the program. |
Effect of warm restart (%S1=1) | Has no effect. |
Effect of controller stop | The High Speed Counter stops its function and the outputs stay in their current state. NOTE: When the controller stops, the reflex outputs stay in their current state only if the fallback behavior of the tasks is configured to maintain values of the outputs. For more information on configuring fallback behavior, refer to Fallback Behavior. |