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

GateControl argument values

NOGATENo gating
AHLTCPREVCTRActive high TCN -1
AHLNEXTGATEActive High Level GATE N + 1
AHLPREVGATEActive High Level GATE N - 1
AHLGATEActive High Level GATE N
ALLGATEActive Low Level GATE N
AHEGATEActive High Edge GATE N
ALEGATEActive Low Edge GATE N

CountSource argument values

TCPREVCTRTCN - 1 (Terminal count of previous counter)
CTRINPUT1SRC 1 (Counter Input 1)
CTRINPUT2SRC 2 (Counter Input 2)
CTRINPUT3SRC 3 (Counter Input 3)
CTRINPUT4SRC 4 (Counter Input 4)
CTRINPUT5SRC 5 (Counter Input 5)
GATE1GATE 1
GATE2GATE 2
GATE3GATE 3
GATE4GATE 4
GATE5GATE 5
FREQ1F1
FREQ2F2
FREQ3F3
FREQ4F4
FREQ5F5
ALWAYSLOWInactive, Output Low

OutputControl argument values

HIGHPULSEONTCHigh pulse on Terminal Count
TOGGLEONTCTC Toggled
DISCONNECTEDInactive, Output High Impedance
LOWPULSEONTCActive Low Terminal Count Pulse
3, 6, 7(numeric values) Illegal

Notes