PulseBlaster
Delay Count
The value of the Delay Count field (a 32-bit value) determines how long the current instruction should be
executed. The allowed minimum value of this field is 0x6 for the 32k memory models and 0x2 for the internal-
memory models. The timing controller has a fixed delay of three clock cycles and the value that one enters
into the Delay Count field should account for this inherent delay.
About Spinapi
Spinapi is a control library which allows programs to be written to communicate with the PulseBlaster
board. The most straightforward way to interface with this library is with a C/C++ program, and the API
definitions are described in this context. However, virtually all programming languages and software
environments (including software such as LabView and Matlab) provide mechanisms for accessing the
functionality of standard libraries such as Spinapi.
Please see the example programs for an an explanation of how to use Spinapi. A reference
document for the API is available online at:
http://www.pulseblaster.com/CD/spinapi/spinapi_reference/
Using C Functions to Program the PulseBlaster
A series of functions have been written to control the board and facilitate the construction of pulse
program instructions.
IIn order to use these functions, the DLL (spinapi.dll), the library file (libspinapi.a for mingw, spinapilibgcc
for borland, and spinapi.lib for msvc), the header file (spinapi.h), must be in the working directory of your C
compiler
1
.
int pb_init();
Initializes PulseBlaster board. Needs to be called before calling any functions using the PulseBlaster.
Returns a negative number on an error or 0 on success.
int pb_close();
Releases PulseBlaster board. Needs to be called as last command in pulse program. Returns a
negative number on an error or 0 on success.
void set_clock(double clock_freq);
Used to set the clock frequency of the board. The variable
clock_frequency
is specified in MHz
when no units are entered. Valid units are MHz, kHz, and Hz. The default clock value is 50MHz.
You only need to call this function if you are not using a –50 board.
int start_programming(int device);
Used to initialize the system to receive programming information. It accepts a parameter referencing
the target for the instructions. The only alid value for
device
is PULSE_PROGRAM, It returns a 0 on
success or a negative number on an error.
1
These functions and library files have been generated and tested with MinGW (
www.mingw.com)
, Borland 5.5 (
www.borland.com)
, MS
Visual Studio 2003 (msdn.microsoft.com) compilers.
http://www.spincore.com
5/19/2006
12