Counter Configuration Tab - 1794-VHSC

Use this tab to configure counters on the 1794-VHSC module. On this tab, you can:
  • Select the counter you want to configure.
  • Select the type of counter to use - 2 counters configurable for 3 encoder modes and counter mode, period/rate mode, continuous/rate mode, rate measurement and pulse width modulation (PWM).
  • Select the desired store count mode.
  • Specify a rollover number at which to restart counts (based on the preset value) when in counter/encoder modes.
  • Specify a reset value, which when met, resets to zero and commences counting.
  • Specify a gate/reset value that functions in one of four available store count modes.
  • Scale the incoming gate/reset frequency to increase accuracy.
  • Filter a specific counter’s input.
Parameters
Counter
This feature selects the desired counter to configure.
Counter Mode Type
The 1794-VHSC module operates in the following modes:
  • counter mode
  • encoder X1 mode
  • encoder X2 mode
  • encoder X4 mode
  • period/rate mode
  • continuous/rate mode
  • rate measurement frequency mode
  • pulse width modulation (PWM)
Counter Mode
Use the counter mode to read incoming pulses from a maximum of two pulse counters, pulse generators, mechanical limit switches, or other similar devices and return them to the controller processor as a binary integer number (0 - 16,777,215). In counter mode, for each channel, the module counts only input A feedback. Input B determines whether to increment or decrement the count. If Phase B is high, the counter will count down. If phase B is low or floating, (that is, not connected), the counter counts up. The counter mode accepts a one phase feedback only. See
Counter Mode Channel Phase Relationship
for more information. The Store Count feature allows the module to store the current count value of the associated counter. It is triggered by the Gate/Reset (Ch0Zinput or Ch1Zinput) terminal on the module. The stored count value of each counter is placed in a separate word in the Input Tag (Ch0StoredCount and Ch1StoredCount) until a new pulse is received at the Gate Reset (Z input) terminal. The Store Count Mode allows you to select how and when the counter will be stored and whether it will be reset.
Encoder Mode
Use the encoder modes to read incoming quadrature pulses and return them to the controller as a binary number (0 - 16,777,215). In these modes, the module accepts two-phase, quadrature feedback and counts up or down depending upon the condition of the phase B input for each counter. See
Encoder Mode Channel Phase Relationship
for information. There are three encoder modes: X1, X2, and X4. The operation of the module in the encoder modes is as follows:
  • Encoder X1 mode
    – quadrature input signals count on the leading edge or the trailing edge of channel A for a bidirectional count. The phase relationship between Channel A and Channel B determines the direction. If channel A is leading and channel B is floating, the count direction is up; if channel A is lagging and channel B is high, the count direction is down.
  • Encoder X2 mode
    – quadrature input signals count on the leading edge and the trailing edge of channel A for a bidirectional count. Channel B determines the direction. If B is low (i.e., floating), the count direction is up; if B is high, the count direction is down.
  • Encoder X4 mode
    – quadrature input signals count on the leading edge and the trailing edge of channel A and channel B for a bidirectional count. Channel B determines the direction. If B is low (i.e., floating), the count direction is up; if B is high, the count direction is down.
