# USB-QUAD08

The USB-QUAD08 supports the following features.

## Counter I/O

Functions

UL: cbCClear(), cbCIn(), cbCIn32(), cbCIn64(), cbCLoad(), cbCLoad32(), cbCLoad64(), cbCConfigScan(), cbCInScan()

UL for .NET: CClear(), CIn(), CIn32(), CIn64(), CLoad(), CLoad32(), CLoad64(), CConfigScan(), CInScan()

Python for Windows: c_clear(), c_in(), c_in_32(), c_in_64(), c_load(), c_load_32(), c_load_64(), c_config_scan(), c_in_scan

Note: Counters on this device are zero-based (the first counter number is "0").

CounterNum

0 to 7

Options

BACKGROUND, CONTINUOUS, CTR32BIT, CTR48BIT, EXTCLOCK, EXTTRIGGER, HIGHRESRATE

Mode

- ENCODER: ENCODER_MODE_BIT_32, ENCODER_MODE_BIT_48, ENCODER_MODE_CLEAR_ON_Z_OFF, ENCODER_MODE_LATCH_ON_Z, ENCODER_MODE_MODULO_N_ON, ENCODER_MODE_NO_RECYCLE_ON, ENCODER_MODE_RANGE_LIMIT_ON, ENCODER_MODE_X1, ENCODER_MODE_X2, ENCODER_MODE_X4
- TOTALIZE: BIT_32, BIT_48, CLEAR_ON_READ, DECREMENT_ON, GATING_ON, LATCH_ON_MAP, MODULO_N_ON, NO_RECYCLE_ON, RANGE_LIMIT_ON, STOP_AT_MAX, UPDOWN_ON
- PERIOD: PERIOD_MODE_BIT_32, PERIOD_MODE_BIT_48, PERIOD_MODE_GATING_ON, Period_Mode_X1, Period_Mode_X10, Period_Mode_X100, PERIOD_MODE_X1000
- PULSEWIDTH: PULSEWIDTH_MODE_BIT_32, PULSEWIDTH_MODE_BIT_48, PULSEWIDTH_MODE_GATING_ON

When using Period and PulseWidth modes, note that the initial period is dependent upon the frequency of the signal being measured, a signal is required in order to latch data into the register, and the first sample in a scan is always zero, since it is not data that has been latched by the measured signal.

RegNum

MAXLIMITREG0 to MAXLIMITREG7

LoadValue

When using cbCLoad64() to load the MAXLIMIT register, values up to 248 – 1 may be loaded. Values using cbCLoad32() and CLoad32() are limited to 4,294,967,295 (232 – 1). Values using cbCLoad() and CLoad() are limited to 65,535 (216 – 1). Refer to the Visual Basic signed integers discussion in the Counter Hardware topic for more information.

## Digital I/O

Configuration

Functions

UL: cbDConfigBit(), cbDConfigPort()

UL for .NET: DConfigBit(), DConfigPort()

Python for Windows: d_config_bit(), d_config_port()

PortNum

AUXPORT*

Port I/O

Functions

UL: cbDIn(), cbDOut()

UL for .NET: DIn(), DOut()

Python for Windows: d_in(), d_out()

PortNum

AUXPORT*

DataValue

0 to 255

Bit I/O

Functions

UL: cbDBitIn(), cbDBitOut()

UL for .NET: DBitIn(), DBitOut()

Python for Windows: d_bit_in(), d_bit_out()

BitNum

0 to 7

## Timers

UL: cbPulseOutStart(), cbPulseOutStop()

UL for .NET: PulseOutStart(), PulseOutStop()

Python for Windows: pulse_out_start(), pulse_out_stop()

TimerNum

0 and 1

Frequency

0.01123 Hz to 5 MHz

DutyCycle

0 to 1, non-inclusive

PulseCount, Initial Delay, IdleState

Ignored

## Triggering

UL: cbSetTrigger()

UL for .NET: SetTrigger()

Python for Windows: set_trigger()

TrigType

TRIGHIGH, TRIGLOW, TRIGPOSEDGE, TRIGNEGEDGE

## Configuration

This hardware supports device detection with the API. Refer to the InstaCal, API Detection, or Both? section for information about whether to use InstaCal or the API to detect and configure hardware.

#### InstaCal

Factory serial number

Listed as Serial # (read only)

Terminal Count Status

Enable checkbox for Bit 0 through Bit 7

Set All button

Input mode

Switch position drop-down combo box for single-ended or differential.

#### Programmable API Functions

Factory serial number

UL: cbGetConfigString()

