LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

outputting TTL pulse trains during analog acquisition

I am attempting to sending continuous TTL pulses while simultaneously acquiring analog data.  I need the pulse train to start and stop at the same time as the acquisition.  I am using the example "Generate Pulse Train (DAQ-STC).vi" to send the pulses, and can start the output at the same time as the analog acquisition, however, I can't figure out how to stop it at the same time as the acquisition stops.  Because the acquisition is in a while loop it doesn't communicate with the Generate Pulse Train. vi which is outside the loop.  I have tried using Generate Single Pulse inside the loop, but it significantly decreases the speed of the acquisition.
 
Any help would be extremely appreciated.  I have included my vi.  It first takes an offset of my sensors, then when the start button is pushed should acquire analog data and send the TTL pulses.
 
Thanks
 
Jamie
0 Kudos
Message 1 of 10
(3,559 Views)

Jamie,

Sounds like you're using traditional NI-DAQ, right?  Search the DAQ palette for 'Route Signal.vi' and check out the online help.  There should be a way to programmatically route a signal named something like "AI ScanStart" out to a PFI pin on your terminal block.  This will produce 1 pulse per sample, automatically starting and stopping in sync with the AI task. 

Will this solve your problem?  Or do you need the pulse train at a different frequency than the AI, or do you need a specific duty cycle?  If so, post back -- there are other options that require a bit more DAQ programming...

(Sorry, can't look at your code now -- I'm not near an LV PC).

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 10
(3,545 Views)

Thanks for your suggestion Kevin -

I used the Route Signal to put the AI Scan Start to PF7 line (I have E series board).  This only generated one pulse at the start of acquisition (I noticed this through an oscilloscope, unfortunately the system I am trying to communicate to didn't recognize this pulse).   It didn't generate a continuous train of pulses, which is what I need.  I don't necessarily need the same duty cycle, however each pulse needs to be at least 50 microseconds in width.

I also use two other route signal vis to synchronize a couple E-series boards.  I put the third one (for AI Scan Start) in series and maybe I didn't do this properly (although I do get 1 pulse).

Any other suggestions?

Thanks,

Jamie

0 Kudos
Message 3 of 10
(3,536 Views)

Hi Jamie,

Which board and which version of DAQ and LabVIEW are you using?  If you are using LabVIEW 7.0 or higher, then I would really recommend one of the DAQmx shipping examples.  Signal routing and synchronization is one of the things that DAQmx really makes easier.  In fact there are a lot of examples if you go to: Help > Find Examples > Browse > Hardware Input and Output > DAQmx > Synchronization.  Particularly Multi-Function-Ctr Pulse Train Genereration for AI Sample Clock.vi.  In this example you can see how you synchronize an analog input operation and a counter.

Another way you could make it work is have parallel AI and CTR tasks where the CTR tasks is triggered on the aiSampleClock line.  That means that the first sample that you take on your analog input would begin your pulse train that you could output.  You can find examples on how to do these in the same DAQmx Folder within the NI Example Finder.

Right now it looks like you might be trying to do some software timed operations.  Those will severely slow down your outputs and be unnecessarily complex.  In fact, if you could even make two parallel DAQ Assistants and create this whole applications with just 2 VIs!

Best of luck,

0 Kudos
Message 4 of 10
(3,522 Views)
Thanks Otis, but unfortunately we are using Labview 6.1, I actually saw
some examples online that looked as though they may work, but alas...
 
Any other suggestions?
 
(I know, I know, get 7.0 🙂 )
 
Jamie
0 Kudos
Message 5 of 10
(3,518 Views)

Hi Jamie,

It still sounds like you want to have an analog input start at the same time as an counter output.  You can find some examples for 6.1 by looking in the following path:
C:\Program Files\National Instruments\LabVIEW 6.1\examples\daq\counter\daq-stc.llb

You might be able to run one of these examples such as Generate Pulse Train (DAQ-STC).vi and get the characteristics from the pulse train that you are looking for.  It sounds like you want to just run a pulse train, and then once you're done stop it.  You might still be able to use the Route Signal.vi like Kevin said earlier, so that you can get both operations to start at the same time with the start trigger.

Basically you will want to generate a pulse train rather than single individual pulses as those will require configuration, starting and stopping with each iteration of the loop in software.

(And of course you can always upgrade to LabVIEW 8.0 if you want the best stuff available!)

Regards,

 

 

0 Kudos
Message 6 of 10
(3,502 Views)

Thanks Otis -

We are actually playing around with this sub-vi right now, but are struggling to get it to start and stop properly.  It does generate pulses like we want.  I will keep playing around with it.

 

Thanks again.

 

Jamie

0 Kudos
Message 7 of 10
(3,494 Views)
Jamie,
 
Did you have any luck with this VI? What you were trying to do sounds very similiar to what I am trying to do. I was wondering what kind of luck you had and if you had any advice.
0 Kudos
Message 8 of 10
(3,429 Views)

James -

Yes, I got it working.  I used the "Route Signal", using AI Scan Start as the signal source and PF7 as the signal name and line. Then I used the "Generate Pulse Train. vi" and set the gate selection to PF7.  There are other parameters you can set in this vi (i.e, frequency of pulses).  The program sends pulses when you start acquiring data, then stops when the program stops running (not when the program stop acquiring data, but when the program completely stops).  At the end you must use Route Signal again to clear the PF7 line (i.e., signal source = 'none', signal name = 'PF7).

 

Hope this helps.

 

Jamie

0 Kudos
Message 9 of 10
(3,409 Views)
Jamie,
 
I'll take a look at your suggestions when I'm on a machine with Labview. Thanks for the advice.
 
James
0 Kudos
Message 10 of 10
(3,406 Views)