LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple TTL's and analog input, I'm lost again

Here I am again probably driving you LabView experts crazy with my simple questions
 
I have been working on this program all summer and I have hit a wall again.  I am trying to set up single TTL pulses to send to other instruments and computers, while at the same time acquiring analog data.  It was sugguested by Johnsold to use a producer/consumer events pattern with one loop handling the acquisition and pulses, while one or two other loops handle the user interface and writing to files.  I have tried to figure out how the loops work by looking at the online examples and some tuitorials, but I am still lost.  I am fairly certain that my VI is far larger than it actually needs to be, (almost 10 MB), so if anyone knows how to simplify the TTL pulses, I think the size would be greatly reduced.  I would use the DAQ assistant, but dont know how to set up separate timing for each channel.  I am currently using a usb-6008, but will upgrade to most likely a M series USB after the programs have been figured out.  The accuracy of the timing is more important than the ability to see the data on the front panel in RT.  If it is possible to see the data in RT without affecting the acquisition and triggers, that would be ideal.  This program is being written to be used in both LabView 8.2 and 8.5 on a windows XP OS.
 
Thanks in advance, and thanks for all the help I have already gotten.
 
Chris O.
0 Kudos
Message 1 of 13
(3,584 Views)
Chris, I would recommend rolling all of your digital code into one task. You can write to multiple digital lines in the same task even if they are not sequential and you could create role all of your "on/off" switches into one boolean array, this would speed up your code a little bit.

If you had an M-series I would suggest triggering your Digital Task off of the ai/Start Trigger internal line, but I do this is not an option on the 6008. With this, you could pulse the digital lines on and off at the same time your AI started. But you would have to do this step manually on the 6008 since it only supports software triggering, sorry.
-Marshall R
0 Kudos
Message 2 of 13
(3,543 Views)
Thanks MXI Master

I will give that a shot here as soon as I get a chance, but it looks like that is what I am looking for.  I appreciate the help

Chris O.
0 Kudos
Message 3 of 13
(3,527 Views)

MXI Master

I have been working putting the TTL pulses in a single task, however I am not good with DAQmx.  Do you know of any sample code out there using DAQmx to do this.  I have tried modifying the code generated by the DAQ assistant, but they always run sequencially, so if the one waits, the rest are dependant on the delay of the previous triggers.  If I can get all the triggers into a single task, I should be able to finish this VI without too much trouble.

Thanks

Chris O.

0 Kudos
Message 4 of 13
(3,509 Views)
You can still use the DAQ Assistant. Just select more channels either in the creation of the DAQ assistant or on the configuration.The all the channels will be together. Tasks can even span across multiple DAQ cards!




Message Edited by MXI Master on 08-11-2008 09:38 AM
-Marshall R
Download All
0 Kudos
Message 5 of 13
(3,481 Views)

Marahall,

Thanks for the reply, I do know that the DAQ assistant can handle multiple channels, but I havent been able to find a way to delay each pulse with a front panel control.  I have tried to convert the DAQ assistant to code and use case structures with a tick count to do this, but have encountered two problems. 

1.  The TTL's need to be delayed with respect to the running of the VI.  The problem is that they will not always be ran sequencially - in other words sometimes port0/line0 would need to run first then port0/line7.  but maybe in another instance they would be opposite. 

2.  I don't know if this would be considered a problem, but the triggers need to be ran while acquiring analog input, and the two need to be fairly accurate with each other.  It will be unlikely that we will be sampling over 100 Hz, so I am assuming that this won't be much of a problem.

Thanks

Chris

0 Kudos
Message 6 of 13
(3,475 Views)

p.s. Although we are using a USB-6008 right now, we are planning to upgrade soon (probably a M series USB-6212 or 6221), I am assuming these boards would be better for our applications. 

0 Kudos
Message 7 of 13
(3,468 Views)
Hello again,
 
I have been reading the NI-DAQmx Express VI Tutorial and the DAQ 8.0 measurement manual, and from what these seem to imply, the best way to create a delayed TTL would be to use counters, rather than a digital line.  Am I correct in thinking this?
 
Chris
0 Kudos
Message 8 of 13
(3,435 Views)
Counters are very precise for generating TTL pulses, you currently have more channels than your hardware counters. You would need to use a counter timer board for that. These are highly accurate pulse width driven off of a high frequency clock.

As for your application, I would  recommend putting your booleans and DAQ assistant in the same loop and vary what you feed to DAQ assistant's inputs depending on what buttons are pressed. So if you do not want to send a pulse on a line you just write all falses to it, and it does not send a pulse.

-Marshall R
0 Kudos
Message 9 of 13
(3,409 Views)

Thanks, this is what I came up with, am I correct in thinking that this is the best way to do it using the USB 6008, and will the acquisition be accurate with the timing of the while loop?

 

Thanks

Chris O 

0 Kudos
Message 10 of 13
(3,392 Views)