CTR_Setup Previous topicNext topicFirst topicLast topic

CTR_Setup

@ Description

Configures the selected counter to operate in the specified mode.

@ Cards Support

9111, 9112, 9113, 9114, 9118, 7248, 7249, 7296

@ Syntax

I16 CTR_Setup (U16 CardNumber, U16 Ctr, U16 Mode, U32 Count, U16 BinBcd)

@ Parameter

CardNumber : The card id of the card that want to perform this operation.
Ctr     : The counter number.
Range: 0 for PCI-9111, PCI-9112, PCI-9113, PCI-9114, PCI-9118.
Range: 0, 1, 2 for PCI-7248, PCI-7249, PCI-7296.
Mode : The mode in which the counter is to operate.
            Valid value:
            TOGGLE_OUTPUT
            PROG_ONE_SHOT
            RATE_GENERATOR
            SQ_WAVE_RATE_GENERATOR
            SOFT_TRIG
            HARD_TRIG

The description of these six modes are the following:

TOGGLE_OUTPUT: Toggle output from low to high on terminal count
In this mode, the output goes low after the mode set operation, and the counter begins to count down while the gate input is high. When terminal count is reached, the output goes high and remains high until the selected counter is set to a different mode. The following diagram shows the TOGGLE_OUTPUT mode timing diagram.

PROG_ONE_SHOT: Programmable one-shot
In this mode, the output goes low on the cofollowing the rising edge of the gate input and goes high on terminal count. The following diagram shows the PROG_ONE_SHOT mode timing diagram.

RATE_GENERATOR: Rate generator
In this mode, the output goes low for one period of the clock input. count indicates the period from one output pulse to the next. The following diagram shows the RATE_GENERATOR mode timing diagram.

SQ_WAVE_RATE_GENERATOR: Square wave rate generator
In this mode, the output stays high for one half of the count clock pulses and stays low for the other half. The following diagram shows the SQ_WAVE_RATE_GENERATOR mode timing diagram.

SOFT_TRIG: Software-triggered strobe
In this mode, the output is initially high, and the counter begins to count down while the gate input is high. On terminal count, the output goes low for one clock pulse, then goes high again. The following diagram shows the SOFT_TRIG mode timing diagram.

HARD_TRIG: Hardware-triggered strobe
This mode is similar to SOFT_TRIG mode except that the gate input is used as a trigger to start counting. The following diagram shows the HARD_TRIG mode timing diagram.

Count : The period from one output pulse to the next.
BinBcd : Whether the counter operates as a 16-bit binary counter or as a 4-decade binary-coded decimal (BCD) counter.
              Valid value:
                BIN:  16-bit binary counter.
                BCD:  4-decade BCD counter.

@ Return Code

NoError, ErrorInvalidCardNumber, ErrorCardNotRegistered, ErrorFuncNotSupport, InvalidCounter