Function usage, Input/output parameters, Counter parameters – Measurement Computing Data Acquisition Systems rev.10.4 User Manual
Page 349

Programmer’s Manual
938295
9513 Counter-Timer Commands D-9
Function Usage
Input/Output Parameters
The gate control (gateCtrl) parameter dictates how the counter will use its gate input (P3 pins 37, 18,
16, 14 and 12) or another counter’s gate input. Possible settings are as follows:
• If the gate is disabled using the DgcNoGating definition, it will be ignored and the counter will run as
long as it is armed.
• If a level gate control is selected (using the DgcHighLevelGateNPI, DgcHighLevelGateNMI,
DgcHighLevelGateN
, or DgcLowLevelGateN definitions), the counter will operate only while
armed and the selected high or low level is applied to the gate.
• If an edge-sensitive gate control is selected using the DgcHighEdgeGate or DgcHighEdgeGateN
definitions, the counter will operate after a rising or falling edge is detected on the gate input.
Most gate control modes select gate N (gate of the selected counter) or gate inputs of the previous (N-1)
and next (N+1) counters. Thus, counter 3 could use the gate input of counter 2 by selecting N-1, counter 4
by selecting N+1, or its own gate input by selecting N. Counter 1 and counter 5 are considered adjacent
when selecting gate input N+1 or N-1. The final gate control mode allows the TC-toggled output (see the
following description of the output control parameter) of the previous counter (N-1) to be the gate. The
selected counter will operate only when the previous counter’s TC-toggled output is high.
The output control (outputCtrl) parameter controls the state of the counter output (P3 pins 35, 34, 33,
32, 31). There are 2 inactive and 3 active output modes. If inactive, the output can be driven to low
impedance, or increased to high impedance. The active modes are all associated with the terminal count
(TC) which is the moment in time when the counter reaches 0. This can happen by counting above 65,535
in binary count mode (9,999 in BCD count mode) or counting down below 1. The output can be either
driven high during the TC and low otherwise, driven low during the TC and high otherwise, or toggled
every time a TC occurs. The TC-toggled mode is used to generate variable duty-cycle square waves.
Counter Parameters
The count source (cntSource) parameter selects the source used as input to the specified counter. The
count source can be any one of the following:
• the counter inputs--Src1 to Src5 (P3 pins 36, 19, 17, 15 or 13)
• the counter gates--Gate1 to Gate5 (P3 pins 37, 18, 17, 16 or 14)
• an internal frequency--F1 to F5
• the TC-toggled output of the previous counter (N-1)
The internal frequencies are divide-by-10 divisions of the onboard oscillator which is by default 1 MHz,
but can be jumpered to 10 MHz. The sources F1 through F5 correspond to the frequencies 1 MHz, 100
kHz, 10 kHz, 1 kHz and 100 Hz. The TC-toggled output of the previous counter can be used as a source—
allowing counters to be cascaded without external connections.
The cntEdge, cntDir, cntType, cntRepeat, reload, and specGate parameters all take boolean
value types. For the follwoing discussions, if any of these parameters has a non-zero value, it is understood
to be true; if a parameter has a value of zero, it is understood to be false.
The count edge (cntEdge) parameter selects whether the counter will count when it receives a rising or
falling edge on its count source (see the count source parameter description above).When set to true, a
rising count edge will be used; if the value of cntEdge is false, and falling count edge will be used.
The count direction (cntDir) parameter selects whether the counter will count up or down. If cntDir is
set to true, the count will go up; if the value of cntDir is false, the count will go down. The counter
is normally configured for down counting when generating a pulse or square wave. The load register
would be set to a positive value that would descent in decrements to zero, defining the duration or width of
the waveform. In event counting, the counter would initially be set to zero and configured to count up
(in this case, the hold register would contain the number of events received).