User`s guide
Universal Library User's Guide Universal Library Description and Use
16
Error handling
Most library functions return an error code. If no errors occurred during a library call, 0 (or NOERRORS) is
returned as the error code. Otherwise, it is set to one of the codes listed in the Universal Library Function
Reference "Error Codes" chapter. This document is available on our web site at
www.mccdaq.com/PDFmanuals/sm-ul-functions.pdf.
If a non-zero error code is returned, you can use cbGetErrMsg() to convert the error code to a specific error
message. As an alternative to checking the error code after each function call, you can turn on the library's
internal error handling with cbErrHandling().
16-bit values using a signed integer data type
When using functions that require 16-bit values, the data is normally in the range of 0 to 65535. However,
some programming languages such as Visual Basic only provide signed data types. When using signed
integers, reading values above (32767) can be confusing.
The number (32767) in decimal is equivalent to (0111 1111 1111 1111) binary. The next increment (1000
0000 0000 0000) binary has a decimal value of (-32768). The maximum value (1111 1111 1111 1111)
binary translates to (-1) decimal. Keep this in mind if you are using Visual Basic (up to version 6) or other
languages that don‘t support unsigned integers.
There is additional information on this topic in the Universal Library Function Reference. This document is
available on our web site at www.mccdaq.com/PDFmanuals/sm-ul-functions.pdf. Also, refer to the
documentation supplied with your language compiler.
Using the Universal Library in Windows
All 32-bit applications (including console applications) access the 32-bit Windows Dynamic Link Library
(DLL) version of the Universal Library (CBW32.DLL). Example programs that illustrate the use of
CBW32.DLLs are provided for each supported language.
The Universal Library contains four functions for managing Windows global memory buffers:
cbWinBufAlloc()
cbWinBufFree()
cbWinArrayToBuf()
cbWinBufToArray()
Real-time acquisition under Windows
Real-time acquisition is available for Windows. To operate at full speed in Windows, the A/D board must
have an onboard FIFO buffer. All of our advanced designs have FIFO buffers, including our PCI-DAS boards
(except for the PCI-DAS08), and many of our CIO- boards, such as the CIO-DAS80x, CIO-DAS160x, CIO-
DAS140x, and CIO-DAS16/330x. All of these data acquisition boards will operate at full speed in Windows.
Applying software calibration factors in real time on a per-sample basis eats up machine cycles. If your CPU
is slow, or if processing time is at a premium, withhold calibration until after the acquisition run is complete.
Turning off real-time software calibration saves CPU time during a high speed acquisition run.
Processor speed
Processor speed remains a factor for DMA transfers and for real-time software calibration. Processors of less
than a 150 megahertz (MHz) Pentium class may impose speed limits below the capability of the board (refer
to specific board information.)