Gx5732SetCounterMode

Purpose

Sets the counter settings and mode.

Syntax

Gx5732SetCounterMode (nHandle, nCounter, bOneShot, bUpDown, nTerminalCounterMode, 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.
bOneShot
BOOL
Mode:
0. FALSE: Continuous.
1. TRUE: One shot
bUpDown
BOOL
Count direction:
0. FALSE: Up.
1. TRUE: Down.

nTerminalCounter

Mode

SHORT
Terminal count mode:
0. GX5732_TERMINAL_COUNT_POS_PULSE: Positive pulse.
1. GX5732_TERMINAL_COUNT_NEG_PULSE: Negative pulse.
2. GX5732_TERMINAL_COUNT_POS_SQUARE: Toggle output, start with low.
3. GX5732_TERMINAL_COUNT_NEG_SQUARE: Toggle output, start with high.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

Use the Gx5732GetCounterMode to retrieve the counter setup modes.

The function sets whether the counter runs in one-shot mode or continuously, if the counter counts up or down, and the terminal count output mode.

Example

The following example sets counter 3 settings to be one shot, count down, and set terminal count mode to 1:

 

Gx5732SetCounterMode (nHandle, GX5732_COUNTER3, TRUE, TRUE, GX5732_TERMINAL_COUNT_NEG_PULSE, &nStatus);

 

See Also

Gx5732GetCounterMode, Gx5732SetCounterEnable