ConfigItem = BIDEVSERIALNUM

UL for .NET: GetDeviceSerialNum()

Python for Windows: get_config_string()

config_item = DEVSERIALNUM

Terminal Count Output Status

UL: cbGetConfig(), cbSetConfig()

ConfigItem = BITERMCOUNTSTATBIT

DevNum = bit number

ConfigVal = 0 (disable), 1 (enable)

UL for .NET: EnableTerminalCountStatusBit(), DisableTerminalCountStatusBit(), IsTerminalCountStatusBitEnabled()

Python for Windows: get_config(), set_config()

config_item = TERMCOUNTSTATBIT

dev_num = bit number

config_val = 0 (disable), 1 (enable); set with the State enum

Input mode

UL: cbAInputMode()

UL for .NET: AInputMode()

Python for Windows: a_input_mode

## Hardware Considerations

##### Loading and reading 16, 32, and 48-bit values

The USB-QUAD08 counters can be configured as 16-, 32-, or 48-bit.

For most situations, the 32-bit functions (cbCLoad32()/CLoad32() and cbCIn32()/CIn32()) are preferred for reading and writing the counter. While each of these functions are valid regardless of the configuration, keep in mind that the upper bits will be truncated when the data value is larger than the Count argument can represent. Refer to 32-bit values using a signed integer data type for information on 32-bit values using unsigned integers.

The following functions can handle count values that are less than 216 (65,536) without truncating:

- cbCIn()/CIn()/c_in()
- cbCLoad()/CLoad()/c_load()

The following functions can handle count values that are less than 232 (4,294,967,296) without truncating:

- cbCIn32()/CIn32()/c_in_32()
- cbCLoad32()/CLoad32()/c_load_32()

The following functions can handle count values that are less than 248 (281,474,976,710,656) without truncating:

- cbCIn64()/CIn64()/c_load_64()
- cbCLoad64()/CLoad64()/c_load_64()

##### Mapped channel

The cbCConfigScan() MappedChannel argument and the CConfigScan() mapCounter parameter are ignored for the USB-QUAD08. Use the device's Index input to gate, latch, decrement, or clear/reload a counter.

##### Scanning

Call cbCInScan()/CInScan() to read data synchronously. Note that the count value is set to 0 at the initiation of a scan. Keep in mind, however, that the count value is set to 0 at the initiation of a scan. For this reason, avoid using terminal count outputs in conjuction with synchronous reads for the USB-QUAD08. Instead, use the asynchronous functions cbCIn32()/CIn32() or the variations to read the counter without disrupting the terminal count pulse train.

##### Edge detection

The cbCConfigScan() EdgeDetection argument and the CConfigScan() edgeDetection parameter is used to detect a rising or falling edge on the counter specified by the CounterNum argument.
For the USB-QUAD08, the standard arguments (CTR_RISING_EDGE/CTR_FALLING_EDGE) apply to the Phase A input. The polarity for the Phase B and Index inputs can also be set by using the bit fields as described below:

- 000 (CTR_RISING_EDGE): Phase A, Phase B, Index input
- 001 (CTR_FALLING_EDGE): Phase A input
- 010 (CTR_FALLING_EDGE): Phase B input
- 100 (CTR_FALLING_EDGE): Index input

These values can be combined using a bitwise Or operation.

##### HIGHRESRATE

Specify the cbCInScan/CInScan() HIGHRESRATE scan option to acquire data at a high resolution rate. When specified, the rate at which samples are acquired is in "samples per 1000 seconds per channel".

##### Counter resolution

The counter resolution is set by default to 48-bits. Use the CInScan() method's Ctr16Bit, Ctr32Bit, and Ctr48Bit scan options to change the counter resolution.

##### Asynchronous reads

The CConfigScan() method's Bit48 and EncoderModeBit48 counter mode options only affect counter resolution for asynchronous calls (CIn(), CIn32(), and CIn64()).
The Bit48 and EncoderModeBit48 modes are recommended for use only with CIn64(). Using these mode options with CIn() and CIn32() are not very useful, since the value returned by CIn() is only 16 bits, and the value returned by CIn32() is only 32 bits. The effect is that the value returned by CIn() rolls over at 65,535, and the value returned by CIn32() rolls over at 4,294,967,295.

##### PERIOD and PULSEWIDTH counter modes

When using Period and PulseWidth modes, note that the initial period is dependent upon the frequency of the signal being measured, a signal is required in order to latch data into the register, and the first sample in a scan is always zero, since it is not data that has been latched by the measured signal.