How to Reserve a PXI Trigger Programmatically

Updated Sep 21, 2023

Environment

Software

  • LabVIEW

Driver

  • NI-VISA

Operating System

  • Windows

Programming Language

  • C# .NET
  • Visual Basic .NET
  • LabVIEW G
  • Python

NI MAX, available in the Windows operating system, enables NI users to interactively reserve triggers for the chassis. However, it cannot be denied that in some scenarios, the developer would like to reserve trigger programmatically.

This article will share the working principle on how to reserve PXI trigger programmatically and what are the useful references.

Below are the sequences needed to reserve a PXI trigger:
  1. Open VISA Resource Manager
  2. Open PXI Backplane Resource
  3. Set the Trigger ID and the trigger bus attributes
  4. Reserve the trigger
  5. Unreserve the trigger - only do this if we succeeded in reserving
  6. Close your VISA Sessions

LabVIEW example for PXI trigger reserve could be found at:
For 32-bit LabVIEW:
C:\Program Files (x86)\National Instruments\<LabVIEW Version>\examples\Instrument IO\VISA\PXI\PXI - Reserve Trigger.vi
For 64-bit LabVIEW:
C:\Program Files\National Instruments\<LabVIEW Version>\examples\Instrument IO\VISA\PXI\PXI - Reserve Trigger.vi
or
Using the NI Example Finder as below:
image.png

.NET example for PXI trigger reserve:
There is no out-of-the-box example for PXI trigger reserve for .NET, but the developer can use the SimpleReadWrite example located at C:\Users\Public\Documents\National Instruments\NI-VISA\Examples\.NET as a getting started.

Python example for PXI trigger reserve:
As of now, NI does not provided Python example for PXI trigger reserve, but an external example can be found in the related links section below. It is for trigger routing but the concept is similar, and with slight modification, PXI trigger reserve is possible.
Note: PyVISA is a third-party wrapper and is not directly supported by NI.