|By having only one driver library for all Spectrum hardware and a common function set,
programming is simplified and made universal for all hardware, M2i, M3i, M4i, M4x,
digitizerNETBOX and so on, 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:-
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
spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY);
void* pvData = new int16[lMemsize];
// read out the data
spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC , 0, pvData, 0, 2 * lMemsize);
spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA
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:
To access the Spectrum driver functions under CVI it is necessary to first load the functions from the driver dll. This dll (spcm_win32_cvi.lib) is included on the standard driver CD shipped with the hardware, as are examples in the directory; /spcm_examples/cvi. Please mix these with the the standard C/C++ examples (also provided) to have access to all functions and modes.
|DataQuest Solutions Ltd. | Phone: 01526 557171 | Email: firstname.lastname@example.org|
The registered trademark Linux® is used pursuant to a sublicense from LMI,
the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis.
Windows, 2000 / XP / 7 / 8 / 10 and Excel are trademarks or registered trademarks of the Microsoft Corporation
LabWindows/CVI is a trademark of the National Instruments Corporation
MATLAB is a trademark of the MathWorks Corporation
© Dataquest Solutions 12.07.03 modified 20.01.17
Images courtesy of Spectrum GmbH