Software
C/C++ Driver Interface
(c) Spectrum GmbH
43
Header files
The basic task before using the driver is to include the header files that are delivered on CD together with the board. The header files are
found in the directory /Driver/header_c. Please don’t change them in any way because they are updated with each new driver version to
include the new registers and new functionality.
Example for including the header files:
Please always keep the order of including the four Spectrum header files. Otherwise some or all of the func-
tions do not work properly on compiling your program will be impossible!
General Information on Windows 64 bit drivers
After installation of the Spectrum 64 bit driver there are two general ways to access the hardware and to de-
velop applications. If you’re going to develop a real 64 bit application it is necessary to access the 64 bit
driver dll (spcm_win64.dll) as only this driver dll is supporting the full 64 bit address range.
But it is still possible to run 32 bit applications or to develop 32 bit applications even under Windows 64 bit.
Therefore the 32 bit driver dll (spcm_win32.dll) is also installed in the system. The Spectrum SBench5 software
is for example running under Windows 64 bit using this driver. The 32 bit dll of course only offers the 32 bit
address range and is therefore limited to access only 4 GByte of memory. Beneath both drivers the 64 bit ker-
nel driver is running.
Mixing of 64 bit application with 32 bit dll or vice versa is not possible.
Microsoft Visual C++ 6.0 and 2005 32 Bit
Include Driver
The driver files can be directly included in Microsoft C++ by simply using the library file spcm_win32_msvcpp.lib that is delivered together
with the drivers. The library file can be found on the CD in the path /examples/c_cpp/c_header. Please include the library file in your Visual
C++ project as shown in the examples. All functions described below are now available in your program.
Examples
Examples can be found on CD in the path /examples/c_cpp. This directory includes a number of different examples that can be used with
any card of the same type (e.g. A/D acquisition cards, D/A acquisition cards). You may use these examples as a base for own programming
and modify them as you like. The example directories contain a running workspace file for Microsoft Visual C++ 6.0 (*.dsw) as well as project
files for Microsoft Visual Studio 2005 (*.vcproj) that can be directly loaded and compiled.
There are also some more board type independent examples in separate subdirectory. These examples show different aspects of the cards
like programming options or synchronization and can be combined with one of the board type specific examples.
As the examples are build for a card class there are some checking routines and differentiation between cards families. Differentiation aspects
can be number of channels, data width, maximum speed or other details. It is recommended to change the examples matching your card
type to obtain maximum performance. Please be informed that the examples are made for easy understanding and simple showing of one
aspect of programming. Most of the examples are not optimized for maximum throughput or repetition rates.
Microsoft Visual C++ 64 Bit
Depending on your version of the Visual Studio suite it may be necessary to install some additional 64 bit components (SDK) on your system.
Please follow the instructions found on the MSDN for further information.
Include Driver
The driver files can be directly included in Microsoft C++ by simply using the library file spcm_win64_msvcpp.lib that is delivered together
with the drivers. The library file can be found on the CD in the path /examples/c_cpp/c_header. All functions described below are now
available in your program.
dlltyp.h
Includes the platform specific definitions for data types and function declarations. All data types are based on this definitions. The use of this type definition file
allows the use of examples and programs on different platforms without changes to the program source. The header file supports Microsoft Visual C++, Bor-
land C++ Builder and GNU C/C++ directly. When using other compilers it might be necessary to make a copy of this file and change the data types accord-
ing to this compiler.
regs.h
Defines all registers and commands which are used in the Spectrum driver for the different boards. The registers a board uses are described in the board spe-
cific part of the documentation. This header file is common for all cards. Therefore this file also contains a huge number of registers used on other card types
than the one described in this manual. Please stick to the manual to see which registers are valid for your type of card.
spcm_drv.h
Defines the functions of the used SpcM driver. All definitions are taken from the file dlltyp.h. The functions itself are described below.
spcerr.h
Contains all error codes used with the Spectrum driver. All error codes that can be given back by any of the driver functions are also described here shortly all.
The error codes and their meaning are described in detail in the appendix of this manual.
// ----- driver includes -----
#include "dlltyp.h" // 1st include
#include "regs.h" // 2nd include
#include "spcerr.h" // 3rd include
#include "spcm_drv.h" // 4th include