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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finite Acqusition During DI Pulse Window

I would like to setup a finite acqusition or hardware timed single acqusition with start and stop triggers using PCIe-6351 card.I have one DI line that changes its state and I would like to acquire couple of analog channels during this time window.

I connected the DI trigger line to one of analog channels to monitor the the state of the DI at the time of acqusion.

I tried the example under pretriggerred acqusiton with start and reference triggers section provided in the link below. (see the attachment). I have no luck with it as it first captures the pretriggered number of samples then catches the reference signal condition and acquire the rest of the samples to make the total of the acqusition equal to number of samples defined in the sample per channel parameter. It is almost as if the start trigger signal is ignored.

Any ideas what my problem might be?

Is there any other alternative method to implement the intended functionality where I can define sharp stop trigger without providing pretrigger condition?

http://www.ni.com/tutorial/4329/en/

Thanks

Thanks & Regards ,

0 Kudos
Message 1 of 9
(3,807 Views)

I can not say that I have ever seen an example of that it DAQmx. In classic DAQ but not DAQmx.

 

I can think of two approaches that I will share to get some gray-matter working.

 

1) IF you have timers on your board...

 

Use the DI to act as the gate (enable whaterver...) to run a DO task at your sample rate. Use that DO to clock you DI task.

 

2) IF no timer/counters...

Do a continuous acquisition and track the DI line and when false toss all reading and when it is true keep them.

 

Done with the hints for now,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 9
(3,791 Views)

Thanks for your answer Ben,

Here are my comments to your message:

1) PCIe-6351 has timers and clock on the board. I currently have no DI, DO tasks but only AI task. If I AND gate my DI with internal clock and port it to a DO to use as my clock for my AI task, might work but seems complicated. There is a potential risk of picking up upcoming DI pulse or timeout in the finite acqusiton window if there is no stop trigger also. Any ideas or a link to explore this more?

2) Doing continues acqusiton using pause trigger to toss all the undesired signal data was my idea but then I decided not to as the DI pulse width might vary. I need to be able merge and log acquired data in each DI pulse time window linked to the camera image taken during that time window. Acquiring raw data in continues mode and postprocessing log files might be another way to do it. 

Any other approach ideas for either finite and continues acqusion modes to capture signals during a DI pulse window?

Thanks & Regards ,

Message 3 of 9
(3,783 Views)

@Sez wrote:

Thanks for your answer Ben,

Here are my comments to your message:

1) PCIe-6351 has timers and clock on the board. I currently have no DI, DO tasks but only AI task. If I AND gate my DI with internal clock and port it to a DO to use as my clock for my AI task, might work but seems complicated. There is a potential risk of picking up upcoming DI pulse or timeout in the finite acqusiton window if there is no stop trigger also. Any ideas or a link to explore this more?

2) Doing continues acqusiton using pause trigger to toss all the undesired signal data was my idea but then I decided not to as the DI pulse width might vary. I need to be able merge and log acquired data in each DI pulse time window linked to the camera image taken during that time window. Acquiring raw data in continues mode and postprocessing log files might be another way to do it. 

Any other approach ideas for either finite and continues acqusion modes to capture signals during a DI pulse window?


Yes, not trivial.

 

Externally timed acquisition will timeout if no clock detected so you would have to handle the timeout in code and restart etc.

 

The continuous acquistion is the most simple approach hardware cofig-wise but does requiring walking through every DI input (the DI wired to an AI channel and comparing with a threshold) reading and deciding if you keep or toss the data. But it will allow for changing "gate" widths.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 9
(3,773 Views)

While I was not able to find a shipping example... NI Support may be able to find one.

 

With the OLD FieldPoint hardware, it was possible to control an output pulse train via DI input that acted as the gate which when true allowed the pulse train to run and when fals inhibited the output pulse train.

 

If NI can find an example that uses the news couter timers to do that, jumper the pulse train to the external clocking input for the analog task...

 

Just throwing out ideas... 

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 9
(3,767 Views)

