Discussion:
Multiple TTL's and analog input, I'm lost again
(too old to reply)
ctolson
2008-08-05 18:40:07 UTC
Permalink
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.


Linear 3ch Wave Gage and pressure Data Capture Folder.zip:
http://forums.ni.com/attachments/ni/170/346817/1/Linear 3ch Wave Gage and pressure Data Capture Folder.zip
MXI Master
2008-08-06 22:10:05 UTC
Permalink
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.
ctolson
2008-08-07 13:10:11 UTC
Permalink
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 helpChris O.
ctolson
2008-08-08 19:10:05 UTC
Permalink
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.
MXI Master
2008-08-11 14:40:18 UTC
Permalink
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!<img src="Loading Image..."><img src="Loading Image..."> Message Edited by MXI Master on 08-11-2008 09:38 AM


Add channel.png:
http://forums.ni.com/attachments/ni/170/348275/1/Add channel.png


channel select.png:
http://forums.ni.com/attachments/ni/170/348275/2/channel select.png
ctolson
2008-08-11 15:10:07 UTC
Permalink
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.&nbsp; I&nbsp;have tried to convert the DAQ assistant to&nbsp;code and use case structures with a tick count to do this, but have encountered two problems.&nbsp;
1.&nbsp; The TTL's need to be delayed with respect to the running of the VI.&nbsp; 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.&nbsp; but maybe in another instance they would be opposite.&nbsp;
2.&nbsp; 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.&nbsp; 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
ctolson
2008-08-11 15:10:10 UTC
Permalink
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.&nbsp;
ctolson
2008-08-11 19:10:05 UTC
Permalink
Hello again,
&nbsp;
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.&nbsp; Am I correct in thinking this?
&nbsp;
Chris
MXI Master
2008-08-12 21:40:22 UTC
Permalink
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&nbsp; 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.
ctolson
2008-08-13 20:40:06 UTC
Permalink
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?&nbsp;ThanksChris O&nbsp;


Trial 5.vi:
http://forums.ni.com/ni/attachments/ni/170/349137/1/Trial 5.vi
MXI Master
2008-08-14 17:10:07 UTC
Permalink
Your logic for the booleans looks much better. Though the start of your acquisition relative to your digital pulses is unknown, as this is all timed in software. Once you switch to an M-series it will be very easy for both of these tasks to share a trigger. You won't be able to run them on the 6008, but you can look at the examples under DAQmx&gt;&gt;Synchronization&gt;&gt;Multi-function.
ctolson
2008-08-15 00:10:27 UTC
Permalink
Thanks for the help again, we are just about ready to order the M series too!&nbsp;Chris&nbsp;
MXI Master
2008-08-15 17:10:09 UTC
Permalink
Great, it is the perfect time to upgrade for you. It is always good to see people growing in their skill as DAQ programmers and pushing on to the next level of hardware. The M-series will really give you the flexibility you need.
Continue reading on narkive:
Search results for 'Multiple TTL's and analog input, I'm lost again' (Questions and Answers)
6
replies
who win the match for jonh and randy ortan?
started 2007-08-19 06:00:21 UTC
rugby league
Loading...