Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

measuring frequency with pxi-6259, hardware and software example

I want to measure frequency from a signal generator, i have followed all the correct step  to configure the DAQ and have followed all the correct steps to connect th e right pins. I am using a NI PXI-6259 DAQ , i have measured  analog voltage, but somehow i don't seem to get the frequency measurment going. It would be much appreciated if someone can help me. Kind regards Pande 
0 Kudos
Message 1 of 9
(5,957 Views)

Pande,

 

What kind of code are you using to currently measure the frequency.  The frequency measurement will have to be made in software and there are a bunch of ways in which you can acheive this.  If you are using some kind of DAQ code, or even the DAQ assistant, then you can probably use the  Spectral Measurements Express VI or the Tone Measurements VI to calculate the frequency of your incoming signal.  You could also write your own code in LabVIEW or any other programming language to calculate the frequency of your incoming signal.

 

The easier one to use would be the Tone Measurements VI.  If you are in LabVIEW, this is located in the functions palette under  Signal Processing >> Waveform Measurements.  It is just an express VI so you can plug in any kind of Dynamic data into the VI and it will spit out information such as amplitude and frequency to you.

 

I am not sure if you are familiar with parallel loops in LabVIEW but the best method to achieve this would be to use a Producer Consumer loop where  you can acquire all of your data in the producer loop and process it (calculate frequency) in the consumer loop.  This way the processing is not interfering with your acquisition and they are completely independant.  Only when the data is available will the processing be done.

 

Now, if you are not in a LabVIEW environment, you can use the data that is returned in a DAQmx Read VI to calculate frequency as well.  The data that is returned contains timing information with it as well, which has a t0, representing the starting time of the acquisition and a dt which represents the time in between samples.  You can use this timing information, along with the amplitude measurements made to calculate the incoming frequency of the signal.

 

Hope all this information helps.  Please post back if you have any further questions.

 

Regards,

 

 

Raajit L
National Instruments
0 Kudos
Message 2 of 9
(5,943 Views)

Hi Raajit,

              Thank you for you advice, i am still having trouble reading the signal, i am using pin AI1 to input the analog signal from the signal generator, i have read that i need to use one of the PFI pins with TTL signal so as to count the Ticks or rising/fallling edges! So to sum it up i have created a simple VI, i'm using DAQ Assistant to acquire the data , then the output of that i have connected to the signal input of the one measurement, i am then using a wave graph and a meter to display frequency and amplitude. Is this sufficient or do i need something else?

 

Kind Regards

 

Pande

0 Kudos
Message 3 of 9
(5,934 Views)
When i am configuring the DAQ Assistant for AI1 i don't get any signal when i run the channel? This tells me the DAQ is not acquiring the signal from the generator, i am trying to read frequencies from 1M to 15MHz with amplitude of 3Vp-p! Thanks again!
0 Kudos
Message 4 of 9
(5,933 Views)
I simply get a straight line when i read the channel in! Is this normal!, then i switch on the off, press this button then that, all of the sudden i get a signal that is increasing then decreasing untill it reaches a certain value 10.5 V amplitude, then its a straight line again! Ahh i've been on all the forums and read about all the help and literature but there is no specific advice on how to input a signal!
0 Kudos
Message 5 of 9
(5,928 Views)

Pande,

 

Thank you for all that information.  The 6259 has a maximum sampling rate of 1.25 MS/s on analog input.  Following Nyquist theorum, your incoming signal needs to be lesser than half that maximum frequency for the frequency component to get through.  If you are reading signals greater than 1Mhz, this board will not be able to read those signals because they are too fast.  We do have products that can go much higher like the digitizers.  You can find more information on them over here.  That would explain why you are not able to measure the signal.  What you are seeing in your code is actually a floating signal.  You could also possible have some kind of wiring wrong.  There is plenty of documentation online that talks about how to wire your signal etc.  Take a look at this document here.  

 

Field Wiring and Noise Considerations for Analog Signals

 

Also on your code side of things, are you using a DAQ assistant or one of the example VIs.  A good way to check your wiring is to create a task in Measurement and Automation Explorer.  Then, at the bottom right corner you will see a tab that says wiring, that will show you a diagram of how you should be wiring your signal.

 

