Can I Control the FlexRIO Adapter Module Power From LabWindows™/CVI™?

Updated Jan 31, 2024

Reported In

Software

  • LabWindows/CVI

Driver

  • FlexRIO

Issue Details

  • Is it possible to control the power for a FlexRIO adapter module (FAM) from a LabWindows/CVI application in a similar way you would use the FlexRIO Host Control IO Module Power VI from LabVIEW? 
  • Since the FPGA Interface C API does not support controlling IO module power for a FlexRIO Adapter Module, is there another method of doing it?

Solution

There is no built-in integration for the NI-FlexRIO driver in LabWindows/CVI as there is for the FPGA Interface C API. However, we can do this manually. The FlexRIO C API does support FAM control which should be used in conjunction with the FPGA C API. To get the FlexRIO C DLL and the header file, you will need to have the NI-FlexRIO driver installed. 

The "niflexrio.h" header file should install to directory C:\Users\Public\Documents\National Instruments\FlexRIO and the "niflexrio.dll" DLL file can be found at C:\Windows\SysWOW64 or C:\Windows\System32

The function NiFlexRio_FamControlPower should be used to control the FAM power. See the following screenshot of the function prototype in the niflexrio.h header file.

FlexRIO FAM Power Func Proto.PNG

The best approach to manually add FlexRIO driver support to your LabWindows/CVI application is to implicitly link the DLL to your C application. Follow these steps to properly import niflexrio in your LabWindows/CVI project:
  1. Create an import library file (.lib) from the FlexRIO DLL by following the steps from How Do I Create Import Libraries for a DLL in LabWindows™/CVI™ article. In the dialog box that will show up, you can keep both checkboxes unchecked.
  2. Add your newly created .lib file to your project, as explained in the Linking to DLL Defined Functions from LabWindows™/CVI™ article. 
  3. Add #include "niflexrio.h" to your main code.
  4. Call the function NiFlexRio_FamControlPower, refer to the header file to learn more about the parameters and the returned value.

An example of the C code to call the NiFlexRio_FamControlPower function would look like the below snippet.
 
Example CVI Code.PNG