High Speed Counter Setup - HO02A, HD02A Based
This help topic covers the basics of the optional high speed counter modules XBF-HO02A and XBF-HD02A and walks through an example to configure these modules and how to program for them.
The XBF-HO02A and XBF-HD02A are almost identical products. The only differences are their pulse input interface and maximum count speed. The high speed counter configuration and programming for these modules are the same. The following table shows their key specs.
Feature | XBF-HO02A | XBF-HD02A |
---|---|---|
Pulse input Interface | Voltage input (Open collector) | Differential input (Line driver) |
Pulse input signal level | 5/12/24VDC | RS-422A line drive/HTL LEVEL line drive |
Maximum count speed | 200kpps | 500kpps (HTL: 250kpps) |
Maximum number of high speed counter modules per system | 7 modules (Slot 2-8) | |
Number of high speed counter | 2 (CH0 and CH1) | |
Number of pulse inputs per counter | 2 (Phase A and Phase B) | |
Counter mode | Linear or Ring | |
Pulse input mode | 1 Phase 1 Input (x1 or x2), 1 Phase 2 Inputs (x1 or x2), 2 Phases (x1, x2 or x4) or CW/CCW (x1) | |
Count range | -2,147,483,648 to 2,147,482,647 (DINT) | |
Compare | 2 compare setups per channel | |
Presets | Internal and External |
Step | Action |
---|---|
1 |
Double-click I/O Parameter in the Project window.
|
2 |
Click the Module cell for the slot to add the module.
|
3 |
Select the module to add.
|
After adding the module, double click one of the 5 cells next to the high speed counter module in the right.
The Special Module Parameter window opens.
XG5000 has the capability to assign global variables and constants to the XBF-HO02A and XBF-HD02A. You can use them for programming and monitoring.
Step | Action |
---|---|
1 |
After adding the XBF-HO02A and XBF-HD02A module(s) to the system, select Register Module Variable Comments in the pull-down menu Edit.
|
2 |
A pop up message is displayed.
Click Yes. |
3 |
Check the high speed counter module and click the OK button.
|
4 | XG5000 assigns 51 global variables and 35 global constants to each XBF-HO02A and XBF-HD02A. |
You can access the list of these global variables and constants by double-clicking the Global/Direct Variables in the Project window.
There are 2 counter modes available.
There are 8 pulse input modes available.
Each high speed counter channel has two sets of Compare Modes that are named Compare 0 Mode and Compare 1 Mode.
Each Compare Mode supports seven conditions to evaluate the Present Value (Current count value) with up to two compare setup values (Minimum and Maximum Setting) and controls the Compare 0/1 Output status. The Compare output built in the high speed counter module can also be controlled (this is optional).
Note: The Compare 0/1 Output status are system defined global variables.
Condition | Minimum Setting | Maximum Setting | Comparator Output Flag | Digital Output (Optional) |
---|---|---|---|---|
(Present Value)< | Required | Not required | On if Present Value < Minimum Value. | On if the Comparator flag is on. |
(Present Value)<= | Required | Not required | On if Present Value <= Minimum Value. | On if the Comparator flag is on. |
(Present Value)= | Required | Not required | On if Present Value = Minimum Value. | On if the Comparator flag is on. |
(Present Value)>= | Required | Not required | On if Present Value >= Minimum Value. | On if the Comparator flag is on. |
(Present Value)> | Required | Not required | On if Present Value > Minimum Value. | On if the Comparator flag is on. |
(Range) Include | Required | Required | On if Present Value >= Minimum Value and Present Value <= Maximum Value. | On if the Comparator flag is on. |
(Range) Exclude | Required | Required | On if Present Value <= Minimum Value or Present Value >= Maximum Value. | On if the Comparator flag is on. |
There are 2 types of presets available.
Internal Preset
When the global variable Enable Preset is turned on, the Preset value set in the Special Module Parameter window is set as the count value for the channel.
Item | CH 0 | CH 1 |
---|---|---|
Enable Preset |
_000n_CH0_PREEN (%UX0.n.369) |
_000n_CH1_PREEN
(%UX0.n.385) |
n = slot number (2-8)
External Preset
To use this External Preset feature, turn on the global variable External Preset Input Enable assigned to the channel first. After that, when the Preset Input built in the high speed counter module for each channel turns on, the Preset value set in the Special Module Parameter window is set as the count value for the channel.
Item | CH 0 | CH 1 |
---|---|---|
External Preset Input Enable | _000n_CH0_EXTPST_EN
(%UX0.n.379) |
_000n_CH1_PREEN
(%UX0.n.385) |
n = slot number (2-8)
Count pulses from an encoder and turn Compare Output 0 on when the count value is between 500 and 700.
System Configuration
Step | Action |
---|---|
1 |
Configure the high speed counter module. The following configuration works with the both XBF-HO02A and XBF-HD02A.
|
2 |
Connect the encoder to the XEM CPU module.
Also connect power and ground correctly according to the high speed counter module type. |
3 |
Write a program. The following sample programs work with the both XBF-HO02A and XBF-HD02A. LD (Ladder)
ST (Structured Text)
|
4 |
Results: Current Count Value = 429
Current Count Value = 594
Current Count Value = 722
|
LP530