# cbAConvertData()

Converts the raw data collected by cbAInScan() into 12-bit A/D values. The cbAInScan() function can return either raw A/D data or converted data, depending on whether or not the CONVERTDATA option is used. For many 12-bit A/D boards, the raw data is a 16-bit value that contains a 12-bit A/D value and a 4 bit channel tag (refer to board-specific information in the Universal Library User's Guide). The data returned to ADData consists of just the 12-bit A/D value. The data returned to ChanTags consists of just the channel numbers.

## Function Prototype

C/C++

int cbAConvertData(int BoardNum, long NumPoints, unsigned short ADData[], unsigned short ChanTags[])

Visual Basic

Function cbAConvertData(ByVal BoardNum&, ByVal NumPoints&, ADData%, ChanTags%) 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.

NumPoints

Number of samples to convert.

ADData

Pointer or reference to start of data array.

ChanTags

Pointer or reference to the start of the channel tag array.

When collecting data using cbAInScan() without the CONVERTDATA option, use this function to convert the data after it has been collected. There are cases where the CONVERTDATA option is not allowed. For example - if you are using both the DMAIO and BACKGROUND option with cbAInScan() on some devices, the CONVERTDATA option is not allowed. In those cases this function should be used to convert the data after the data collection is complete.

For some boards, each raw data point consists of a 12-bit A/D value with a 4-bit channel number. This function pulls each data point apart and puts the A/D value into the ADData array and the channel number into the ChanTags array.

## Returns

- Error code or 0 if no errors
- ADData - converted data
- ChanTags - channel tags, if available

## Notes

- 12-bit A/D Boards
- The name of the array must match that used in cbAInScan() or cbWinBufToArray().
- Upon returning from cbAConvertData(), ADData array contains only 12-bit A/D data.

- 16-bit A/D Boards
- This function is not for use with 16-bit A/D boards because 16-bit boards do not have channel tags.