LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start data aquisition when trigger appears but with 20ms delay

Hello,

I‘m for the first time using multifunction card. It’s NI-PCI 6110, BNC 2110, DAQ 8.3, Labview 8.2, Win XP SP2.

On channel ACH0 2 I have an analog signal I want to measure (Voltage). On PFI 0/TRIG 1 is trigger signal (triggers each 100ms). I want to capture 8000 samples each time PFI0 triggers. But I want to start data aquisition with aprox. 20ms delay. Is this possible?

Can anybody help me?

And one more question. Which function has Digital and timing I/O, now it’s connected as following: User1-PFI2, User2-PFI1. What does it mean?

Thanks all
LV 2011, Win7
0 Kudos
Message 1 of 12
(4,128 Views)
Use a counter/timer with your acquisition system.

1.  Trigger the counter/timer and set it up to generate a 20 ms pulse.
2.  Use the Counter output to trigger your acquisition (falling edge).
Randall Pursley
0 Kudos
Message 2 of 12
(4,119 Views)
Hi rpursley8,

I'm not sure if you understood me correctly. I have signal for triggering. It triggers every 100ms. But I want to create 20ms delay before acquisition start after trigger appears. And other thing is that I'm not sure whether I can save 8000 samples every 100ms, can I?

Thanks
Ceties
LV 2011, Win7
0 Kudos
Message 3 of 12
(4,112 Views)
Hello ceties,

if you use a reference analog edge trigger you get an Pretrigger samples input (on the lower side of the VI) if you set these to 20ms*8000=400 you should have the data you want.

I'm not sure about your samplerate, I see in your code you start and stop the task every run (100 ms) I don't know if this is fast enough. I haven't seriously used retriggering to know how this should work, but I think that you could move the start and stop out of the while-loop.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 12
(4,109 Views)
Hello TonP and others,

I think I have now more serious problem. Sample frequency I'm using is the maximum allowed by the card - in this case 5Ms/sec. Trigger appears every 100ms(TRIG0) and I want to capture(CH0) 8000 samples on each trigger.

I tried measure time of the measurement and compute amount of triggers and compare it with number of samples captured in array and I see that some triggers are missing. Card seems not acquire data on all trigger impulses.

How solute this?
How to count number of triggers on trigger input to compare it with amount of captured data (more precise way than to compute trigger count from time)?

Thank you very much!
LV 2011, Win7
0 Kudos
Message 5 of 12
(4,100 Views)
Hello Ceties,

Some questions:
How do you store the data? The fastest is writing it to a binary file. Open and close the file outside the while loop.
How do you start the daqmx task? Outside the while loop like I suggested?

Have you timed your loop? You could do it something like this:

Have you timed the actions you want to do on the data? To test this you have to generate an 8000 samples sized array and feed this through your post processing.

Could you show the actual code?

Ton

Message Edited by TonP on 10-02-2006 05:50 PM

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 12
(4,091 Views)
Hi TonP,

I'm not storing data yet. I'm just reading captured data and storing them in an aray in memory.

Start is of course realized outside the while loop.
You can see my time measurement in attached VI. Passed time is divided by 100 (triggers appears every 100ms) so finally a have expected count of trigger impulses. I know that this is not a proper way but I don't know the right way how to measure trigger count. But after one minute data acquisition there is huge difference between count of rows in captured array and expected count of triggers.

I am capturing 10kHz signal from signal generator for test purposes.

Message Edited by ceties on 10-03-2006 04:02 AM

LV 2011, Win7
0 Kudos
Message 7 of 12
(4,067 Views)
If my calculation is right, this card should be able to capture 500 000 samples each 100ms, so problem is elsewhere.

fs=5Mhz
Ts=1/5e+6=2e-007s //time needed to capture one sample
Samples per 100ms = 0.1/2e-007 = 500 000

Is that right?

Message Edited by ceties on 10-03-2006 04:34 AM

LV 2011, Win7
0 Kudos
Message 8 of 12
(4,062 Views)
 

Hi Ceties,

Your card can acquire at the rates you need, you just need to set up the triggering differently. You're trying to set it up as software retriggerable by starting and stopping the task and waiting for the trigger in between. It sounds like this is taking too long for the start and stop, and this is not suprising. These calls are usually made ouside of a loop and are not the fastest. For retriggerable acquisition you generally want to use counters. Counters are retriggerable in HW so they do not require starting and stopping in SW and the delays. You can route the counter output to the AI sample clock.

This KB explains a little more how to set it up:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019MXxSAM&l=en-US

The example they referenced is called "Multi-Function-Ctr Retrigg Pulse Train Generation for AI Sample Clock.vi." It should be very close to what you are looking for. One thing to keep in mind, adding a 20ms delay would be pretty problematic. I would look into acquiring for the whole 100ms and then just throwing away the first 20ms of data.

Hope this helps,

Andrew S.

National Instruments

Message 9 of 12
(4,042 Views)
Hello stilly32 and thank you very much,

It looks that you are completely right. I found some other threads about this problem. But I'm still doing something in wrong way, because I'm not capturing data. There are no errors but AvaliableSamplesPerChan are stil 0. What's wrong? Why God hate me? 🙂

Message Edited by ceties on 10-04-2006 04:36 AM

LV 2011, Win7
0 Kudos
Message 10 of 12
(4,030 Views)