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

Document Type: Example Program
NI Supported: Yes
Publish Date: Apr 25, 2008


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

NI-DAQmx: Measure Semi Period in .NET

0 ratings | 0.00 out of 5
Print

Overview

This example demonstrates how to measure semi period on a Counter Input Channel. The Edge, Minimum Value and Maximum Value are all configurable. This example shows how to measure semi period on the counter's default input terminal (refer to section IV, I/O Connections Overview, below for more information), but could easily be expanded to measure semi-period on any PFI, RTSI, or internal signal. Semi-period measurement differs from pulse width measurement in that it measures both the high and the low pulses of a given signal. So for every period, two data points will be returned.

Table of Contents

  1. Instructions for running
  2. Steps
  3. I/O Connections Overview

Downloads

Filename: meas_semi_period.zip
Requirements: View

Instructions for running

  1. Select the physical channel which corresponds to the counter you want to use to measure semi-periods on the DAQ device.
  2. Enter the maximum and minimum value to specify a range for your unknown semi-periods.

    Note: It is important to set the maximum and minimum values of your unknown semi-period as accurately as possible so the best internal timebase can be chosen to minimize measurement error. The default values specify the range that can be measured by the counter using the 20MHzTimebase. Use the GenDigPulseTrain_Continuous example to verify that you are measuring correctly on the DAQ device.

Steps

  1. Create a counter input channel using Task.CIChannel.CreateCISemiPeriodChannel. It is important to set the maximum and minimum values of your unknown period as accurately as possible so the best internal timebase can be chosen to minimize measurement error. The default values specify a range that can be measured by the counter using the 20MHzTimebase.
  2. Call the CounterReader.BeginReadSingleSampleDouble method to arm the counter and begin measuring.
  3. Call the Task.Dispose method to stop the task and de-allocate any resources used by the Task.
  4. Handle any DaqExceptions and display a message box if there are errors.

I/O Connections Overview

This example will perform a measurement on the default terminal(s) of the
counter specified. The default counter terminal(s) depend on the type of
measurement being taken. In this example the two edge separation will be
measured on the default input terminals on ctr0. For more information on the
default counter input and output terminals for your device, open the
NI-DAQmx Help, and refer to Counter Signal Connections found under the
Device Considerations book in the table of contents.

 

Requirements


Filename: meas_semi_period.zip

Software Requirements


Language(s): C#, Visual Studio .NET, Visual Basic .NET

Hardware Requirements


Hardware Group: Multifunction DAQ (MIO), Counter/Timers (TIO)
Driver: NI-DAQmx 8.6

 
0 ratings | 0.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program 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 program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM 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/).