Pulse Width Modulation
The 1794-VHSC module can generate a pulse width modulation signal that may be tied to any output. By specifying a Time Base period and Gate Interval when Pulse Width Modulation is selected for the type of input counter, a counter and its first ON/OFF window comparator are assigned and the signal is generated.
Period/Rate
Use the period/rate mode to determine the frequency of input pulses by counting the number of internal 5MHz clock pulses over a user-specified number of input signal pulses. At the end of the specified number of pulses, the module returns the frequency and the total number of pulses received.
Continuous/Rate
The continuous/rate mode is similar to the period/rate mode, except that the outputs in this mode are dynamic outputs. Use this mode to determine the frequency of input pulses by counting the number of internal 5MHz clock pulses over a number of input signal pulses you specify. Each output is turned on as soon as the turn-on count is reached, and turned off as soon as the turn-off count is reached. As the internal 5MHz clock is counted, the outputs dynamically track the 5MHz count. This allows you to turn an output on a certain number of 5MHz counts after the gate/reset pin goes active, and turn it off a certain number of 5MHz counts later
Rate Measurement Mode
Rate Measurement mode counts incoming pulses on channel A depending on the time interval specified in the Time Base and Gate Interval fields. At the end of the interval, the 1794-VHSC module returns a value representing the sampled number of pulses and a value indicating the incoming frequency. When the count and frequency are updated, any associated outputs are checked against their associated presets. The total count equals the number of pulses received during the sample period.
Store Count Mode
The Store Count Mode feature allows the module to manipulate the current count value as well as the state of the counter. The store count feature is triggered by the state of the Input Z (Gate/Reset, Ch0Zinput or Ch1Zinput) on the module. The stored count of each counter is saved (ChoStoredCount or CH1StoredCount) until a new trigger is received. Once received, new values overwrite old values. There are four counter storage modes for manipulating your counters, or this feature can be disabled and not used. You can choose from Store Count Disabled, Store/Continue, Store/Wait/Resume, Store-Reset/Wait/Start, or Store-Reset/Start.
WARNING:
The four modes described can be changed while normal module operation continues. Improper use of on-the-fly changes may cause unintended machine operation when the store count is used as a trigger for machine sequencing.
Rollover
Each of the two counters has one rollover value associated with it. When the rollover value is reached by the encoder/counter, it resets to 0 and begins counting again. The rollover values range from 1 to 16,777,216 binary. These words set the number of counts the counter will accumulate before rolling over. For example, a value of 1000 will produce a count sequence of: 998, 999, 0, 1, 2¼ while incrementing or 2, 1, 0, 999, 998¼ while decrementing. The values are ignored when the 1794-VHSC module is operating in Rate Measurement mode.
Important:
You may configure an application with the following values: rollover = 359 counts, ON window = 200 counts, and OFF window = 400 counts. In this example, the output turns ON at 200 counts and never turns OFF.
Preset Value
Each of the 2 counters has one preset value associated with it. In the encoder or counter modes, the preset value represents a reference (starting) point (or count) from which the module begins counting. It is set to 0 in other modes. The module can count either up or down from the preset value. Preset values can range from 0 - 16,777,215 binary.
Gate Interval
This feature, set on a per channel basis, allows four choices for how incoming count at the gate/reset terminal are scaled. The counter gate interval is set using the time base setting as its time unit and is calculated in the following manner.
0 <= Gate Interval <= 200
There is one gate/reset input for each of the 2 counters. The gate interval, when active, functions in one of the available four counter storage modes. You can scale the incoming count at the gate/reset terminal. Scaling allows the incoming pulses at gate/reset to be divided by a number in the range of 1, 2, 4, 8, 16, 32, 64 and 128.
The Gate Interval must be zero when the Type is
not
PWM or Rate Measurement.
Actual Gate Interval
Display only, on a per channel basis.
Each channel’s Actual Gate Interval is the product of the user specified Gate Interval and the user specified Time Base.
Actual Gate Interval = Time Base * Gate Interval
Example:
AGI (50ms) = 10ms Time Base * 5 Gate Interval
Or
AGI (50ms) = 50ms Time Base * 1 Gate Interval
The Actual Gate Interval is what the module calculates and uses, based on the Gate Interval and Time Base settings.
For Period/Rate and Continuous/Rate, the conversion formula is:
counts = (Scalar X 2500000)/desired frequency (for period/rate and continuous/rate)
For Rate Measurement, the conversion formula is:
counts = time base X gate interval X desired frequency (for rate measurement)
Time Base
This feature sets the fundamental time base for both counters. Resolution in ms, with a minimum of 10ms intervals (10ms = 10; 1s = 1000). Time base must be entered when PWM and rate measurement are configured. The maximum programmed value is 3000.
Input
The input filter that the module uses is based on the selected counter Type.
  • When Counter or Encoder is selected, Filters A, B, and Z are used.
  • When Continuous/Rate or Period/Rate is selected, Filter Z is used.
  • When Rate Measurement is selected, Filter A is used.
  • When Pulse Width Modulation (PWM) is selected, Filters A, B, and Z are NOT used.
Scalar
Scaling allows the input pulses at the gate/reset (Z input) to be divided by a value.
Valid values are: 0, 1, 2, 4, 8, 16, 32, 64, 128.
In Period/Rate and Continuous/Rate Modes, a value between 1 and 128 must be chosen.
Filter Rate
A filter can be chosen for each counter input..
Additionally, if a filter is chosen for either counter, further granularity can be chosen as to which input to filter, either Input A, Input B, or Input Z (Gate/Reset). The filter will only be applied to the inputs for the Input Counter that has filtering chosen (a value other than ‘No Filter’ is selected).
Valid selections are: No Filter, 50kHz, 5kHz, 500Hz, and 50Hz.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.