From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

High-Speed Digitizers

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Acquire chirp(5421) delay and generate acquired chirp(5122)

Hi ,

I'm new to labview ( I just completed core 1 core 2 is in few weeks )

However, I'm having difficulty wrappng my head around an acuisition/delay/generate problem and where to start.

I have a PXI system with a 5421 and 5122.

I need to capture a chirp ( length defined by user input ( limited to appro 15msec), delay by 30 to 200msec from the start ( triggered) of acquisition ( defined by user input) and generate the captured signal on the AWG.

What's the best way to tackle this ?  do I export the trigger , through a delay, the 5122 ?

I need the gui to be somewhat responsive, and I don't want to monopolized the CPU ( although with 4 cores would it matter if a single thread cused 100% of one core ?) but the delay time must be consistant/repeatable over multiple acquisitin/delay/generate cycles.  I would imagine that the waveform must be held in memory/buffer as any disk I/O could exceed the delay ?

 

This should be relatively simple, ?  but I'm stuck at the beginning wondering what the best approach is.  I've read every example I can find, but ... there are some subtleties I'm missing.

 

any nudge/help would be appreciated.

 

Thanks

 

Gary

0 Kudos
Message 1 of 26
(7,611 Views)

Hey Gary,

 

Congratulations on completing Core 1 & 2! 

 

First, if you need the UI to be responsive, you should read the knowledgebase article How Many Threads does LabVIEW Allocate?  It has some great information on multithreading. 

 

Now depending on if you want to use a hardware or software trigger for your acquisition, you could take a look at some of the examples that are in the example finder, such as "Cont Acq&Graph Voltage-Analog SW Trigger.vi" under Hardware Input and Output >> DAQmx >> Analog Measurements >> Voltage. From there, you could look into a software timed delay such as "Wait Until Next ms Multiple".  If you want deterministic timing, you could look into LabVIEW Real Time.  After that, there should be more great examples in the example finder. 

 

For an example that is a little more All-in-One, you could take a look at DAQmx Generate Aquired Data with Queues, which has a producer/consumer architecture that should provide more controll.

Regards,
Jake G.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 26
(7,602 Views)

Hi Jake,

 

I appreciate you taking the time to repsond to me open end question.

I've looked at Daqmx and it would offer alot of features that would make this easier, but sadly I cannot use Daqmx (or assistant) as it's not compatible with the PXI-5421 or PXI-5122.  It seems that I must use NI-Scope and NI-Fgen , and I havn't found a way of delaying an exported trigger .  I'm exporting the trigger from NI-scope and I had tried to use channel delay in NI-Fgen , but I get an error that the property is not supported on the 5122 as it's only intended for multi channel .. channel to channel delay.

I read a few posts where folks are asking for something similar, but I've not seen a answer to the "how do I delay a trigger" question

I must have missed something in NI-Fgen, as delaying a event after trigger would seem like a very useful function to have.

This should be very easy, but as I'm a babe in the woods when it comes to Labview, I can't seem to see the answer.

 

 

Thanks

 

Gary

0 Kudos
Message 3 of 26
(7,594 Views)

Hey 7of9,

 

I'm sorry, I totally misunderstood this, so thank you for your patience.  You're right.  NI-SCOPE and NI-FGEN are required.  I think I have found an example that is close to what you are trying to do.  It's located here.  You should be able to use your PXI-5122 for the scope option and the PXI-5421 as the FGEN option.  After you get the signals going, you can adjust the delay with the knob labeled "T-Clk Delay".  T-Clock is used to synchronize and time modular instruments.  If you would like to learn more about T-Clock, you can go to National Instruments T-Clock Technology for Timing and Synchronization of Modular Instruments

Regards,
Jake G.
National Instruments
Applications Engineer
0 Kudos
Message 4 of 26
(7,588 Views)
Hi Jake, Thanks for the T-CLK example, I had looked into syncing/delaying using T-CLK, but it's intended use is to sync sample clocks , and as such the delay is limited to +- 1 sample clock period. ( 100MS/S = +-10ns) I'm looking to delay by 30 to 300msec, and I'm running @ 20MS/S. This will be is a "chirp reflector", used to simulate SONAR echos. I need to acquire the 15msec chirp, delay ( to simulate a distant target) and generate the captured chirp . The delay needs to be accurate and repeatable. The current stumbling block ( for me anyway) is the delay'd trigger. Thank you for your patience with me... :-) Gary
0 Kudos
Message 5 of 26
(7,584 Views)

Jake,

I'm thinking that as I need an accurate timer/delay , it must be based on the sample clock ?  Can I use a counter to count the sample clock ? 

How about having NI-FGEN start a counter ( after trigger) that counts sample clock cycles ( the value controlled by user input) and the counter output will drive the "initiate generation" ?   I was thinking hat I might like multiple "targets' so I could use multiple sequencial counters :  Aquisition ->trigger out -> trigger in -> counter1-> initiate GEN -> counter2-> intiate GEN -> counter3.

With the caveat that counter 1 minimum must exceed that Aquisition length with some overhead/ padding added.

 

@ 20MHz sampling , delaying 70ms =  1400000 sample clock counts. 

 

or

 

