LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger from digital input - DAQ acquisition time control issue

Solved!
Go to solution

I have a digital input from a PLC, that lasts for ~15seconds, i want to log data independent of the trigger state however.  Right now i have the digital input wired to a case structure, although i can time my DAQ loop to collect data for a given time i get multiple DAQ files for any acquisition time less than 15s.  

 

i want to trigger form a lead edge on the digital input signal line only, how do i ignore the state and only focus on the lead edge?

0 Kudos
Message 1 of 13
(2,359 Views)

@coolhandLV7 wrote:

i want to trigger form a lead edge on the digital input signal line only, how do i ignore the state and only focus on the lead edge?


Many DAQ devices have the ability to start A/D acquisition on the receipt of a digital trigger.  Check out the DAQmx Trigger VI, and look at Examples.

 

Bob Schor

0 Kudos
Message 2 of 13
(2,312 Views)

My application triggers from a DI from a PLC, the duration of the "high" signal is 15 seconds.  I have this signal tied to a case structure to trigger data collection of AI data.  The problem i'm having is i can't control the duration of the data capture, in other words i may only want 5 seconds of data to be captured.  The current state of the code allows me to capture for a duration less than 15 seconds, but once the duration is over the signal is still "high" so it just creates another file.

 

How do you trigger from just the lead edge of the signal and ignore the state after that?

0 Kudos
Message 3 of 13
(2,321 Views)

Hi coolhand,

 

what's wrong with Bob's answer?

And why did you create a new thread instead of sticking with your own one? (I merged them.)

 

but once the duration is over the signal is still "high" so it just creates another file.

You need to use the rising edge as trigger, not the high state - as has been said.

 

On your VI:

- you didn't manage to clean up the block diagram over the last days.

- why do you use a FOR loop to read your samples? Why not request the needed amount of samples as you already configured a samplerate?

- why do you create and stop the task in the loop as fast as possible (when no measurement is done)?

- why don't you clear all those DAQmx tasks?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 4 of 13
(2,294 Views)

I have been trying to understand how to do what Bob is saying, the examples don't do what i'm trying to do.  The VI i am showing is just an example for the forum, the function of the digital trigger is representative of what i have though, ignore the rest.

 

I'm trying to learn what the DAQmx start trigger actually does, i have it set to "Start Digital Edge"..."Rising"  It's needs a source though, isn't the source the digital input channel?  It won't let me know connect those.

0 Kudos
Message 5 of 13
(2,289 Views)

Hi coolhand,

 

It's needs a source though, isn't the source the digital input channel?  It won't let me know connect those.

Yes, the source should be that digital input.

But most often NI's DAQ devices have more than one name per pin like DIO and PFI. You could use any PFI pin as source for digital triggers…

 

You forgot to name your DAQ device and you also forgot to tell us, which pins you used so far…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 6 of 13
(2,284 Views)

I had a routine that took a "real" TTL pulse into a USB DAQ device (it worked with a 6009 and a 6002).  I used PFI0 as the Digital Trigger source for my A/D samples.  To test this without needing the hardware that generated the TTL pulse, I wrote a little test routine that toggled one of the DIO ports High, then Low, and ran a short wire from that port (configured as an Output Port) to PFI0.  Note that there's an input on the DAQmx Start Trigger function that lets you specify the source of the Digital Edge.

 

Bob Schor

0 Kudos
Message 7 of 13
(2,271 Views)

ok i think i now understand how the DAQmx Trigger VI works, although at this stage of the game i wish you could see how it works.  I am using (2) pins from an NI 9375 DIO module in a cDAQ chassis.  I need to collect data specific to each channel being triggered.  If DI0 goes HIGH, collected data for specific AI channels 0-3, if DI1 goes high collect data specific for AI channels 4-7.

 

Would this require two separate trigger VI's, where the source would point to each specific DI channels?

 

This trigger VI is going to require me to set up me duration and wait code differently also...the only other thing i can think of is to let the program collect all of the data for 15 seconds and then go in a cut out what i don't want to save prior to actually saving.

0 Kudos
Message 8 of 13
(2,268 Views)

Does anyone know of a way to determine what channel has actually triggered in the DAQmx trigger VI?  The property node does not seem to have this option.

 

I'm thinking that it could be programmed to collect data if either channel is HIGH (for the DAQmx START VI) and i can configure what data to capture based on the which specific channel had the state change.  

 

Anyway here is what i have so far, it's giving a START.vi error, probably because i have (2) of them.

0 Kudos
Message 9 of 13
(2,258 Views)
Solution
Accepted by topic author coolhandLV7

Hi coolhand,

 

have a digital input from a PLC, that lasts for ~15seconds,

How fast do you want to react on the rising edge?

When your trigger signal stays HIGH for ~15s you might even read the DI signals one sample at a time with maybe 10Hz sample rate and chack for your trigger condition on your own!

 

It's quite simple - you only need a feedback node and a comparison function similar to this… (You might also use the BooleanCrossing function.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 10 of 13
(2,253 Views)