# cbSetConfig()

Changes board configuration options at runtime.

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 using this function

## Function prototype

C/C++

int cbSetConfig(int InfoType, int BoardNum, int DevNum, int ConfigItem, int ConfigVal)

Visual Basic

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

## Arguments

InfoType

The configuration information for each board is grouped into different categories. InfoType specifies which category you want. Set it to one of the constants listed in the InfoType argument values section 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 ConfigItems below.

ConfigItem

Specifies which configuration item you wish to set. Set it in conjunction with the InfoType argument using the table under ConfigItem argument values section below.

ConfigVal

The value to set the specified configuration item to.

## Returns

- Error code or 0 if no errors.

### InfoType argument values

InfoType | Description
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

InfoType | ConfigItem | Description
BoardInfo | BIADCHANTYPE | Analog input channel type. Use this setting with devices that have configurable input types. DevNum indicates the channel number. Use this setting in conjunction with one of these ConfigVal settings: AI_CHAN_TYPE_VOLTAGE (Voltage mode, ±60 V, ±15 V, ±4 V, ±1 V, ±1.25 mV) AI_CHAN_TYPE_CURRENT (Current mode, ±25 mA) AI_CHAN_TYPE_RESISTANCE_10K4W (4-wire Resistance mode, 10 kΩ) AI_CHAN_TYPE_RESISTANCE_1K4W (4-wire Resistance mode, 1 kΩ) AI_CHAN_TYPE_RESISTANCE_10K2W (2-wire Resistance mode, 10 kΩ) AI_CHAN_TYPE_RESISTANCE_1K2W (2-wire Resistance mode, 1 kΩ) AI_CHAN_TYPE_TC (Thermocouple mode, ±125 mV) AI_CHAN_TYPE_RTD_1000OHM_4W (4-wire RTD mode, 1000 Ω) AI_CHAN_TYPE_RTD_100OHM_4W (4-wire RTD mode, 100 Ω) AI_CHAN_TYPE_RTD_1000OHM_3W (3-wire RTD mode, 1000 Ω) AI_CHAN_TYPE_RTD_100OHM_3W (3-wire RTD mode, 100 Ω) AI_CHAN_TYPE_QUART_BRIDGE_350OHM (Quarter-bridge mode, 350 Ω) AI_CHAN_TYPE_QUART_BRIDGE_120OHM (Quarter-bridge mode, 120 Ω) AI_CHAN_TYPE_HALF_BRIDGE (Half-bridge mode, 500 mV/V) AI_CHAN_TYPE_FULL_BRIDGE_62PT5mVV (Full-bridge mode, ±62.5 mV/V) AI_CHAN_TYPE_FULL_BRIDGE_7PT8mVV (Full-bridge mode, ±7.8 mV/V)
BIADCSETTLETIME | ADC settling time. DevNum is ignored. Use this setting in conjunction with one of these ConfigVal settings: SETTLE_DEFAULT SETTLE_1us SETTLE_5us SETTLE_10us SETTLE_1ms
BIADDATARATE | A/D data rate. DevNum indicates the channel number.
BIADTIMINGMODE | ADC timing mode. DevNum is ignored. Use this setting in conjunction with one of these ConfigVal settings: 1 (High Speed) 8 (60 Hz rejection) 9 (50 Hz rejection) 15 (High resolution)
BIADTRIGCOUNT | ADC trigger count. DevNum is ignored. For use with the cbAInScan()/AInScan() RETRIGMODE option to set up repetitive trigger events.
BIADTRIGSRC | A/D trigger source. DevNum indicates the channel number. Use this setting in conjunction with one of these ConfigVal settings: 0 1 2 3
BIADXFERMODE | Sets the data transfer mode to either kernel mode (default) or user mode. DevNum is ignored. Use this setting in conjunction with one of these ConfigVal settings: XFER_KERNEL XFER_USER
BIBASEADR | Base address of the device. DevNum is ignored.
BICALTABLETYPE | Coefficients table used for calibration. DevNum is ignored. Use this setting in conjunction with one of these ConfigVal settings: CAL_TABLE_FACTORY CAL_TABLE_FIELD
BICALOUTPUT | Cal pin voltage on supported USB devices. DevNum is ignored.
BICHANRTDTYPE | RTD sensor type. DevNum indicates the channel number. Use this setting in conjunction with one of these ConfigVal settings: RTD_PT_3750 RTD_PT_3850 RTD_PT_3851 RTD_PT_3911 RTD_PT_3916 RTD_PT_3920 RTD_PT_3928 Custom
BICHANTCTYPE | Thermocouple sensor type. DevNum indicates the channel number. Use this setting in conjunction with one of these ConfigVal settings: TC_TYPE_J TC_TYPE_K TC_TYPE_S TC_TYPE_R TC_TYPE_B TC_TYPE_E TC_TYPE_T TC_TYPE_N
BICLOCK | Clock frequency in megahertz (MHz) – 1, 4, 6 or 10. DevNum indicates the channel number.
BICTRTRIGCOUNT | Number of counter samples to acquire per trigger. DevNum is ignored. For use with the cbCInScan() RETRIGMODE option to set up repetitive trigger events.
BIDACFORCESENSE | Enables or disables remote sensing of an analog output channel. DevNum indicates the channel number. ConfigItem is ENABLED OR DISABLED.
BIDACSTARTUP | Configuration register STARTUP bit setting. DevNum is ignored. Set to 0 or 1 to enable/disable the storing of digital-to-analog converter (DAC) startup values. Current or last stored values are written to the DACs each time the board is powered up. Refer to the "Notes" section below for additional information about using the BIDACSTARTUP option.
BIDACRANGE | D/A range code. DevNum indicates the channel number. Refer to board-specific information for a list of the supported ranges.
BIDACTRIGCOUNT | DAC trigger count. DevNum is ignored. For use with the cbAOutScan()/AOutScan() RETRIGMODE option to set up repetitive trigger events.
BIDACUPDATECMD | Updates all analog output channels. DevNum and ConfigVal are not used and can be set to 0. Refer to the "Notes" section below for more information.
BIDACUPDATEMODE | Update mode for a digital-to-analog converter (DAC). DevNum is ignored. Use this setting in conjunction with one of these ConfigVal settings: UPDATEIMMEDIATE UPDATEONCOMMAND Refer to the "Notes" section below for more information.
BIDACSETTLETIME | DAC settling time. DevNum is ignored.
BIDETECTOPENTC | Open thermocouple detection setting. 0 = disable, 1 = enable. DevNum is either ignored or specifies a base or expansion board; refer to device-specific information.
BIDIDEBOUNCESTATE | State of the digital inputs when debounce timing is set. DevNum is ignored.
BIDIDEBOUNCETIME | Debounce time of digital inputs. DevNum is ignored.
BIDISOFILTER | AC filter setting. 0 = disable, 1 = enable. DevNum is the bit number.
BIDITRIGCOUNT | Number of digital input samples to acquire per trigger. DevNum is ignored.
BIDMACHAN | DMA channel. DevNum is ignored.
BIDOTRIGCOUNT | Number of digital output samples to generate per trigger. DevNum is ignored.
BIEXTCLKTYPE | External clock type. DevNum is ignored. Use this setting in conjunction with one of these ConfigVal settings: CONTINUOUS_CLK GATED_CLK
BIEXTINPACEREDGE | The input pacer clock edge. DevNum is ignored. Use this setting in conjunction with one of these ConfigVal settings: EXT_PACER_EDGE_RISING EXT_PACER_EDGE_FALLING
BIEXTOUTPACEREDGE | The output pacer clock edge. DevNum is ignored. Use this setting in conjunction with one of these ConfigVal settings: EXT_PACER_EDGE_RISING EXT_PACER_EDGE_FALLING
BIINPUTPACEROUT | Input pacer clock output enable/disable setting. DevNum is ignored. When enabled, the input clock is set for output.
BIINTEDGE | Interrupt edge. 0 = rising, 1 = falling. DevNum is ignored.
BIINTLEVEL | Interrupt level. DevNum is ignored.
BIHIDELOGINDLG | Enables or disables the Device Login dialog. DevNum is ignored. Set to a nonzero value to disable the dialog. When disabled, the cbDeviceLogin() function must be used to log in to a device session.
BINETCONNECTIONCODE | 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.
BIOUTPUTPACEROUT | Enables or disables the output pacer clock signal. When enabled, the output clock is set for output.
BIPANID | The Personal Area Network (PAN) identifier set for a USB device that supports wireless communication. DevNum is ignored.
BIPATTERNTRIGPORT | The pattern trigger port. DevNum is ignored. Use this setting in conjunction with one of these ConfigVal settings: AUXPORT0 (default) AUXPORT1
BIRANGE | The selected voltage range. Refer to board-specific information for the ranges supported by a device. DevNum is ignored.
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 | User-configured identifier of a supported USB device. DevNum is ignored.
BISRCADPACER | Outputs the A/D pacer signal to the SYNC pin on supported USB devices. Deprecated; unless your application calls deprecated methods, use BIINPUTPACEROUT.
BISYNCMODE | The simultaneous mode setting. 0 = master, 1 = slave.
BITEMPAVG | Number of samples per average. Use this setting in conjunction with one of these ConfigVal settings: 1 to 16384 (if the BITEMPREJFREQ rejection frequency is off (0) 16 to 16384 (if the BITEMPREJFREQ rejection frequency is on (50 or 60) When specified, multiple readings are acquired, averaged, and converted to temperature.
BITEMPSCALE | Temperature scale. DevNum is ignored. Use this setting in conjunction with one of these ConfigVal settings: CELSIUS FAHRENHEIT KELVIN
BITEMPREJFREQ | Rejection frequency. Use this setting in conjunction with these settings: DevNum: 0 (base board) 1 (expansion board) ConfigVal: 0 (off) 50 (50 Hz noise rejection) 60 (60 Hz noise rejection)
BITERMCOUNTSTATBIT | Terminal count output status. DevNum indicates the bit number. 0 = enabled, 1 = disabled.
BIWAITSTATE | Wait State jumper setting. 0 = disable, 1 = enable.
DIGITALINFO | DIDISABLEDIRCHECK | The direction check setting for a specified port or bit when calling cbDOut(), cbDBitOut(), and cbDOutArray(). Use this setting in conjunction with one of these ConfigVal settings: 0 (enables the direction check) 1 (disables the direction check)
EXPANSIONINFO | XIMUXADCHAN1 | First A/D channel connected to the board
XIMUXADCHAN2 | Second A/D channel connected to the 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 channel.
XITHERMTYPE | Thermocouple type.

## Notes

- Use the ConfigItem option BIDACSTARTUP to store either the current DAC values or the DAC values before the board was last powered down.
- To store the current DAC values as start-up values, call cbSetConfig() with BIDACSTARTUP set to 1. Then, call cbAOut() or cbAOutScan() for each channel (), and call cbSetConfig() again with BIDACSTARTUP set to 0.
- Example:

cbSetConfig(BOARDINFO, boardNumber, 0, BIDACSTARTUP, 1);

for (int i=1; i <8; i++)

{

cbAOut(boardNumber, i, BIP5VOLTS, DACValue[i]);

}

cbSetConfig(BOARDINFO, boardNumber, 0, BIDACSTARTUP, 0);

- To store the DAC's last settings, call cbSetConfig() with a BIDACSTARTUP value of 1. Leave this bit turned on until the application exits. The next time the board is powered up, it restores the values last written to the DACs.

- Use the BIDACUPDATEMODE option to set the update mode for a DAC board.
- With ConfigItem set to BIDACUPDATEMODE and ConfigVal set to 0, the DAC update mode is immediate. Values written with cbAOut() or cbAOutScan() are automatically output by the DAC channels.
- With ConfigItem set to BIDACUPDATEMODE and ConfigVal set to 1, the DAC update mode is on command. Values written with cbAOut() or cbAOutScan() are not output by the DAC channels until another cbSetConfig() call is made with ConfigItem set to BIDACUPDATECMD.