Table Of Contents

Measure Frequency (G Dataflow)

Version:
Last Modified: September 15, 2017

Returns the frequency of a signal at the specified terminal.

The terminal you specify in source terminal must contain a digital signal to function.

connector_pane_image
datatype_icon

instrument handle in

The instrument handle that you obtain from Initialize.

datatype_icon

error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

datatype_icon

source terminal

The source terminal of the signal to measure.

Valid values:

Name Description
PFI<n> The PFI connectors on the front panel of your module.
PFI_LVDS<n> The PFI low voltage differential signaling (LVDS) input/output connectors on the front panel of your device. Signals on PFI_LVDS lines use the standard PFI synchronization clock.
PXI_Trig<n> The basic trigger lines of the PXI or PXIe chassis.
PXI_Star<n> The star trigger lines of the PXI or PXIe chassis. Each trigger line is a dedicated connection between the system timing slot and one other slot.
spd-note-note
Note  

Each PXI_Star trigger is mapped to a single slot. This mapping is vendor specific. Refer to the hardware documentation to determine the orientation of PXI_Star lines in the chassis.

PXIe_DStarC<n> The differential star trigger line of the PXIe chassis. Use PXIe_DStarC lines to send trigger and clock signals from a peripheral slot to the system timing slot of the chassis.
spd-note-note
Note  

Each PXIe_DStarC trigger is mapped to a single slot. This mapping is vendor specific. Refer to the chassis documentation to determine the orientation of differential star trigger lines.

PXIe_DStarB The differential star trigger lines of the PXIe chassis. Use PXIe_DStarB lines to send trigger signals from the system timing slot to a peripheral slot of the chassis.
spd-note-note
Note  

Each PXI_DStarB trigger is mapped to a single slot. This mapping is vendor specific. Refer to the chassis documentation to determine the orientation of differential star trigger lines.

Oscillator The oscillator of the device specified in the instrument handle terminal.
ClkIn The ClkIn input connector on the front panel of the device. Using ClkIn, you can connect a 10 MHz reference clock directly to the PXI_Clk10_In pin.
datatype_icon

duration

The length of time, in seconds, to measure the frequency.

Set a longer duration to return a more accurate frequency measurement.

Default: 0.00000100

datatype_icon

decimation count

How much to decimate incoming trigger events.

Use this value with a time-based device to adjust the number of timestamps that should elapse before the next timestamp is recorded. For example, if you set the decimation count to 10, the function will record every tenth timestamp. The value must be greater than or equal to one.

Default: 1

datatype_icon

instrument handle out

The instrument handle that you obtain from Initialize.

datatype_icon

error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.
datatype_icon

measured frequency

The frequency, in Hz, measured at the specified terminal.

The measurable frequency range is dependent on the hardware; refer to the hardware's documentation to determine the frequency range of any given terminal.

datatype_icon

actual duration

The actual duration, in seconds, that the function measured the frequency of the signal at the specified terminal.

If the value you entered in duration is not a multiple of the PXI_Clk10 period, the actual duration will be the closest multiple of 100 ns.

datatype_icon

frequency error

The margin of error calculated for the frequency measurement.

The formula used to calculate the error is:

error = [ (10M / base_freq) ] / [actual_duration]

where base_freq refers to the base frequency and actual_duration refers to the output of the actual duration terminal.

Using Measure Frequency with Time-Based Devices

The following time-based timing and synchronization devices are compatible with Measure Frequency:

  • PXI-6683
  • PXI-6683H
  • PXI-6682
  • PXI-6682H

When using Measure Frequency with a PXI-6683(H) or other time-based device, timestamping is used to measure the frequency. The function will measure timestamps that have an actual duration greater than or equal to the specified duration. If timestamps are not detected or not enough timestamps are detected due to a slow signal or a decimation count that is too high, the function may encounter an error. Generally, you should have a timestamp within every second to avoid this error.

spd-note-note
Note  

The maximum signal you can measure using this function is 22.7 MHz

The decimation count terminal is only necessary on PXI-6683(H) and other time-based devices. In order to set the decimation count accurately, you should have a general idea of what range (Hz, kHz, MHz) the signal to be measured occupies.

Only PFI and PXI_Trig lines can be used as the source terminal on time-based devices.

For the most accurate measurement, the board clock for the time-based device you are trying to measure should be set to free running. If you are synchronizing to GPS, IRIG, or a PTP protocol like 1588, the function may encounter an error or the result may be unreliable.

Troubleshooting the Software Buffer Overflow Error

When you are measuring frequency with this function using a time-based device, you may encounter a software buffer overflow error. This means that LabVIEW does not have enough memory to store the recorded timestamps when measuring frequency. You can take one or more of the following actions to resolve a software buffer overflow error:

  • Set a higher value in the decimation count terminal.
  • Set the Time Stamp Buffer Size property with niSync Properties by selecting Timing»Time Stamps»Time Stamp Buffer Size. Use this value to manually adjust the size, in number of time stamps, of the software buffer where timestamps are stored.

Using Measure Frequency with Signal-Based Devices

The following signal-based timing and synchronization devices are compatible with Measure Frequency:

  • PXI-6652 (PFI0 only)
  • PXI-6653 (PFI0 only)
  • PXI-6672 (PFI0 only)
  • PXIe-6674T

Using a signal-based device and Measure Frequency, you can measure the frequency of the device's oscillator, an external clock connected to a front panel input, or a full speed or divided synchronization clock.

When measuring the frequency on a signal-based device, you must set the duration in multiples of 100 nanoseconds, i.e. a multiple of the PXI_Clk10 period. If the duration is not a multiple of the PXI_Clk10 period, it will be coerced to the closest multiple and returned in the actual duration terminal.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application


Recently Viewed Topics