Example Code

Measuring Angular Position with a Resolver and the PXIe-4340

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • PXIe-4340

Code and Documents




This example demonstrates how to take an angular position measurement from a resolver using the PXIe-4340.


A resolver is an analog device used for measuring degrees of rotation. A resolver contains a single primary winding which is energized with a sinusoidal voltage and two secondary windings positioned at a right angle from one another. The primary winding induces a signal on the secondary windings of a magnitude dependent on the primary windings angular position. The resulting output of the secondary windings is cosΘ and sinΘ where Θ is the angular position of the primary winding. So we can express or diagram the angle of the primary winding, Θ, and the measurements of the two secondary windings, cosΘ and sinΘ, as a unit circle.

With cosΘ and sinΘ being measured known values, the following trigonometric function can be used to find Θ.


In order to measure a resolver the NI PXIe-4340 needs to use a channel per secondary winding. Excitation to the primary winding is sourced from a single channels excitation terminals. Leave the excitation terminals of the other channel unconnected. In order to get an accurate measurement both channels will need to be set to use remote sense and connected to the primary winding. A connection diagram for resolvers is provided below.




  • LabVIEW 2014 (or compatible)
  • NI-DAQmx 15.5 (or compatible)
    Note: The minimum required LabVIEW and NI-DAQmx version will depend on when support was introduced for the hardware. Check the corresponding User Guide for the hardware you are using to find the appropriate minimum NI-DAQmx version, and check the NI-DAQmx readme for ADE support.


  • PXIe-4340


Steps to Implement or Execute Code

In order to run this example:

  1. Open VI and select the appropriate Channel and Channel Settings.
  2. Run the VI to perform an acquisition.
  3. Press the Stop button to end the acquisition.


Additional Information or References


Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.