http://www.spincore.com
PulseBlasterESR-PRO-II
VI. Appendix: C Programming with SpinAPI
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. A reference document for the API is available online at:
http://www.spincore.com/CD/spinapi/spinapi_reference/
Using C Functions to Program the PulseBlasterESR-PRO-II
A series of functions have been written to control the board and facilitate the construction of pulses. In
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 appropriately linked. SpinCore offers a
pre-configured compiler package (SpinAPI Tools) that is already set up for easy compilation of new pulse
programs. To download SpinCore's pre-configured compiler package see the link below. If you wish to use
your own compiler, you may look at our SpinAPI compilation instructions document also available at the link
below:
http://www.spincore.com/support/spinapi/
Listed below are the necessary functions that you will need to use to program your PulseBlasterESR-
PRO-II. Be sure to include spinapi.h in your source code in order to use these functions. Note: these
functions are also documented in the SpinAPI Reference Documents available at the previously mentioned
URL.
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.
int pb_outp(unsigned int address, char data)
This function is used to control the board. The
char data
is set to zero for all instructions except for
the last instruction in which
char data
is the byte to be sent. The following chart explains the values
for
unsigned int address
:
2016/08/17
13