The ETH32 device includes two digital counters, which are useful for counting the number of pulses that occur on an I/O line. Counters are implemented directly in hardware and are therefore able to catch faster pulses than events are capable of catching (since they are implemented in ETH32 firmware).
Each counter can be independently enabled or disabled and configured to increment its count on either the falling edge of the input signal (transition from high to low) or the rising edge (transition from low to high). When a counter is disabled it simply means that its count will not increment regardless of the input signal. The counter's value can be read at any time. The counter's value may also be written to a specific value, which may be necessary during initialization.
Counter 0 is a 16-bit counter, while counter 1 is an 8-bit counter. Both counters allow you to configure a rollover value. When a counter reaches the rollover value, the next increment of the counter will reset the counter's value back to zero. The rollover values default to the maximum values of the counters on powerup or reset.
Task | C / C++ | .NET Languages | Visual Basic 6 |
---|---|---|---|
Enable/disable counter, configure edge | CounterState Property | CounterState Property | |
Read/write counter value | CounterValue Property | CounterValue Property | |
Configure counter rollover | CounterRollover Property | CounterRollover Property |