construct a ARB sequence on the fly that inserts a 0v DC waveform ( as a delay) infront of the aquired waveform .  Of course doing it this way means that I'll cross the 1Mega sample boundary and that will induce some memory accessing ovehead ( change the delay) as I've read that anything over 1 million samples is accessed in multiple "chunks"

 

1400000 + 300000 = 1.7Mega samples in the sequence. 

 

What you do think might be the best option  ?  ( other than finding a nice delay settting that I can use save all this extra work)

 

 

I know questions, questions so many questions 🙂

 

Thanks

 

Gary

0 Kudos
Message 6 of 26
(7,577 Views)

Hey Gary,

 

One way would be to use scripting in order to get this done. And you're exactly right, you could implement a waveform of 0's to output at the same time as the acquisition begins to simulate your trigger delay for the FGEN.  There is some detailed information on scripting at Advanced Features of High Speed Digital I/O Devices.  It should give you all of the commands for scripting plus some common use cases for them.  Another useful tool for scripting is the Script Editor located in Start >> All Programs >> National Instruments >> NI-FGEN

 

But you may also be able to load the appropriate number of zeros (for the delay) into the buffer, then allocate space for the waveform using niFgen Allocate Waveform.vi and trigger both at the same time.  From there you could write the waveform into the allocated space and you should have the appropriate delay.  One problem doing this may be that if the waveform is larger than the delay and the waveform hasn't been written into the space yet.  To get around that, you could chunk the incoming waveform into smaller allocation blocks and read it that way. 

 

Either way, let me know what you choose to do and how it goes!

Regards,
Jake G.
National Instruments
Applications Engineer
0 Kudos
Message 7 of 26
(7,564 Views)

Hi Jake,

 

I've been reading about scripting, but it seems I can't embed a variable ( to allow the user ot change delay values) into a script ?

I take that to mean that I would need multiple applications, each with a different script delay to allow for different dealys to be tested in production ?

 

Right now I'm experimenting with :  ( As I can't find a "generate DC waveform vi)

 

Using the analog generate sine vi using Freq=0, dc offset =0, amplitude =0.  Feeding the sample freq value ( from NI-Scope get actual sample freq) into it as the Fs and using a user configurable delay to set the number of samples to generate .  Take this "DC" waveform and use "append waveform"  to add it infront of the acquired waveform .  Hopefully this will produce a delayed chirp. I imagine that I'll have to force secening to ensure that everything happens in the correct order.  ? I imagine that I'll run into timing issues with generating the dc waveform, appending it and loading it into the FGEN buffer ready for generation.  I have no idea how long this process will take , but that's why they call it experimenting 🙂

 I'd like to go on record that adding the ability to delay a trigger would be a really nice option to add to the next version of NI-FGEN 😉

 

 

Wish me luck 😉

 

Thanks

 

Gary

0 Kudos
Message 8 of 26
(7,559 Views)

Hey Gary,

 

Experimenting is the only way to learn!  Adding a variable to a script would be just a matter of concatinating the desired script around a number that is converted to a string. 

 

Since the PXI-5421 doesn't support peer-to-peer streaming, the signal going to from the Scope to the Arb would have to go through the controller. Since Windows isn't deterministic, there would be a varying delay in the transfer, probably on the scale of 1-5ms (possibly more).  One option would be to use LabVIEW Real Time to get around this.  Another option may be to use "double buffering".  This would be where one waveform is loaded read, and when finished switched to the other waveform.  There is an example of this in the FGEN driver located in the start menu under All Programs >> National Instruments >> NI-FGEN >> Examples >> LabVIEW 2010 >> FGEN Switch Between Waveforms.vi.  In the example, the script repeats, but what you can do is load the waveform without repeating based on the wait time and the sample rate. 

 

On a high level, this is what will be going on:

1.  The signal to be echoed is generated and sent to the Digitizer

2.  A digital trigger signifying the start of the signal is sent to the scope and the arb simultaneously

3.  The scope begins aquiring the signal AND the arb begins generating the first waveform (waveform of zeros)

4.  Once the 15ms chirp signal is completely aquired, it is transfered into the allocated space of the second waveform on the arb

5.  When the delay (waveform of zeros) is finished, the arb switches to the second waveform (chirp signal)

 

You should definitely give this a shot, but due to the extremely unique concept of this application I am also going to look into this a little more.  Keep me posted on your findings!

Regards,
Jake G.
National Instruments
Applications Engineer
Message 9 of 26
(7,553 Views)

Hi Jake,

 

Wow that's exactly what I was looking for, I was having great difficulty with the timing , I was using the trigger ( start of acquisition) to start generation of the delay waveform and that was taking too long to do/transfer so I was missing the acquired waveform.

On my drive to work this morning, it dawned on me that I must create the delay waveform BEFORE enbaling the acquisition. Exactly what you have just described.  We were experimenting with P2P ( due to the data transfer timing issues), but as you pointed out we discovered that the 5421 doesn't uspport P2P even thought one of the spec's indicates that it does support data streaming ?

 

 

I can't wait to try it....  

 

 

Thanks for sticking with me , I really appreciate it and the fact that you're looking into this more closely .... hopefully you have lots of "pull" with the coders and they'll add a suite of trigger delay functions to the next NI-FGEN release 🙂  I know... I'm a dreamer ... nothing but a dreamer "... :-))

 

Cheers

 

GaryC

0 Kudos
Message 10 of 26
(7,545 Views)