Jump to content

Listening to triggers


Raymond Tsang

Recommended Posts

I need to write a LV (6.1) program to get data from 5 32-bit IO cards (some PCI-6601 and PCI-6602). I have written the program, which reads one particular line (trigger) every, say, 1ms using a while loop. If a trigger is detected then data from all the cards are fetched.

However, the program has some memory leak (4 to 8k/s as seen from windows task manager), so I am thinking of removing the while loop or at least reducing the number of loops.

So, is it possible to do the same thing without reading a line frequently? for example, passively waiting a trigger to come?

Thanks in advance!

Raymond

Link to comment

Hi Raymond:

No reason why the while loop should cause a memory leak-- assuming that you are doing everything the way you should.

Most likely cause is that you are creating a reference to something (The I/O cards?) inside the loop, and not destroying the reference when you're through with it.

The more efficient approach would be to create the reference outside the loop, before it executes, pass that reference into the loop, use that one reference over and over, and then destroy that reference when you exit the loop.

That's the best I can geuss without looking at your program-- If my geuss is wrong, go ahead and post the program, if you can, so we can see what you are doing)

Hope this helps & by the way, Welcome to the LAVA forum :beer:

Best Regards, Louis

Link to comment

Hi Louis,

It seems that your guess is correct!

But how to destroy a reference?

Thanks,

Raymond

Hi Raymond:

No reason why the while loop should cause a memory leak-- assuming that you are doing everything the way you should.

Most likely cause is that you are creating a reference to something (The I/O cards?) inside the loop, and not destroying the reference when you're through with it.

The more efficient approach would be to create the reference outside the loop, before it executes, pass that reference into the loop, use that one reference over and over, and then destroy that reference when you exit the loop.

That's the best I can geuss without looking at your program-- If my geuss is wrong, go ahead and post the program, if you can, so we can see what you are doing)

Hope this helps & by the way, Welcome to the LAVA forum :beer:

Best Regards, Louis

Link to comment

Hi Raymond:

I'm not sure exactly which method you are using for digital I/O. (And I don't even have LV6.1 loaded on this machine) but something like "Clear Task.vi" or "Close Task.vi" chosen from the same part of the menu as where you got the vi for doing the I/O should release all resources reserved for the task. Most of these vi's will have an input for the task ID, but no output for it. If you were using DAQmx in LV8, the "DAQmx Clear Task.vi" would be what you want.

Even if you don't clear the task, memory leakage should be very minimal if you only create the task once per run of your vi, rather than every time you go through the loop, but the best bet is to close the task and keep things tidy.

Best Regards, Louis

Link to comment
I need to write a LV (6.1) program to get data from 5 32-bit IO cards (some PCI-6601 and PCI-6602). I have written the program, which reads one particular line (trigger) every, say, 1ms using a while loop. If a trigger is detected then data from all the cards are fetched.

However, the program has some memory leak (4 to 8k/s as seen from windows task manager), so I am thinking of removing the while loop or at least reducing the number of loops.

So, is it possible to do the same thing without reading a line frequently? for example, passively waiting a trigger to come?

Thanks in advance!

Raymond

Hi Raymond,

It might be possible to use a PFI pin as a digital trigger, and then configure your acquisition to start as soon as a "high" is received on the PFI pin.

You can also, in theory, internally hook up all your DAQ cards together using the RTSI bus, so that a trigger on one, triggers all the cards. You will have to buy the RTSI cable or build your own.

That way your acquisition is truly hardware triggered, with no S/W polling in loops.

Look at the DAQ Hardware trigger examples, and the RTSI bus examples in LV.

Neville.

Link to comment
  • 3 weeks later...
Hi Raymond,

It might be possible to use a PFI pin as a digital trigger, and then configure your acquisition to start as soon as a "high" is received on the PFI pin.

You can also, in theory, internally hook up all your DAQ cards together using the RTSI bus, so that a trigger on one, triggers all the cards. You will have to buy the RTSI cable or build your own.

That way your acquisition is truly hardware triggered, with no S/W polling in loops.

Look at the DAQ Hardware trigger examples, and the RTSI bus examples in LV.

Neville.

Hi Neville,

Thanks a lot for the suggestion. Actually, I am now trying to use the hardware trigger.

I have found an example called "Start & Stop Trigger.vi" which seems to do the thing I want. When I look at the example, what it does seems to be: configuring the device and then looping in a while-loop. So, a while-loop is inevitable. Apart from the while-loop, my application needs to listen to a trigger in the mean while looking at the clock to see if time is up.

So, I don't know how I can modify the example and use it. Any suggestions?

Thanks in advance, :worship:

Raymond

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.