{}

Impact-Company-Logo-English Black-01-177x54
Share Price 
Impact-Company-Logo-English Black-01-177x54

Welcome to the Schneider Electric corporate Website

Search FAQs

Video: How do you configure a M221 High Speed Counter?

Introduction
The High Speed Counter function block can be configured by SoMachine Basic to perform any one of the following functions:
  • 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 supports counting of dual digital inputs up to frequencies of 60 kHz in single word or double word computational mode, and individual digital inputs up to frequencies of 100 kHz.
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:
LabelDescriptionValue
INActivate (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
SPreset input.
At state 1:
  • initializes the current value with the preset value for Dual Phase [Quadrature X2] or Dual Phase [A=Pulse, B=Direction] with down function in progress
  • resets the current value to 0 for Single Counter or Dual Phase [A=Pulse, B=Direction] with up function in progress
In addition, this also initializes the operation of the threshold outputs and takes into account any user modifications to the threshold values set in the properties window or the program.
0 or 1

The High Speed Counter function block is associated with the following input objects:
ObjectTypeDescriptionValue
%HSCi.P
%HSCi.PD
WORD
DOUBLE WORD
Preset valueSee Auxiliary Inputs.
%HSCi.S0
%HSCi.S0D
WORD
DOUBLE WORD
Threshold 0See Output Threshold in Counting Modes.
%HSCi.S1
%HSCi.S1D
WORD
DOUBLE WORD
Threshold 1See Output Threshold in Counting Modes.
%HSCi.TWORDTime baseSee High Speed Counter in Frequency Meter Mode.
%HSCi.RBOOLActivate reflex output 0At state 1 activates the reflex output 0.
%HSCi.SBOOLActivate reflex output 1At state 1 activates the reflex output 1.



Outputs
The High Speed Counter function block has the following outputs:
LabelDescriptionValue
FOverflow
Set to 1 if an arithmetic overflow occurs.
0 or 1
UCounting 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
TH0Threshold 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
TH1Threshold 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:
ObjectTypeDescriptionValue
%HSCi.V
%HSCi.VD
WORD
DOUBLE WORD
Current valueSee High Speed Counter in Counting Modes.
%HSCi.C
%HSCi.CD
WORD
DOUBLE WORD
Capture valueSee Auxiliary Inputs.
%HSCi.UBOOLCounting direction0: Down counting
1: Up counting
%HSCi.FBOOLOverflow0: No overflow
1: Counter overflow



Properties
The High Speed Counter function block has the following properties:
PropertyValueDescription
UsedActivated / deactivated checkboxIndicates 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.
SymbolUser-defined textThe symbol that uniquely identifies this object. For details, refer to the SoMachine Basic Operating Guide (Defining and Using Symbols).
Preset
  • from 0 to 65535 for %HSCi.P
  • from 0 to 4294967295 for %HSCi.PD
Preset value to initialize the HSC current value (%HSCi.P, %HSCi.PD).
Not valid for the Frequency Meter.
S0
  • from 0 to 65535 for %HSCi.S0
  • from 0 to 4294967295 for %HSCi.S0D
Threshold value 0 is used as a comparator with the current value.
The value of S0 must be less than S1 (%HSCi.S1).
S1
  • from 0 to 65535 for %HSCi.S1
  • from 0 to 4294967295 for %HSCi.S1D
Threshold value 1 is used as a comparator with the current value.
The value of S1 must be greater than S0 (%HSCi.S0).
Time Base100 ms or 1 s for %HSCi.TFrequency measurement time base
CommentUser-defined textA comment to associate with this object.



Special Cases
This table shows a list of special operating of the High Speed Counter function block:
Special CaseDescription
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 stopThe 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.


Schneider Electric Global

Explore more
Explore more
Users group

Discuss this topic with experts

Visit our Community for first-hand insights from experts and peers on this topic and more.