Let us back up a little bit though.  Could you tell me a little more about your signals that are coming in and what you are trying to do?  Looks like you are doing both analog and digital I/O.  Where are these signals coming from and where are you outputting these signals.

 

Once again for signals as high as 15Mhz you should probably consider one of our digitizers and not our DAQ boards.

 

Feel free to post back if you have any further questions.  Hope some of this helps.  Looking forward to hearing from you.

 

Regards,

 

Raajit L
National Instruments
0 Kudos
Message 6 of 9
(5,905 Views)

Hi Raajit,

               You have cleared things up for me, thank you. What i actually want to do is to verify that i am obtaining 14.7MHz from a crystal, which is TTL, so all i relly want to do is count the edges of that train, on the schematic i have connected the output of the crystal to a schmitt trigger just to shave edges and to insure that i get a clean TTL, the output of this i have connected to pin 40 or PFI 13. Do i need to configure these pins? I have tried to use counters, but i simply don't recieve any signal, that is why i tried to measure any signal just to convince myself.I tried reading a really low frequency signal below 1MHz and i still can't see the signal on the Test Panel Analog Input.I'm really stuck 😞 , i think that maybe my DAQ has malfunctioned.

 

Regards

 

Pande

0 Kudos
Message 7 of 9
(5,901 Views)

A good way to test whether your DAQ board is working or not is to use the DAQ diagnostic utility, which you can download from the link below.

 

DAQ Diagnostic Utility 2.0 - Windows 2000/NT/XP --

 

Since this is a TTL signal, you should be able to put it inot one of the PFI lines and be able to measure it.  However, there are some lines that are used by default and that might be where the problem lies.  What we can do is start from creating a task in Measurement and Automation explorer.  To do this Open MAX and find your device under DAQmx Devices >> Right click on the device and select >> Create  Task >> Acquire Signals >> Counter Input >> Frequency.  Since there are two counters on the board, select one of those counters. Now there are a few different ways in which you can read frequeuncies on the DAQ board and each one of those ways has different PFI lines that you would plug into.  Again, these are only default values and you can change them.  For now though, if it is easy enough to switch your signal to one of these default lines that would be good.  Lets say you want to measure High Frequency, you can select High Frequency from the drop down menu.  You will notice that there is a little note that says Connect Your Signal to (Input Terminal) PFI8. This is the default value.  If you connect your signal to this value and still dont see a count up value then there might be something else that is going on.

 

Once you get the above to work, we can open up an Example program and take it from there.  A good example program is the one shown below, which you can access from the Example Finder.  

 

 

 

Let me know how that goes and also what the results of the Diagnostic Utility are.

 

Regards,

 

 

Message Edited by Raajit L on 08-15-2008 09:03 AM
Raajit L
National Instruments
0 Kudos
Message 8 of 9
(5,890 Views)

Hi Raajit,

              Thank you for helping me i really appreciate your help! I did as you described, first i ran the DAQ Diagnostic, it appears that everything passes except for the Analog Input and Output, the Following messages is posted:"

Error -89140 occurred at DAQmx Start Task.vi:1

Possible reason(s):

Driver cannot complete the route, because the only way to make the route requires a trigger bus line, and no trigger bus has been configured in MAX for this device.

If you have a PXI chassis, make sure it has been properly identified in MAX. If you are using a PCI device, create a RTSI cable in MAX that includes your PCI device even if you are not using any RTSI cables.

Source Device: Dev1
Destination Device: Dev1"

 

I Then tried using PFI8 and the input TTL was 4MHz i recieved the following Error:"

Error -89140 occurred at DAQmx Start Task.vi:1

Possible reason(s):

Driver cannot complete the route, because the only way to make the route requires a trigger bus line, and no trigger bus has been configured in MAX for this device.

If you have a PXI chassis, make sure it has been properly identified in MAX. If you are using a PCI device, create a RTSI cable in MAX that includes your PCI device even if you are not using any RTSI cables.

Source Device: Dev1
Destination Device: Dev1"

 

I tried Low frequency switching the input to PFI9, input of 100Hz and 3MHz TTL, i obtained the same error.Basically this has conveyed to me i am doing something wrong and your further help will be looked upon with great favour and appreciation.

 

Kind Regards

 

Pande

0 Kudos
Message 9 of 9
(5,867 Views)