Skip to content

LabVIEW control of the PLM

uButaite edited this page Nov 8, 2024 · 4 revisions

This page explains how to control the PLM using LabVIEW. Page under construction.

Example code

An example of how to set up and control the PLM with LabVIEW can be found in plm_example.vi - you can use this code and the associated sub-VIs as a starting point for your own application.

The sub-VIs that look like this dllCall contain calls to the functions in plmctr.dll library which are documented here.

The sub-VIs that look like this subVI contain some extra code which mostly either generates phase patterns or reshapes them so that they are suitable inputs for the plmctr.dll library functions.

How to use plm_example.vi

  • Before running the code: select appropriate resolution ("W", "H") and the desired number of frames ("N frames") that will be contained in the PLM frame sequence. If you wish to use a custom look-up table and phase map, you can change the defaults in the plm_setLUT.vi (also see here). These controls cannot be changed while the VI is running.

  • To display a single phase pattern on the PLM, make a selection from the list of available options in "Select phase". You can also add an optional tilt phase to send light away from the zero-order. Set the direction of the tilt in "along rows" and "along columns", and then click the "Add tilt" button. Once the phase pattern is set up (you can view it in the "Phase pattern" intensity graph), select which PLM frame you want to send it to (in "Frame idx", this can take any value from 0 to "N frames"-1) and click "Send phase to frame". To ensure that the PLM displays this phase pattern, make sure that "Active frame" is the same as "Frame idx" you used when sending the phase pattern to the PLM.

  • To generate and display a sequence of phase patterns click on "Play tilt sequence". This will generate a series of phase tilts - there will be "N frames" different PLM frames and each frame will contain 24 different phase tilts. You can modify the plm_generateTilts.vi to use custom phase patterns instead of tilts.

A note on dependencies

List of all files needed to run the LabVIEW code (they must all be in the same folder):
glfw3.dll
hidapi.dll
plmctrl.dll
ucrtbased.dll
vcruntime140d.dll

The first time you open plm_example.vi you will be prompted to locate the plmctr.dll file (unless LabVIEW locates it automatically). If for some reason this does not happen you will need to update the path to plmctr.dll in all sub-VIs that call it. You can do this manually by opening the block diagram of each sub-VI in the LabVIEW library plmctrl.lvlib, double clicking on the Call Library Function Node and changing the "Library name or path". Alternatively you can use the provided updatePathTo_plmctrDLL.vi code to do the update automatically (just make sure that updatePathTo_plmctrDLL.vi is in the same folder as plmctrl.lvlib).

Clone this wiki locally