Directly Accessing APx .NET Methods and Properties with LabVIEW

Created on 2012-10-08 17:39:00

The APx LabVIEW Driver is a collection of Virtual Instruments (VIs) aimed at providing LabVIEW users the ability to access most of the functionality available in the APx500 Application Programming Interface (API) using high level, LabVIEW-typical subVIs, with a minimum number of programming steps. While the APx LabVIEW driver includes VIs for every APx500 measurement, there are some less frequently used advanced settings that are not built into the supplied LabVIEW drivers. An example are those settings accessed through the Advanced Settings dialog in each measurement.

Nevertheless, any setting in the APx UI can be read or set in LabVIEW by constructing a VI that directly accesses the associated .NET Methods and Properties in the APx API. To see all the methods and properties available, open the API Browser from the APx500 folder in the Windows Start menu.

The following example will step through constructing such a VI. This VI will independently set the generator level for each channel in the Level and Gain measurement. In the APx500 UI, this functionality is provided by clicking the Advanced Settings button in the Settings Panel of the Level and Gain measurement.

Fig 1

Place an APx Open VI. Then, right click on the APx500 Reference Out terminal of the VI, select Create > Property for AudioPrecision.API.APx500 Class, and choose LevelAndGain. Note that you can also perform this operation on the APx500 Reference Out terminal of any existing APx LabVIEW driver VI.

Fig 2

From the LevelAndGain property, right click and create a new Generator property for the ILevelAndGainMeasurement class.

Fig 3

Connect the new Generator property, and then in a similar way add an AnalogLevels property to the ILevelAndGainGenerator class. From the AnalogLevels property, create a SetValue method and connect it.

Fig 4

Add an additional SetValue method for channel 2 and complete the VI as shown above.

You can see additional examples by simply opening up any VI in the APx LabVIEW driver and opening its sub VIs until you see the .NET methods and classes. In this way, you can also modify any of the provided VIs to access to additional functionality.