# cbC8254Config()

Configures 8254 counter for desired operation. This method can only be used with 8254 counters.

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

## Function Prototype

C/C++

int cbC8254Config(int BoardNum, int CounterNum, int Config)

Visual Basic

Function cbC8254Config(ByVal BoardNum&, ByVal CounterNum&, ByVal Config&) 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 an 82C54 counter.

CounterNum

Selects one of the counter channels. An 8254 has 3 counters. The value may be 1 - n, where n is the number of 8254 counters on the board (see board-specific information in the Universal Library User's Guide).

Config

Refer to the 8254 data sheet for a detailed description of each of the configurations. Set it to one of the constants in the "Config argument values" below.

## Returns

- Error code or 0 if no errors

### Config argument values

HARDWARESTROBE | Output of counter (OUT N) pulses low for one clock cycle on terminal count. Count starts on rising edge at GATE N input. See Mode 5 in the 82C54 data sheet (82C54.pdf) in the Documents subdirectory where you installed the UL.
HIGHONLASTCOUNT | Output of counter (OUT N) transitions from low to high on terminal count and remains high until reset. See Mode 0 in the 8254 data sheet (82C54.pdf).
ONESHOT | Output of counter (OUT N) transitions from high to low on rising edge of GATE N, then back to high on terminal count. See Mode 1 in the 8254 data sheet (82C54.pdf).
RATEGENERATOR | Output of counter (OUT N) pulses low for one clock cycle on terminal count, reloads counter and recycles. See Mode 2 in the 8254 data sheet (82C54.pdf).
SOFTWARESTROBE | Output of counter (OUT N) pulses low for one clock cycle on terminal count. Count starts after counter is loaded. See Mode 4 in the 8254 data sheet (82C54.pdf).
SQUAREWAVE | Output of counter (OUT N) is high for count < 1/2 terminal count then low until terminal count, whereupon it recycles. This mode generates a square wave. See Mode 3 in the 8254 data sheet (82C54.pdf).