# cbGetConfig()

Returns a configuration option currently set for a board. By default, the configuration settings are loaded from the cb.cfg file created by InstaCal. If cbIgnoreInstaCal() is called first, the configuration settings will be the default values for the board in use. For either case, you can change the current configuration within a running program with the cbSetConfig() function.

## Function Prototype

C/C++

int cbGetConfig(int InfoType, int BoardNum, int DevNum, int ConfigItem, int *ConfigVal)

Visual Basic

Function cbGetConfig(ByVal InfoType&, ByVal BoardNum&, ByVal DevNum&, ByVal ConfigItem&, ConfigVal&) As Long

## Arguments

InfoType

The configuration information for each board is grouped into different categories. This argument specifies which category you want. Set it to one of the constants listed in the "InfoType argument values" below.

BoardNum

The number associated with the board when it was installed with InstaCal or created with cbCreateDaqDevice(). BoardNum may be 0 to 99.

DevNum

The purpose of the DevNum argument depends on the ConfigItem being passed. It can serve as a channel number, an index into the ConfigItem, or it can be ignored. See specific ConfigItem values below.

ConfigItem

Specifies which configuration item you wish to retrieve. Set it in conjunction with the InfoType argument using one of the constants listed in the "ConfigItem argument values" below.

ConfigVal

The specified configuration item is returned to this variable.

## Returns

- Error code or 0 if no errors.
- ConfigVal - returns the value of the specified configuration item here.

### InfoType argument values

InfoType | Description
GLOBALINFO | Information about the configuration file.
BOARDINFO | General information about a board.
DIGITALINFO | Information about a digital device.
COUNTERINFO | Information about a counter device.
EXPANSIONINFO | Information about an expansion device.
MISCINFO | One of the miscellaneous options for the board.

### ConfigItem argument values

Valid ConfigItem constant settings for each InfoType constant are as follows:

