# cbC9513Config()

Sets all of the configurable options of a 9513 counter.

For more information, refer to the AM9513A data sheet (9513A.pdf) in the Documents subdirectory where you installed the UL (C:\Program files\Measurement Computing\DAQ by default).

## Function Prototype

C/C++

int cbC9513Config(int BoardNum, int CounterNum, int GateControl, int CounterEdge, int CountSource, int SpecialGate, int Reload, int RecycleMode, int BCDMode, int CountDirection, int OutputControl);

Visual Basic

Function cbC9513Config(ByVal BoardNum&, ByVal CounterNum&, ByVal GateControl&, ByVal CounterEdge&, ByVal CountSource&, ByVal SpecialGate&, ByVal Reload&, ByVal RecycleMode&, ByVal BCDMode&, ByVal CountDirection&, ByVal OutputControl&) As Long

## Arguments

BoardNum

The number associated with the board when it was installed with InstaCal or created with cbCreateDaqDevice(). BoardNum may be 0 to 99. The board must have a 9513 counter.

CounterNum

Counter number (1 - n) where n is the number of counters on the board. For example, a CIO-CTR5 has 5, a CIO-CTR10 has 10, etc. See board-specific information in the UL User's Guide.

GateControl

Sets the gating response for level, edge, etc. Set it to one of the constants in the "GateControl argument values" section below.

CounterEdge

Which edge to count. Referred to as "Source Edge" in 9513 data book. Can be set to POSITIVEEDGE (count on rising edge) or NEGATIVEEDGE (count on falling edge).

CountSource

Each counter may be set to count from one of 16 internal or external sources. Set it to one of the constants in the "CountSource argument values" section below.

SpecialGate

Special gate may be enabled or disabled (CBENABLED or CBDISABLED in Visual Basic).

Reload

Reload the counter from the load register (Reload = LOADREG) or alternately load from the load register, then the hold register (Reload = LOADANDHOLDREG).

RecycleMode

Execute once (RecycleMode = ONETIME) or reload and recycle (RecycleMode = RECYCLE).

BCDMode

Counter may operate in binary coded decimal count (ENABLED) or binary count (DISABLED) (CBENABLED or CBDISABLED in Visual Basic).

CountDirection

AM9513 may count up (COUNTUP) or down (COUNTDOWN).

OutputControl

The type of output desired. Set it to one of the constants in the "OutputControl argument values" section below.

## Returns

- Error code or 0 if no errors

### GateControl argument values

NOGATE | No gating
AHLTCPREVCTR | Active high TCN -1
AHLNEXTGATE | Active High Level GATE N + 1
AHLPREVGATE | Active High Level GATE N - 1
AHLGATE | Active High Level GATE N
ALLGATE | Active Low Level GATE N
AHEGATE | Active High Edge GATE N
ALEGATE | Active Low Edge GATE N

### CountSource argument values

TCPREVCTR | TCN - 1 (Terminal count of previous counter)
CTRINPUT1 | SRC 1 (Counter Input 1)
CTRINPUT2 | SRC 2 (Counter Input 2)
CTRINPUT3 | SRC 3 (Counter Input 3)
CTRINPUT4 | SRC 4 (Counter Input 4)
CTRINPUT5 | SRC 5 (Counter Input 5)
GATE1 | GATE 1
GATE2 | GATE 2
GATE3 | GATE 3
GATE4 | GATE 4
GATE5 | GATE 5
FREQ1 | F1
FREQ2 | F2
FREQ3 | F3
FREQ4 | F4
FREQ5 | F5
ALWAYSLOW | Inactive, Output Low

### OutputControl argument values

HIGHPULSEONTC | High pulse on Terminal Count
TOGGLEONTC | TC Toggled
DISCONNECTED | Inactive, Output High Impedance
LOWPULSEONTC | Active Low Terminal Count Pulse
3, 6, 7 | (numeric values) Illegal

## Notes

- The information provided here and in cbC9513Config() will help you understand how Universal Library syntax corresponds to the 9513 data sheet (9513A.pdf), but is not a substitute for the data sheet. You cannot program and use a 9513 without this data sheet.