Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

CO pulse train output and monitor

Solved!
Go to solution

Hi,

 

I am trying to output two high frequency pulse train (10000Hz with duty cycly 0.01) with my USB-6259. At the same time, I want to monitor the output. I did not find anyway to monitor it internally and thus wired the output terminals (designated as PFI12, PFI13) to two digital lines (port 0 line 30 and 31) trying to read and display the waveform. However, I could not get the sample clock source right. 

 

Please help me!  I really appreciate any inputs!

 

Kitty

 

0 Kudos
Message 1 of 5
(3,899 Views)
Solution
Accepted by kitty16

Hi Kitty,

 

Looking at your code, I don't see anything that is really wrong. What do you mean by could not get the sample clock source right? Did you get an error?

 

The M Series device do not have an onboard timing engine. To do hardware-timed DIO tasks, a clock source is needed. This KB has a few workaround that could work for you: http://digital.ni.com/public.nsf/allkb/51754212AD10BDCE862573BD007BFDD2

 

The DAQmx Timing property node is not needed here. The clock source and edge can also be configured using the DAQmx Timing VI. Instead of having two stop buttons controlling two seperate while loops, you can combine the code in one loop, which makes the code cleaner.

 

Ren H.
Applications Engineering
National Instruments
Message 2 of 5
(3,869 Views)

 

Dear Ren,

 

Thank you very much for your advice on my problem! You have made me aware of the hardware limitations and some other issues. During the past three weeks I have been studying Labview programming, in the mean time trying to optimize our experimental process design. Below are some questions I have got confused so far. Could you please help me with your professional knowledge, especially to recommend me a suitable hardware so that we can purchase to meet our needs (the current one is a USB-6259)?

 

The required labview process control includes three major functions:

 

Part  1: to generate two pulse train with 100 us period and 2.2 us on time. One is delayed for half the period.  This two pulse trains are used for stimulating two laser sources. (At the current stage, I am actually slow it down by 10 times to test the labview codes.)

 

In fig3, I tried to monitor the pulse trains generated by connecting the outputs to AI0 and AI1. However, as shown in Fig2, the two pulse trains are not delayed half the period from each other. Even worse, the delay between them is not fixed, but changed every time and with time. Is this problem caused by the hardware or my programming? How can I fix it getting the desired and constant intervals between the two pulse trains?

 

Couple other problems I met and tried to understand are:

 

A: for the Analog Input part, if I set a sampling rate to 800000/s, then error message “ADC conversion attempted before prior conversion was completed” occurred. I thought this should be the AI input rate limitation, although the manual says it can reach 1 MS/s for multiple channel inputs.

 

B: if I set the read.vi  samples per channel too small, then error message “attempt to read samples that are no longer available” occurs. I can fix it by set the buffer size larger or set to “-1”. With a larger “samples per channel”, the displayed waveform graph appears stable; however, with “-1”, the waveform graph is changing very fast.

 

Part 2: 2 AI channels to acquired signals from two laser detectors (one is from the lasers went through some sample; one serves as reference). The two channels have to acquire simultaneously.  I read somewhere on the NI forum that M series cannot make real simultaneous data acquisition since it only has 1 convert clock. How much the time difference would be for two AI channel sampling? Are there better device for us to use? We do need sampling rate of 1MS/s at least in our project.

 

Part 3: To process the acquired data and to send out a signal to trigger a device if certain criteria were met. I understand that we can use the producer/consumer design pattern to avoid slow data processing (Fig 1 shows that the producer/consumer pattern I tried to display (and store if needed) the data in a parallel way). However, for our data processing and evaluation part, we need to get the output trigger signal in a realtime mode (i.e. the trigger signal is targeting at the sample that meets the criteria. From the laser passes the sample to the time we send out the trigger signal, we have about 100 ~200 ms. Thus, we cannot really use the parallel pattern to send out a signal independently.

 

I am trying to simply the data processing and evaluation process to make is faster. However, for a similar process shown in Fig4, is it possible to make it fast enough? (We need to make the while loop iterate faster than the time needed for acquiring the buffered data. Otherwise, we will get the error “ attempt to read samples that are no longer available”, am I right?) Should I write a C-function to process the data? Will it be faster?

 

My last question might be even sillier, after I find a sample meet the criteria (i.e. the case structure at the very right of while loop is true), how can I send a voltage signal to a designated channel, which can trigger the action of a device to treat that specific sample.  The process I put in the case structure shown in Fig4 does not work. I really need some hint on this one ( sending out a voltage on the sample that meet some criteria, so that that sample can be treated by a device.)

 

I apologize for coming up with such a long message and with questions silly or not so silly. However, I am working hard on studying labview and really need professional advice on device selection as well as programming.

 

Thank you so much for your great help!

Best regards,

 

Wei Chen

0 Kudos
Message 3 of 5
(3,703 Views)

Dear Ren,

 

Since only 3 attachments are allowed for each post, I have to add one more reply for my fig1 of parallel design. Can the parallel pattern realize realtime data evaluation and trigger signal generation?

 

Also, I forgot the mention in my previous message that I am quite confusing on using those error in/out messages. And discussions on how to use them appropriately and wisely?

 

Thank you again for your great help!

 

Wei Chen

0 Kudos
Message 4 of 5
(3,703 Views)

Hi Wei Chen,

 

Looks like you have an interesting application on your side. To synchronize tasks, they need to share a trigger and a timebase, so they can start at the same time and sample at the same time. Check out this tutorial.

 

X-Series is definitely better at what you want to do. In terms of sampling, the 1MS/s sampling rate is shared among all analog inputs. If you have two, the max sampling rate would be 0.5MS/s per channel. When you read too slowly, the data in the buffer would be overwritten before you read it, and result in the second error. 

 

The producer/consumer is not the best for your application. The consumer loop is often used for things like recording data. If the process between the read and write takes too long, you can get the error like you said. Without knowing what the evaluation process is doing, it is hard to say what can be done to speed it up. This whitepaper talks about control applications with DAQmx.

 

Depending on your application, an real-time system with FPGA might be better. I really suggest you contacting a Sales Engineer at NI, they can recommend the proper hardware based on your overall application. The number is (888) 280-7645. They can also suggest the best way to get trainning and technical support as well. Something you can look into is the Standard Service Program (SSP), it gives you access to self-paced online trainning and phone/email support with Applications Engineers at NI. Here is a link on SSP.

 

Ren H.
Applications Engineering
National Instruments
0 Kudos
Message 5 of 5
(3,673 Views)