LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I send a digtal pulse at a .9ms rate without comprimising my programs speed?

I have a program where I need to send a digital pulse to 6 strobe boards in order to make them flash. However when I use the DAQ assistant along with a data constant to sen dthe signal it clogs up my loop slowing it to a rate that is not efficient. I need the flash triggers to be seperated by 0.9ms and flash in a triplets (flash-.9ms-flash-.9ms-flash-"gap of time specified by frequency"). My issue is there isn't an external clock I've found that solves my problem. If someone has a method of making this work or an alternative method it would be much appreciated. Thanks! Smiley Happy
nerd4life
0 Kudos
Message 1 of 8
(3,174 Views)
here's a pic of my code.
nerd4life
0 Kudos
Message 2 of 8
(3,172 Views)
Hi,

The approach you are taking right now although it may work you are depend on your OS also the DAQ assistant is intended for easy, quick code that are by no means optimal depending on your application. Which card do you have?

If you have and M series you can set a correlated Digital output where you use the counters as the sample clock, this will allow you to send the triggers exactly at .9 ms and pause the generation after the triplet. If you have a static digital input output card then you have no options for setting determinism on your generation and will always be depended on your operating system. I will suggest opening and play around with the shipped example: “Correlated Dig Write with Counter.vi” also start digging into the DAQmx low level VIs (right click the DAQ assistant and select generate code).

I hope it helps
Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 3 of 8
(3,136 Views)
I did look at those examples and was able to incoporate a pulse train into my code generating the pulse I required. However I now need to have a signal running simultaneously with the other signal at half the speed. I have a PCI6221 board and a SCC-68 board. Thank you so much for your help Jamie.
nerd4life
0 Kudos
Message 4 of 8
(3,133 Views)

Hi ewong,


I'm sorry I forgot to attach the example I built with your first post. Is not a very clean code but it might help you get started. First task: (easy one)
is to generate two pulses at the same rate. Copy the same code you have for one pulse train in parallel with the first one (no wires dependency). Second with
want those to start at the same time, for that you will use the trigger capability of a counter. After you have accomplish this we will change the rate by making the
second counter output a pulse every time it counts 2 high ticks and to low ticks of the first counter.



I hope it helps
Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 5 of 8
(3,117 Views)

Jamie,

 

Sorry for the delayed response. Unfortunately that code does not quite do what I wanted. I should have explained exactly what it is I wanted to accomplish. I have a photodiode reading the light emitted from fast triplets emitted from the strobes I am testing. I have 6 sets of strobes and photodiodes, 3 flashing with .9ms between flashes and 3 flashing with .45ms between flashes. In my current program I set the photodiode low (to read) which "triggers" my finite pulse train (the triplet). I need it to trigger two pulse trains as described above. However my board (PCI-6221 w/ SCC-68) only has 2 counters. I dont know if it is possible to accomplish but it would be nice. I've been looking to see if I could possibley use p0.0 as it supposedly has the capability as well as the freq out pin. I'm attaching an update of my code. Thanks for all your help!

 

-Eric 

Message Edited by ewong on 08-20-2008 09:38 AM
nerd4life
0 Kudos
Message 6 of 8
(3,064 Views)

Hi Ewong,



If you are doing a continuous pulse generation you can do it
with your 6221 since a continuous pulse generation uses only one counter, now if
this is going to be generating a finite amount of pulses then you are right you
won’t be able to do it with your card. If you want to use the FREQ OUT this KB
might help you: “How
Do I Program the Frequency Out (FREQ_OUT) Signal Using NI-DAQmx?
.”



Going back to the previous post if your pulse is continuous you
will be able to do it with the attached code. I would suggest testing the code with a
scope.



Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 7 of 8
(3,040 Views)

Jaime (only now do I realize I've been spelling your name wrong, sorry!),

 

Thanks for all your help! I ended up running my program at double speed and using an AND switch with a digital signal to have one set of strobes run every trigger and the other set to run half the triggers. I also had to rewrite some of how the data was inerpreted but was able to get it to work the way I had hoped. Thanks again.

 

-Eric 

nerd4life
0 Kudos
Message 8 of 8
(3,024 Views)