InfoType | ConfigItem | Description
GlobalInfo | GIVERSION | cb.cfg file format; used by the library to determine compatibility. DevNum is ignored.
GINUMBOARDS | Maximum number of boards that can be installed. DevNum is ignored.
GINUMEXPBOARDS | Maximum number of expansion boards that can be installed. DevNum is ignored.
BOARDINFO | BIADAIMODE | Analog input mode. DevNum is ignored.
BIADCHANAIMODE | Analog input mode. DevNum indicates the channel number.
BIADCHANTYPE | Analog input channel type. Use this setting with devices that have configurable input types. DevNum indicates the channel number.
BIADCSETTLETIME | ADC settling time. DevNum is ignored.
BIADDATARATE | A/D data rate. DevNum indicates the channel number.
BIADRES | A/D resolution. DevNum is ignored.
BIADXFERMODE | Data transfer mode. DevNum is ignored.
BIADTIMINGMODE | Timing mode. DevNum is ignored.
BIADTRIGCOUNT | Number of analog input samples to acquire per trigger. DevNum is ignored.
BIADTRIGSRC | A/D trigger source. DevNum indicates the channel number.
BIBASEADR | Base address of the device. DevNum is ignored.
BIBOARDTYPE | Unique number from 0 to 8000 Hex which describes the type of board installed. DevNum is ignored.
BICALTABLETYPE | The coefficients table used for calibration. 0 = Factory, 1 = Field. DevNum is either ignored or specifies a base or expansion board.
BICHANRTDTYPE | RTD sensor type. DevNum indicates the channel number.
BICHANTCTYPE | Thermocouple sensor type. DevNum indicates the channel number.
BICINUMDEVS | Number of counter devices. DevNum is ignored.
BICLOCK | Clock frequency in megahertz (MHz) (40, 10, 8, 6, 5, 4, 3, 2, 1) or 0 for not supported. DevNum is ignored.
BICTRTRIGCOUNT | Number of counter samples to acquire per trigger. DevNum is ignored.
BIDACFORCESENSE | Remote sensing state of an analog output channel (ENABLED or DISABLED.) DevNum indicates the channel number.
BIDACRANGE | Analog output voltage range. DevNum is ignored.
BIDACRES | D/A resolution. DevNum is ignored.
BIDACSTARTUP | Configuration register STARTUP bit setting. DevNum indicates the channel number. Refer to the Notes section below for additional information about using the BIDACSTARTUP option.
BIDACTRIGCOUNT | Number of analog output samples to acquire per trigger. DevNum is ignored.
BIDACUPDATEMODE | Update mode for a digital-to-analog converter (DAC). DevNum is ignored. Refer to the Notes section below for more information.
BIDETECTOPENTC | Open thermocouple detection setting. 0 = disabled, 1 = enabled. DevNum is either ignored or specifies a base or expansion board; refer to device-specific information.
BIDINUMDEVS | Number of digital devices. DevNum is ignored.
BIDISOFILTER | AC filter setting. 0 = disabled, 1 = enabled. DevNum is the bit number.
BIDITRIGCOUNT | Number of digital input samples to acquire per trigger. DevNum is ignored.
BIDMACHAN | DMA channel — 0, 1, or 3. DevNum is ignored.
BIDOTRIGCOUNT | Number of digital output samples to generate per trigger. DevNum is ignored.
BIDTBOARD | Board number of the connected DT board. DevNum is ignored.
BIEXTCLKTYPE | External clock type. DevNum is ignored.
BIEXTINPACEREDGE | Input scan clock edge. DevNum is ignored.
BIEXTOUTPACEREDGE | Output scan clock edge. DevNum is ignored.
BIINPUTPACEROUT | Input pacer clock state. DevNum is ignored.
BIINTEDGE | Interrupt edge. 0 = rising, 1 = falling. DevNum is ignored.
BIINTLEVEL | Interrupt level. 0 for none, or 1 to 15. DevNum is ignored.
BINETCONNECTCODE | Code used to connect with a device over a network connection. DevNum is ignored.
BINETIOTIMEOUT | Amount of time (in milliseconds) to wait for a WEB device to acknowledge a command or query sent to the device over a network connection. If no acknowledgement is received in this time a timeout occurs. DevNum is ignored.
BINUMADCHANS | Number of A/D channels DevNum is ignored.
BINUMDACHANS | Number of D/A channels. DevNum is ignored.
BINUMIOPORTS | Number of I/O ports used by the device. DevNum is ignored.
BINUMTEMPCHANS | Number of temperature channels. DevNum is ignored.
BIPANID | Personal Area Network (PAN) identifier for a USB device that supports wireless communication. DevNum is ignored.
BIPATTERNTRIGPORT | Pattern trigger port. DevNum is ignored.
BIRANGE | Selected voltage range. DevNum is ignored. For switch selectable gains only. If the selected A/D board does not have a programmable gain feature, this argument returns the range as defined by the install settings.
BIRFCHANNEL | RF channel number used to transmit/receive data by a USB device that supports wireless communication. DevNum is ignored.
BIRSS | Received signal strength in dBm of a remote device. DevNum is ignored.
BISERIALNUM | Custom serial number assigned by a user to a USB device. To retrieve the factory serial number, use cbGetConfigString() with BIDEVUNIQUEID. DevNum is ignored.
BISYNCMODE | Simultaneous mode setting. 0 = master, 1 = slave. DevNum is ignored.
BITEMPAVG | Number of temperature samples per average. DevNum is ignored.
BITEMPSCALE | Temperature scale. DevNum is ignored.
BITEMPREJFREQ | Temperature rejection frequency. DevNum is either ignored or specifies a base or expansion board.
BITERMCOUNTSTATBIT | Terminal count output status for a specified bit. DevNum indicates the bit number. 0 = enabled, 1 = disabled.
BIWAITSTATE | Wait State jumper setting. 0 = disabled, 1 = enabled. DevNum is ignored.
BIUSESEXPS | Expansion board support. TRUE/FALSE value is returned. DevNum is ignored.
BIUSERDEVIDNUM | User-configured string that identifies a USB device. DevNum is ignored.
DIGITALINFO | DIDEVTYPE | Device Type – AUXPORT, FIRSTPORTA, and so on. DevNum indicates a zero-based index that specifies the device.
DICONFIG | Current configuration INPUT or OUTPUT. DevNum indicates a zero-based index that specifies the device.
DINUMBITS | Number of bits in the port. DevNum indicates a zero-based index that specifies the device.
DICURVAL | Current value of outputs. DevNum indicates a zero-based index that specifies the device.
DIDISABLEDIRCHECK | The direction check setting for a specified port or bit when calling cbDOut(), cbDBitOut(), and cbDOutArray(). 0 = enabled, 1 = disabled.
DIINMASK | Bit configuration of the specified port. Any bits that return a value of 1 are configured for input. Refer to the Notes section below for additional information about using the DIINMASK option. DevNum indicates a zero-based index that specifies the device.
DIOUTMASK | Bit configuration of the specified port. Any bits that return a value of 1 are configured for output. Refer to the Notes section below for additional information about using the DIOUTMASK option. DevNum indicates a zero-based index that specifies the device.
COUNTERINFO | CICTRNUM | Counter number; indicated by DevNum.
CICTRTYPE | Counter type, where: 1 = 8254, 2 = 9513, 3 = 8536, 4 = 7266, 5 = event counter, 6 = scan counter, 7 = timer counter, 8 = quadrature counter, and 9 = pulse counter. DevNum indicates a zero-based index that specifies the device.
EXPANSIONINFO | XIBOARDTYPE | Board type (refer to the "Measurement Computing Device IDs topic in the Universal Library User's Guide)
XIMUXADCHAN1 | First A/D channel connected to the EXP board.
XIMUXADCHAN2 | Second A/D channel connected to the EXP board.
XIRANGE1 | Range (gain) of the low 16 channels.
XIRANGE2 | Range (gain) of the high 16 channels.
XICJCCHAN | A/D channel connected to the CJC.
XITHERMTYPE | Sensor type. Use one of the sensor types listed below: 1 = J 2 = K 3 = T 4 = E 5 = R 6 = S 7 = B 257 = Platinum .00392 258 = Platinum .00391 259 = Platinum .00385 260 = Copper .00427 261 = Nickel/Iron .00581 262 = Nickel/Iron .00527
XINUMEXPCHANS | Number of channels on the expansion board. DevNum is ignored.
XIPARENTBOARD | Board number of the base A/D board. DevNum is ignored.

## Notes

- Use the BIDACSTARTUP option to determine whether a board's DAC values before the last power down are stored.
- With ConfigItem set to BIDACSTARTUP, Configval returns 0 when the startup bit is disabled. Current DAC settings are stored as startup values.
- ConfigVal returns 1 when the startup bit is enabled. The last DAC values are stored as startup values.
- Refer to the cbSetConfig() Notes section for information about how to store the current or last DAC values as start-up values.
- Use the BIDACUPDATEMODE option to check the update mode for a DAC board.
- With ConfigItem set to BIDACUPDATEMODE, ConfigVal returns 0 when the DAC update mode is immediate. Values written with cbAOut() are automatically output by the DAC channels.
- ConfigVal returns 1 when the DAC update mode is set to on command. Values written with cbAOut() are not output by the DAC channels until a cbSetConfig() call is made with its ConfigItem argument set to BIDACUPDATECMD.
- Use the DIINMASK and DIOUTMASK options to determine if an AUXPORT is configurable. Execute cbGetConfig() twice to the same port – once using DIINMASK and once using DIOUTMASK. If both of the ConfigValue arguments returned have input and output bits that overlap, the port is not configurable.
- You can determine overlapping bits by Anding both arguments.
- Example: for a device with seven bits of digital I/O (four outputs and three inputs), the ConfigValue returned by DIINMASK is always 7 (0000 0111), while the ConfigValue argument returned by DIOUTMASK is always 15 (0000 1111). When you And both ConfigValue arguments together, you get a non-zero number (7). Any non-zero number indicates that input and output bits overlap for the specified port, and the port is a non-configurable AUXPORT.