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: 

Trigger detection - DAQ Assistant - NI USB 6259

Hello all,

 

I'm new here so I hope this is the correct section to post.

 

I'm having some troubles trying the following:

I'm a simulating an arbitrary signal and sending it (through the DAQ assistant) to an Analog Output Port (AO0) of my NI USB DAQ Device (6259).

This is connected to an Analog Input Port (AI0) with a wire and a resistance. I also connected the grounds of the input and the output.

 

I'm receiving the signal correctly but when I'm trying to count all the rising edges with a small loop, it doesn't count correctly, he only detects ~10% of it.

The period of the simulated signal should be 10ms, which should give me 100 rising edges / second. Now it only gives me 10 / second.

 

I've included my vi's (send.vi & receive.vi) as an attachment. Any help or advice would be greatly appreciated.

 

Friendly greetings,

Jan

 

 

Download All
0 Kudos
Message 1 of 4
(2,984 Views)

Hello Verkom,

 

There are a few things I have my doubts about in the code, but I'll keep myself to the reason why you will not be able to get more than 10/second:

- You're acquiring 1k samples per read at a sample rate of 10 kHz in your DAQ Assistant. (this means retrieving data 10 times per second or loop period of 100 ms)

  This limits your loop rate to 100 ms

- Then you take a logical AND of the Trigger output array.
  This produces either a true or a false value at the output of the logical AND.

- Your true case will at maximum execute once every 100ms which comes down to at maximum 10 incrementations per second.

 

This left aside, there are several things that don't seem to make sense in the receiver side of code (based on the LabVIEW version I'm using):

- Your inputs of the trigger VI (which seems to be obsolete) are not wired.

- Can you check if the boolean array output is empty?

  (remark: Wiring an empty boolean array output to a logical AND causes a true output)

- This could makes you increment your counter each 100ms.
   If you have an empty boolean array output, then you could still get 10 increments per second (because of the remark in between brackets).

- The trigger VI you're using seems to just detect if there is a rising edge/trigger and not how many.

 

What is it that you actually want to measure?

- the amount of pulses

- the period of those pulses

- the amount of rising edges and the trigger level (not each rising edge will necessarily be considered as a pulse depending on the trigger levels)

 

If you just want to detect the rising edges (compared to trigger level), then you can just do the following:

- Get all your samples in a simple numeric array (in your case size 1k)

- search for samples with index i that are bigger than your trigger level and where sample with index (i-1) was smaller than (or equal to) your trigger level.

- Increment by one for all the occurances of this rising edge or (better) just count the occurances and add this amount after the (1k-1) comparisons to your current "running count".

 

Another question on the side:

Is the Waveform chart correctly showing the signal you expect?

If yes, can you share a screenshot of this?

This can help you to explain what you exactly want to happen.

 

PS: There are also seem to be some unusual things (at least for me) in the sending side, but lets first make the receiver side achieve its goals.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
Message 2 of 4
(2,932 Views)

Hello ThiCOp,

 

Thank you for your fast reply.

 

It looks like I messed up a few things so I will first try to explain what I want to achieve.

I need to construct the following signal. The period of this signal needs to be 10ms. The signal needs to be continuous.

 

signal.jpg

 

That's all what the sending side has to do.

 

The receiving side needs to detect whenever a rising edge occurs so it can trigger a certain event (so basically every 10ms this event has to trigger).

I don't want to count all the edges, it was just a test to see if my labview-code was well written.

 

This is the signal what I'm receiving now:

 

receive.jpg

 

So is it right to assume that according to this waveform there are 10 rising edges every 100ms?

 

 

Now about your reply,

You're talking about 1K samples per read it acquires. Is this default or adjustable? If I change this number to 100 samples per read, would that change my loop period to 10ms?

Since it's not possible to make my sample rate of 10 kHz higher.

Edit: I now changed the samples to read of the daq assistant of the receiver to 100 instead of 1k and it looks like it detects now 100 rising edges a second (now need to verify if the boolean array output is empty)

 

Would you suggest to use this trigger VI or are there any alternatives out?

 

Thank you for your help,

Friendly greetings,

Jan

 

 

 

0 Kudos
Message 3 of 4
(2,923 Views)

Hello Jan,

 

If you change it from 1k to a 100, then you can indeed have up to 100 detections per second.

 

However, this still not is the best way to go.

 

You should best stick to 1k samples and 10k sample rate and write the "simple code" I describer in my previous post.

This will help you get a feeling for LabVIEW programming.

Are you having any problems doing this? 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 4 of 4
(2,894 Views)