Gx5732SetCounterGate

Purpose

Sets the counter gate source and gate polarity.

Syntax

Gx5732SetCounterGate (nHandle, nCounter, nGateSource, bGatePolarity, pnStatus)

Parameters

Name
Type
Description
nHandle
SHORT
Handle to a GX5732 board.
nCounter
SHORT
Counter number:
0. GX5732_COUNTER0: Counter 0.
1. GX5732_COUNTER1: Counter 1.
2. GX5732_COUNTER2: Counter 2.
3. GX5732_COUNTER3: Counter 3.
nGateSource
SHORT
Gate source:
0. GX5732_COUNTER_GATE_ENABLE_ALWAYS: Always enabled.
1. GX5732_COUNTER_GATE_CARRY_COUNTER1: Terminal Count Carryout.
2. GX5732_COUNTER_GATE_USER_LINE0: User Line 0.
3. GX5732_COUNTER_GATE_USER_LINE1: User Line 1.
4. GX5732_COUNTER_GATE_USER_LINE2: User Line 2.
5. GX5732_COUNTER_GATE_USER_LINE3: User Line 3.
6. GX5732_COUNTER_GATE_USER_LINE4: User Line 4.
7. GX5732_COUNTER_GATE_USER_LINE5: User Line 5.
bGatePolarity
BOOL
Gate polarity:
0. GX5732_POSITIVE_EDGE: Count when gate signal is high.
1. GX5732_NEGATIVE_EDGE: Count when gate signal is low.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

Use the Gx5732GetCounterEnable to retrieve the counter gate settings. Use the Carryout gate source to create 16, 24 or 32 bit counter by cascading the counter.

Example

The following creates a 16-bit counter by setting the gate of counter 1 to carryout:

 

Gx5732SetCounterGate (nHandle, GX5732_COUNTER1, GX5732_COUNTER_GATE_CARRY_COUNTER1, GX5732_POSITIVE_EDGE, &nStatus);

 

See Also

Gx5732GetCounterGate, Gx5732SetCounterClock, Gx5732SetCounterEnable