Configuring a Counter to Count Edges (Scan Interface)

CompactRIO Scan Interface

Configuring a Counter to Count Edges (Scan Interface)

You can configure a counter to count signal edges and perform an action on another channel when the count reaches a specified number, the terminal count. You can configure the following options for edge counting.

Configuring the Input Filter

You can add an input filter to all input channels of the module. A filter removes noise, glitches, and spikes on inputs by rejecting signals with periods shorter than the specified length. You can select one of the following options.

  • Disabled—The hardware synchronizes the digital inputs using a 4 MHz timebase. Pulses longer than 250 ns are always detected. Pulses shorter than 250 ns may be rejected.
  • 1 µs—Pulses shorter than 1 µs are rejected. Pulses between 1 µs and 2 µs are sometimes detected. Pulses longer than 2 µs are always detected.
  • 16 µs—Pulses shorter than 16 µs are rejected. Pulses between 16 µs and 32 µs are sometimes detected. Pulses longer than 32 µs are always detected.
  • 256 µs—Pulses shorter than 256 µs are rejected. Pulses between 256 µs and 512 µs are sometimes detected. Pulses longer than 512 µs are always detected.
  • 4096 µs—Pulses shorter than 4096 µs are rejected. Pulses between 4096 µs and 8192 µs are sometimes detected. Pulses longer than 8192 µs are always detected.

Terminal Count

You can specify a terminal count up to a maximum of 232 = 4,294,967,296. When the counter reaches the terminal count, it resets and starts counting again from zero.

Terminal Count Output Mode

You can select one of the following four actions to perform on a digital output channel on another module when the counter reaches the specified terminal count.

  • Toggle, Reset Off—The counter-driven channel starts in the off state and changes state each time the counter channel reaches the terminal count.
  • Toggle, Reset On—The counter-driven channel starts in the on state and changes state each time the counter channel reaches the terminal count.
  • On Pulse—The counter-driven channel turns on each time the counter channel reaches the terminal count and remains on until the next counter increment.
  • Off Pulse—The counter-driven channel turns off each time the counter channel reaches the terminal count and remains off until the next counter increment.
Note Note  In order for the counter to drive an output channel, you must configure the module that the output channel is on for counter-driven output. The counter-driven output channel has the same number as the counter channel that drives it. For example, CTR3 drives DO3 on an eight-channel digital output module in another slot in the same chassis.

Counter Event

  • Rising Edge—The counter counts rising edges.
  • Falling Edge—The counter counts falling edges.
  • Any Edge—The counter counts all edges.

Count Down

If this box is checked, the counter counts backward from the terminal count. When the counter reaches zero, it resets and starts counting again from the terminal count.

Counter Source

You can select This Channel to count edges on an input signal connected to this channel, or Terminal Count of Previous Channel to increment the counter when the previous channel reaches the terminal count. You can use this option to create counters with terminal counts larger than 4,294,967,296.

Gate Mode

You can select Always Enabled, which means that the counter always counts edges, or Next Channel, which means that the counter increments only when the next higher channel is in the on state.