The GUI is well suited when the HVPS is used in stand alone mode. However, it is often desirable to integrate the power supply with other instruments, such as a data acquisition system. The HVPS is designed for easy integration into more complex setups. All of the HVPS functionalities are accessible through simple plain text commands sent via a serial connection through a USB cable. This allows using the power supply with any programming language.
There are different ways to send commands to the HVPS, which are described below
We provide a LabVIEW library with VIs allowing to access the HVPS main functions. It is important to select the library version that corresponds to the firmware loaded on the HVPS. The following table shows which interface version corresponds to which firmware. The library version has the same number as the graphic user interface.
|SHVPS firmware||MHVPS firmware||GUI||PCB||Version summary|
|8||1.4||2.8||v4b2, v4b3||python interface. Standalone version with battery.|
|7||1.3||2.7, 2.7.1||v4b2, v4b3||Initial release of the PetapicoVoltron project|
The library is the file HVPS_functions.lvlibp that you can find on the download page. This pre-compiled library works with LabVIEW 2015 (other versions will follow) on MS Windows (not on OSX). For other systems, you can use the source code of the interface, which includes the library (on the download page).
The library is separated in two groups of functions: a) the main functions, and b) some support VIs, the latter being mainly secondary functions that are not useful for the ordinary user. All of the main functions have file name that describe their functionality and have clear documentation on what they do, what are the required inputs, and what are the outputs. The first line of the context help of each function is a bold text being either S/M, S, or M. It indicates whether this function applied to single channel HVPS (S) or multi-channel HVPS (M). Some of the functions that apply to both S and M versions have an input named channel. If you are using a SHVPS this input has no effect and should be left unconnected.
The easiest way to use the library is to place the file HVPS_functions.lvlibp in your instr.lib or user.lib folder which then automatically adds the group of functions to the Instrument Drivers or User Libraries palettes respectively. These two folders are in your LabVIEW installation directory, most likely C:\Program Files (x86)\National Instruments\LabVIEW 20xx.
The following image shows the main function palette for a SHVPS, when the library is located in the user.lib directory.
Only the main functions are included to the palette so as not to clutter it. To access the support functions, add them from the project manager window, after adding the library to your project.
Functions usually start with either Set_ or Query_ to respectively set the value of a parameter, or query the current value of this parameter. Note that Set_ functions are in fact “set and query” as they also return the new value of the parameter as understood by the HVPS.
A program must start with the Open function, whose input is the name of the serial port to which the HVPS is connected. This VI initiates the communication with the HVPS, sets the mode to on-DC, and sets the output voltage to 0V. It returns a cluster with a handle to the HVPS, and useful information about the unit (such as the board voltage rating). The cluster is then used as input to all the other sub functions. If the HVPS cannot be initialized, it will return an error. If no error is returned (the HVPS has been correctly initialized), the High Voltage enable switch can be safely placed in the “on” position, because the initialization VI imposes an output voltage of 0V.
After the initialization, you can chain as many functions as you need to perform your tasks.
Your program should end with the Close function. This will set the output voltage to 0V, and close the serial link.
It is important to use the open function only once at the beginning of your program, and close at the end, and not have a series of open-“some functions”-close. This for two reasons: 1) the open command involve some information transfer between the HVPS and the computer. This takes some time and would slow down the program. 2) the open commands resets the box in a starting state (Voltage to 0, DC mode, etc.) so you would cancel all of your previous settings.
The following image (click to enlarge) shows a program example with an event structure. The HVPS is initialised, using the com port number to which it is attached (COM4 in this example). When the user modifies the value in the control Vset in, this value is sent to the HVPS (left). In the absence of input from the user, the HVPS output voltage is queried every 500ms and shown on the indicator Vout. When the user presses the stop button, the communication with the unit is closed and the program ends.
2 Using a programming language of your choice
You can use any language that has libraries to send/receive commands on a serial port (Matlab, Processing, C, etc.). The settings you need to use for the serial communication are:
- COM port to the correct port name corresponding to the HVPS
- Bits per second: 115200
- Data bits: 8
- Parity: None
- Stop Bits: 1
- Flow Control: None
You need to end each command you send to the HVPS by a carriage return (0x0D).
The list of commands that you can send to the HVPS once you have established communication is given on this page.