
USB-PTS Interface
C/C++ Programming Using SpinAPI
The most dynamic and flexible way to control the frequencies of your PTS is with C/C++ using the
SpinAPI Suite. The GUI based approaches to controlling the board are designed for ease of use
and ha e limited functionality for a specific end-use application. Coding in C/C++ allows for more flexibility in
creating arious, more ad anced, control programs for the PTS. The instructions to compile on Windows can be
found at http://www.spincore.com/support/spinapi/Windows_Help.shtml. After configuring the compiler,
changing one of our example programs and recompiling the executable file for use with your
USB-PTS board is as easy as clicking “Rebuild All”.
To use the SpinAPI add the line #include "spinapi.h" at the top of your program. The function used to
control the parameters of the USB-PTS is:
int set_pts(double maxFreq, int is160, int is3200, int allo Phase,
int noPTS, double frequency, int phase);
Using the set_pts() function you can easily control the PTS by adjusting the frequency and phase
parameters abo e. For more information details for programming in C, consult the example programs which can
be found in Windows “Start” > All Programs > SpinCore > Examples > USB-PTS.
USB-PTS LabVIEW GUI
There are two separate features of the USB-PTS LabVIEW Program - Single Frequency Generation and
Frequency Sweep Generation. To set your PTS to output one gi en frequency, select the Single Frequency
Generation tab, enter in the desired frequency and phase, and press “Set Synthesizer”. To create a frequency
sweep, select the Frequency Sweep Generation tab, set your Starting Frequency, Ending Frequency, Increment,
Phase and Time Delay and press “Run Sweep”. This program will only run through the sweep one time.
Figure 7, on the next page, presents the Graphical Interface of the program. Note that due to inherent
operating system latencies, specified delays in frequency sweeps are not perfectly accurate and delays shorter
than 1 ms are typically not attainable. Also, for frequency sweeps, the GUI interface gi es control to the actual
executable sweep program at run time and the user does not regain control until the sweep has ended.
www.spincore.com 8 2019/12/03
Figure 6: C/C++ Example Compiler Screen shot.