Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Sep 6, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Frequency Measurement with SCXI-1126

7 ratings | 3.00 out of 5
Print

Overview

This document describes how to implement the FrequencyMeter, a computer-based instrument. It uses the SCXI-1126 module, which implements the frequency-to-voltage measurement technique. If you are not sure if this technique is correct for your application, see the Appendix for some basic questions regarding measurement of frequency.

    The FrequencyMeter is described as follows:
    • Measure frequency on a signal of any shape (TTL, CMOS, sine, etc.)
    • Amplitude range from ±50 mV to ±250 V
    • Isolation up to 250 Vrms
    • Frequency up to 128 kHz
    • Continuous measurement
    • 8 channels, minimum

    FrequencyMeter Components

    Hardware
    • PC, with Windows 2000/NT/XP/9x
    • Plug-in board -- PCI-MIO-16XE-10 (P/N 777384-01), 16-bit ADC
    • SCXI-1126 8-channel isolated frequency module (P/N 776572-26)
    • SCXI-1349 shielded cable, 1 m (P/N 776574-491)
    • SCXI-1327 terminal block (P/N 777687-27)
    • SCXI-1000 4-slot chassis (P/N 776570-01)

    Optional (for Testing)
    • SCB-68 shielded connector block (P/N 776844-01)

    Software
    • NI-DAQ driver software which comes with the PCI-MIO-16XE-10 board
    • LabVIEW application

    Expertise

    This requirement is related to your perception of the application and the amount of time you want to put into it. This document guides you on issues related to hardware installation, software configuration, application development in LabVIEW, and panel user interface design. One of the advantages of using a computer-based instrument is that you can tailor the instrument to completely reflect your needs, your personality, and your application.

    Before Installing the Hardware


    Please take a moment and perform the following preinstallation checks:
    • Verify by part number that you have all the necessary hardware, ready to integrate into the frequency-measuring instrument.
    • Make sure the DAQ device and the cable connect properly. The SCXI-1349 cable adapter is a good choice for connecting the PCI-MIO-16XE-10 device to SCXI-1126 module.
    • Power off the SCXI-1000 chassis. Do not install or remove a module with the SCXI-1000 chassis power on as doing so can blow the chassis backplane protection fuse, which is located behind the chassis fan. If this fuse blows, SCXI channel readings will start to fluctuate. If the fuse blows power off the SCXI-1000 chassis, unscrew the fan, and change the green 1.5 A picofuse.
    • Insert the SCXI-1126 module in slot 1 of the SCXI-1000 chassis.
    • Connect the signals to the SCXI-1327 terminal block.
    • Attach the SCXI-1327 terminal block to the module.
    • Leave the cable unplugged from the SCXI-1349 cable adapter unplugged for now.

    At this point you are ready to proceed with hardware and software installation.

    Hardware and Software Installation


    Your PC is on, but the PCI-MIO-16XE-10 device is not inserted yet.

    1.
    Install LabVIEW.

    2.
    Install NI-DAQ.

    During the installation of LabVIEW, you are prompted to install the NI-DAQ driver software. You can do so during the LabVIEW installation if you plan to use LabVIEW for all of the measurements. If you plan to use the PCI-MIO-16XE-10 and SCXI-1126 with other development environments, install NI-DAQ from the driver CD, which comes with the PCI-MIO-16XE-10. If there is an older version of NI-DAQ already installed on the computer, completely remove it before installing the new version.

    During installation, you are prompted to make selections regarding the amount of software you want to install. Choose to install NI-DAQ Driver Files and LabVIEW Interface files, along with support for any other development environments you plan to use in the future. Also, choose to install the LabVIEW Support and LabVIEW Examples files installed into the LabVIEW directory.

    If your PC has a plug-and-play operating system, such as Windows 9x, then it is important to install the NI-DAQ driver before you install the DAQ device.

    3.
    Power off the PC.

    Plug in the DAQ device (PCI-MIO-16XE-10).

    4.
    Power on the PC.

    Enter Windows and locate Measurement & Automation Explorer (MAX) on your desktop. MAX is the NI hardware configuration utility that configures and tests the hardware.

    5.
    Configure the DAQ device.

    When you run MAX, you will see a window very similar to the Windows Explorer window. If you look under Measurement & Automation/Devices and Interfaces, you should see the PCI-MIO-16XE-10. You can test the device by placing your cursor on the PCI-MIO-16XE-10, right-clicking, and selecting Test Panel from the pop-up menu. You will see a strip chart with data. At this point, the data will be noise.

    If the device does not pass the configuration test, you need to debug this problem and see what causes it to happen. Some of the possible problems you may have at this stage of the application are:

    a.
    Bad base I/O address, interrupt or DMA conflict with other devices. You need to work with the operating system (Device Manager in Windows) because if Windows does not see and allocate correct resources to a plug-and-play device like the PCI-MIO-16XE-10, then MAX is unable to configure and test the device.

    b.
    A bad DAQ device. You need to repair or replace this device.

    6.
    Test the functionality of the DAQ device.

    Test whether the DAQ device is reading correct data. You need to connect the SCB-68 (optional) to the PCI-MIO-16XE-10 with the SH68-68 cable, which is part of the SCXI-1349 cable assembly. Connect a known DC voltage level in CH0 of the device, using the connector block. If the reading you see on the screen is correct, you are confident that the plug-in device is working fine, and you can proceed. If the reading is not correct, you may have a wiring problem or a bad device. Usually, wiring problems come from trying to measure a floating signal source, in differential mode, instead of RSE. If your reading is not stable, connect a wire between CH- and AIGND on the connector block (you are trying to reference the incoming signal to the AIGND line of the device. Pay attention to this small detail before deciding if the plug-in device is defective.

    7.
    Set up the SCXI system components.

    Plug the SCXI-1349 adapter into the 50-pin back connector of the SCXI-1126. Use the SH68-68 cable to connect the SCXI-1149 adapter to the PCI-MIO-16XE-10. Power on the SCXI-1000 chassis.

    8.
    Configure the SCXI chassis and module.

    With MAX open, close the test panel screen from the PCI-MIO-16XE-10. Place your cursor on Devices and Interfaces; right-click and select Insert. Choose the SCXI-1000 chassis and follow the subsequent menu-driven utility to configure the chassis and modules.

    If the SCXI chassis or module is not recognized during this configuration, check the following items:

    a.
    Make sure SCXI chassis power is On.

    b.
    Make sure you have the cable connected between the PCI-MIO-16XE-10 and the SCXI chassis.

    c.
    Make sure the SCXI-1126 is properly inserted into the chassis (flush with the front surface of the SCXI chassis).

    d.
    Make sure the SCXI-1349 cable adapter is fully inserted into the rear of the SCXI-1126.

    e.
    Make sure the SCXI chassis address settings are set to their default value (refer to the SCXI Chassis User Manual for more information on address settings).

    9.
    Test the SCXI configuration.

    With MAX open, place your cursor on the newly created SCXI-1000 entry under Devices and Interfaces; right-click and select Test. You should see a corresponding message stating "The Chassis has been verified."

    10.
    Configure the SCXI-1126 settings.

    With MAX open, expand the SCXI-1000 (Chassis 1) entry under Devices and Interfaces. You should see the SCXI-1126 as an entry. Place your cursor on this module; right-click and select Properties. Set the SCXI-1126 module Frequency Range (default setting 0 - 128000 Hz) and Filter Frequency (default setting 1 Hz). Also, make sure to configure the SCXI-1327 as the terminal block (located under accessories).


    At this point, hardware and software installation is completed and you are ready to start building the LabVIEW application.
    See Also:
    Hardware Installation Wizard
    SCXI Installation and Configuration

    Building the LabVIEW Application


    Open the LabVIEW example SCXI-1126 Frequency.vi, which is located in c:\LabVIEW\Examples\daq\scxi\scxi_ai.llb. This example VI has everything you need for a frequency measurement with the SCXI-1126. You will build the application, the FrequencyMeter, starting from this example.

    AI_Config.vi configures the device to read from the channel list described by sc1 ! md10:3 ! .You can modify the selection method by introducing a Boolean array to select SCXI-1126 channels by pushing a button on the panel. This is a minor change. NI-DAQ knows that the module in slot 1 is an SCXI-1126; therefore, it is possible to set input limits in frequency units (versus voltage units), in a 1-1 correspondence with the channel array. The SCXI-1126 module is capable of setting and using different frequency range settings on every channel. You will implement individual channel input limits selection by building an array of frequency selection clusters wired into the Input Limits control of AI_Config.vi. This is an important change in the initial VI, because the Frequency Range setting regulates frequency detection range. Each SCXI-1126 channel measuring signals in a different frequency range must have its frequency range set specifically.

    AI_Parameter.vi is used to set SCXI-1126 output filter to the value chosen in the Output Filter Setting control of the panel. The SCXI-1126 module is capable of setting, and using, different output filter settings on a per-channel basis. Implement this by including the AI_Parameter.vi inside a For loop, to be called once for each SCXI-1126 channel. Filter setting on a per-channel basis is an important change in the VI, because the output filter setting regulates frequency change detection rate. SCXI-1126 channels measuring signals with fast frequency changes need to have this filter set as high as possible (1000 Hz), while SCXI-1126 channels measuring constant or slow changing frequency signals need to have this filter set to 1 Hz.

    AI_Trigger_Config.vi chooses the trigger parameters. In a frequency measurement with SCXI-1126, AI_Trigger_Config.vi is used to specify Voltage Threshold, and Hysteresis, for each SCXI-1126 scanned channel. The SCXI-1126 module is capable of setting and using, different Voltage Threshold and Hysteresis on each channel. Implement this by including the AI_Trigger_Config.vi inside a For loop, to be called once for each SCXI-1126 channel. Voltage Threshold and Hysteresis setting on a per-channel basis is an important change in the VI.

    AI_Start.vi starts a continuous acquisition operation with the PCI-MIO-16XE-10 device.

    AI_Single_Scan.vi returns one frequency reading as a single scan from each of the channels in the channel list. You can provide scanning of consecutive channels using the default interchannel delay of 10 µs for an PCI-MIO-16XE-10 device.

    AI_Clear.vi ends the acquisition operation.

    Accuracy Benchmarks of the FrequencyMeter


    1. Using PCI-MIO-16XE-10 (16-bit) with the SCXI-1126:

    Frequency of Incoming Signal (Hz)
    Measured Frequency (Hz)
    16
    16.0200
    22
    22.0027
    35
    35.0052
    140
    139.9863
    400
    399.9859
    793
    793.0127
    1,574
    1,574.0607
    3,210
    3,209.8982
    11,440
    11,439.9660
    18,240
    18,240.5600
    29,000
    29,000.0020
    114,600
    114,601.3500

    2. Using PCI-MIO-16E-1 (12-bit) with the SCXI-1126:

    Frequency of Incoming Signal (Hz)
    Measured Frequency (Hz)
    16
    16.0509
    22
    21.9112
    35
    34.8526
    140
    140.0931
    400
    399.8333
    793
    792.8295
    1,574
    1,573.9386
    3,210
    3,210.3867
    11,440
    11,435.0840
    18,240
    18,244.4660
    29,000
    28,996.0930
    114,600
    114,609.1700

    Conclusion


    The SCXI-1126 frequency measurement solution is ideal for continuous, high-precision frequency measurement up to 128 kHz, with a large number of channels connected to signals of any type, even signal that require isolation.

    Appendix -- Measurement of Frequency


    A frequency measurement application is successful only if you are using the correct measurement technique, matching the type of signal and application requirements with the method of measurement and hardware used. Before implementing the application, you need to answer the following:

    Category A. -- Questions Regarding the Incoming Signal
    1. What is the signal shape? TTL? CMOS? Other?
    2. Is my signal periodic?
    3. What is its duty cycle?
    4. Does the signal have fast or slow frequency changes?
    5. Do I need isolation?
    6. How many channels are needed?

    Category B -- Questions Regarding the Type of Measurement
    1. Single shot measurement? Discrete? Continuous?
    2. Frequency range?
    3. Accuracy?
    4. Response time to changes in frequency of incoming signal?

    Measurement Techniques
    • Counter/Timer (82C53, 9513A, DAQ-STC)
    • Frequency-to-voltage conversion hardware (SCXI-1126)
    • Mathematical methods (using Power Spectrum)

    Counter/Timer Measurements
    Counter/timers will only measure TTL or CMOS compatible signals, in the following two scenarios, with regard to answers to questions in A and B.

    Scenario 1
    A. Incoming signal is periodic, with 50% duty cycle
    B. Single shot, discrete frequency measurement, finite number of pulses

    Solution: Measure pulse period, and calculate frequency as 1/period.
    • Wire the incoming signal into the counter/timer Gate.
    • Configure the counter/timer to count with internal time-base, while its Gate is high.
    • If you are using an 82C53 or 9513A counter/timer, you must detect the end of the high-gate period.
    • While the counter/timer gate line is low, read the counter content to find the period length in time-base units.

    Figure 1. Frequency Measurement Using Pulse Period Measurement with the Signal Wired into the Counter/Timer GATE

    The fastest time-base unit you can choose is 20 MHz, and it is given by the DAQ-STC counter/timer. Best performance with this method is obtained by using buffered semiperiod measurement with a DAQ-STC counter/timer. Every incoming pulse period is stored into a RAM buffer, for up to 232-1 consecutive pulses, and with an accuracy of ±100 ns using the 20 MHz internal time-base. This method covers a frequency range from 0 to 2 MHz with a response time in frequency change of 1 ms given by the time it takes to read the counter/timer buffer during counting.

    Scenario 2
    A. Incoming signal is periodic, with a variable duty cycle
    B. Single shot, discrete frequency measurement, finite number of pulses

    Solution: Provide a gate signal and count pulses during gate period.
    • Wire the incoming signal into the counter/timer source.
    • Configure the counter/timer to count incoming pulses, while its Gate is high or high/low.
    • Provide a gate signal using another counter/timer or an external TTL source.
    • If using an 82C53 or the 9513A counter/timer, you must detect the end of the high-gate period.
    • While the counter/timer gate line is low, read the counter content to find the number of pulses during the high-gate period.

    Figure 2. Frequency Measurement by Counting the Signal Wired into the Counter/Timer SOURCE

    The fastest frequency you can count, using a DAQ-STC counter/timer, is 20 MHz. Best performance with this method is obtained using buffered event counting with a DAQ-STC counter/timer. At the end of each gate pulse period, the accumulated number of incoming pulses is stored into a RAM buffer, for a maximum of up to 232-1 consecutive gate periods. This method has a response time in frequency change of 1 ms, given by the time it takes to read the counter/timer buffer during counting.

    Frequency-to-Voltage Conversion Measurements
    Frequency-to-voltage hardware produces an analog output that precisely represents the frequency of an applied input signal. Using software-selectable input-frequency-to-output-voltage set points, you can closely bracket the frequency of interest.

    The resulting analog signal is digitized, using a DAQ device. The measured voltage is then converted to frequency in the computer. Frequency-to-voltage conversion devices, such as the SCXI-1126, measure frequency of any signal type, in the following two scenarios, with regard to answers to questions in A and B.

    Scenario 1
    A. Incoming signal of any type, isolation needed, slow frequency changes
    B. Continuous accurate frequency measurement

    Solution: Use the SCXI-1126 with a filter setting of 1 Hz and a 16-bit DAQ device. The highest frequency you can measure, using the SCXI-1126, is 128 kHz. The best accuracy of about 25 Hz for measurement in the range of 128 kHz, which includes the effects of temperature drift over 20 to 30 °C span, is obtained using a 16-bit device to digitize the voltage coming out of SCXI-1126.

    Scenario 2
    A. Incoming signal of any type, isolation needed, high-speed frequency changes
    B. Continuous measurement, fast detection in frequency change needed

    Solution: Use the SCXI-1126 with a high filter setting (40 Hz, 320 Hz, 1000 Hz) and a 12-bit DAQ device. The highest frequency you can measure using the SCXI-1126 is 128 kHz. The best detection response time of 1.2 ms (to ±0.024%) is obtained using the 1 kHz filter setting on SCXI-1126.

    Mathematical Measurements
    This method mathematically calculates the frequency of a periodic signal by applying the Power Spectrum VI (available in the LabVIEW advanced analysis library) to finite sets of points digitized from the signal by a DAQ device. The Power Spectrum VI performs an FFT to determine the main frequency component of the signal. This method works on signals that do not change frequency during the sampling period.
    7 ratings | 3.00 out of 5
    Print

    Reader Comments | Submit a comment »

     

    Legal
    This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).