beautypg.com

Counting modes – Measurement Computing USB-4301 User Manual

Page 17

background image

USB-4301 User's Guide

Functional Details

17

Count source

Each counter on the device can count from any of the available sources. The sources for counting are the same

five internal sources and ten external sources listed in the Oscillator sources table (on page 16) with one

addition — each counter can also increment whenever the previous numbered counter reaches its TC (TC n-1).

For example, if you select TC n-1 as the counter source for Counter 2 Input (

INP2

), counter 2 increments or

decrements when counter 1 reaches TC. The previous numbered counter for counter 1 is counter 5. Note that

any of the 16 sources is available for any of the five counters. In other words, the signal source for counter 3 can

be Counter 5 Input or Counter 2 Gate, or FREQ4, and so on.

Gate control

The counter can be gated in several ways. Level gating typically allows the counter to count only while the gate

is active. Edge gating, on the other hand, typically starts the counting when an active gate edge is received.

Level gating configuration options are active high level Gate n, active low level Gate n, active high level

Gate n-1 and active high level Gate n+1, where Gate n is the Gate pin associated with the counter being

configured.

Edge gating configuration options are active high (rising edge) Gate n and active low (falling edge) Gate n.

The counter can be gated by the TC of the previous numbered counter. You can also disable gating.

Counting modes

Each of the five counters has two associated 16-bit registers which can be used to store count values — the

Load register and the Hold register.

The Load register is used to load the starting value for the counter.

The Hold register can be used to store a second counter value, or to save the current counter value.

Most applications only use the Load register. To start counting, configure the counter for the desired mode, and

then load the Load register with the starting value with which to start the counting operation.

Each counter can be configured to count up or to count down. The following sections explain the various

configuration options.

Reload

When the counter reaches TC it is always reloaded with a new value. This new value comes from one of two

sources:

Reload from the Load register. This mode can be used to generate constant frequency pulse trains.

Alternately load from the Load register and then the Hold register. This mode can be used for applications

that require delayed starts or to generate pulse trains with variable duty cycles.

Recycle

Each counter can be configured to count to TC and then stop counting, or to continue counting after reaching

TC. In either case, the counter is reloaded from the appropriate register when it reaches TC. However, if the

Recycle mode is set to stop counting at TC, and the reload mode is set to load from the Load and Hold registers,

it will count once to TC, reload from the Hold register, count again to TC, and then stop counting.

For example, if Counter 1 is configured as follows:

The Load 1 register contains the value 10,000

The Hold 1 register contains the value 5,000

Count down

Alternately load from the Load and Hold registers

This manual is related to the following products: