Text Programming Support

By having only one driver library for all Spectrum hardware and a common function set, programming is simplified and made universal for all hardware card series; M2p, M2i, M3i, M4i, M4x, and all NETBOX systems, be it signal for capture or generation. Whilst different hardware may require different functions from this set, the overall common command structure remains essentially the same for different languages. This common format of programming also makes it possible to support the widest range of operating platforms. Here is a summary of that support showing the link between the common library and the individual operating system kernel drivers:-

code_driver_structure block diagram

The big advantage of programming in text code is its flexibility to best match the requirement of application and the minimal loading on the computer system (hence best speed), even in the operation of large code routines. This will be well understood by experienced code programmers. Below is an example written in C++ for communication with a signal acquisition (A/D) board, with no checking implemented here for simplicity. It provides for a set up of the hardware, a capture, then reading out of the data into an array.

int32 lMemsize = 16384; // recording length is set to 16 kSamples
spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, CHANNEL0); // only one channel activated
spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_STD_SINGLE); // set the standard single recording mode
spcm_dwSetParam_i32 (hDrv, SPC_MEMSIZE, lMemsize); // recording length
spcm_dwSetParam_i32 (hDrv, SPC_POSTTRIGGER, 8192); // samples to acquire after trigger = 8k
// now we start the acquisition and wait for the interrupt that signalizes the end
void* pvData = new int16[lMemsize];
// read out the data
spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC , 0, pvData, 0, 2 * lMemsize);

For further details on code programming please contact Dataquest Solutions or look to the programming detail in the hardware manuals. These manuals are available in PDF format on this Web site in the pages relating to particular hardware.

To download the latest code drivers and programming examples for all Spectrum boards and the digitizerNETBOX, please go to the manufacturers Web site at:

Spectrum drivers for MATLAB

Spectrum offers MATLAB 32 and 64 bit drivers. The drivers consist of:-

  • A set of DLL's for linking together MATLAB to the standard Spectrum hardware driver.
  • The interface also offers an easy way to use the Spectrum cards with Mathworks Simulink, simulation tool.
  • M-file examples to show the use of the driver with many of the hardware functions. Each may be used as a base for further programming
The drivers work with Mathworks Inc. MATLAB versions starting with version 7.7 (R2008b). All 32 Bit and 64 Bit versions for Windows and all 64 Bit versions for Linux are supported.


Spectrum hardware drivers for LabWindowsCVI

Sitting part way between text and graphical programming LabWindows/CVI provides the flexibility of code, having an integrated ANSI C environment, but also generates code automatically from the user placed controls, displays etc. A wide range of analysis and interface tools makes this an ideal tool for those with C coding experience who require a faster developers interface for complex testing and measuring systems. The LabWindows/CVI Interface Editor provides an easy way to develop intuitive front panels to reflect the status of PC instruments with function panels associated with all Spectrum hardware function calls and so providing a graphical dialog showing parameters / settings.

We have no driver libraries specific to LabWindowsCVI, however you can use Spectrum's standard driver for programming in C/C++ and use the text code examples to have access to all the hardware's functions and modes, be it a digitiser, digital I/O or waveform generator card and help understand their operation.

DataQuest Solutions Ltd. | Phone: 01526 557171 | Email: info@dqsolutions.co.uk