Thanks for your ideas Ben,

I already opened a request with NI support and will also be working with them to explore more about finite acqusition method. I will mention about OLD Field Point HW functionality that used to be supported.

Here are two possible approaches so far:

Finite acqusiton - Output Pulse Train via DI input that acts as a AND gate with internal clock. Still looking for an article or an example on how to do it. Anyone ideas?

Continues AI task acqusition- Post processing the raw data in log files or in circular buffer by comparing analog value of DI signal against a treshold to keep or tost the data. Need to be careful with the unfinished acqusion of intest at the end of the file or chunk data at the time of postprocessing for appropriate data syncronization.

Pros/Cons:

With finitite acqusiton method, if I can implement it, rates might be slower but would be able to display instant live raw data on my GUI. `Camera Trigger` event that causes DI pulse generation needs to be software controlled to ensure handshaking in acqusition. No need to do post process for data syncronization.

With continues acqusiton faster rates might be possible, no need to control each `Camera Trigger`allowing 'continues CAM' mode or 'external trigger' but need to do log post processing and avaraged data display.

By the mean time if there is anyone with different aproach ideas, please feel free to provide your input 🙂

Thanks & Regards ,

Message 6 of 9
(3,756 Views)

Here are couple of websites I found on Output Pulse Train generation feature that I might use in my finite acqusition method. Not sure if there is any limitation on the number of simultanuous tasks that the board can handle, I will post my findings after I review the links below and test them with HW.

 

http://www.ni.com/example/27415/en/

http://digital.ni.com/public.nsf/allkb/7B1B0427C39FE33086256CEE00752133

http://www.ni.com/tutorial/2991/en/

https://decibel.ni.com/content/docs/DOC-8473

http://digital.ni.com/public.nsf/allkb/7EF0241890D1E1AF8625730800566387

http://forums.ni.com/t5/LabVIEW/DAQmx-Using-DIO-to-output-a-finite-pulse-train-with-certain/td-p/212...

 

Thanks

Thanks & Regards ,

Message 7 of 9
(3,743 Views)

 If I understand right, here's how I'd approach it.  There might be a more clever method for configuring exactly what you'd like, but this oughta work and may be more straightforward to set up.

 

1. Go ahead and configure your AI task to do continuous sampling using the digital signal as a pause trigger.  Your concerns about this approach are valid, but we're about to address them another way.

  Key item: The AI task will only sample while the external DI signal is high.  I *think* that the internal signal AISampleClock will similarly only pulse for actual samples taken.  (You may need to verify this part.  If I'm wrong, check back in to the thread.)

 

2. Configure a Counter task that pays attention to the AISampleClock.  A simple method is to use buffered edge counting mode.  Use the internal AISampleClock signal as the sample clock for the Counter task.  Configure the task to use the internal 100 kHz timebase as the signal whose edges are to be counted (and buffered).  You are essentially just timestamping all the AISampleClock pulses.  Be sure to start the Counter task before the AI task.

 

How to work with it:

- The counter task will start incrementing its internal register immediately when you start the task, but its value will only be sampled when the AISampleClock signal pulses.  

- The first sampled value is pretty meaningless, you'll really only concern yourself with the time difference between consecutive samples.  You'll get a stretch of very regular values (they may vary by +/- 1 count due to quantization) representing your AI sample rate followed by a big time gap representing the time while the external DI signal is low.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 8 of 9
(3,734 Views)

Thanks for your reply on my post Kevin.

I am currently working on an approach that acquires all the channels using both of the continues and finite acqusition methods with start/reference triggering functions depending on user selection and postprocess all the acquired chunk of raw readings data to capture the signals at the time of the pulse.This method requires me to to constantly monitor the acquired data to strip out the undesired data during the acquistion within the post processing step. I will try to see if i can to move all the work to HW by playing with the AI sampleclock using counters and DAQ-Mx functions suggested if time allows as an alternative way.

Thanks & Regards ,

0 Kudos
Message 9 of 9
(3,632 Views)