LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delay Counter Outputs Generated From Retrig Analog Input Task

Solved!
Go to solution

Hi all!

     First of all, I would like to thank everybody on this forum who take the time to answer questions, this forum have been a tremendous help to me.  I have a question regarding setting delays to pulses from a counter output, like what is described here.  My question is related to another, asked here, about triggering off of an analog signal, and producing a pulse at each triggered event.  I have this working, and can be seen in the attached vi.  Basically, now I am able to produce one TTL pulse everytime my analog signal crosses a certain specified level.  I have also documented the vi to my best understanding, if I have something wrong in the documentation, please let me know. 

     Anyway, now that I have a pulse at each trigger, I would like to be able to set delay events so that the pulse isn't produced until n/20 of the period (n=0,1,2,...19).  What I expect to see is a pulse train similar in "fig. 2" in the article, where the white pulse is the counter pulse, and the red pulse would be the same as my analog signal.  So for example if I had a 281Hz signal, I would like to produce a single pulse with a user-defined width every time my signal crosses a trigger level (this is zero delay: 0/20); this portion can be done by using the vi attached to this thread.  Now I would like to delay this pulse so at each trigger event, a pulse isn't produced until 1/20 of the period, or 0.000178 seconds after the trigger.

     By looking at my vi, I think that if I change the Counter Output Channel to "CO Pulse Time," and then set the respective initial delay, high time, and low time, I can get the delayed pulses mentioned in the article.  Correct me if I am wrong, but I think "high time" basically controls the pulse width; "initial delay" is what controls how long to wait, after the first trigger event is reached, before generating a pulse, but this only applies to the first pulse and not the rest; and finally "low time" is how long to wait before next pulse is created.  

     Earlier today, when I use the CO Pulse Time option, it seemed to work correctly for me up to a certain degree.  At lower frequencies the pulses seem to trigger at every event when the pulse width is set at 2.5% of the period.  When I tested at 281 Hz with a pulse width, "high time," of 0.000089 sec, and with nothing wired to the "initial delay" or the "low time," the pulses appear to consistently skip every 2 trigger events...this tells me that something is wrong in my settings, rather than any problems with the sample clock.  So I decided to wire "0" to the "low time," but then I got an error stating that low time cannot be less than some value (I forgot what the error message stated).  So I've concluded that I must not understand what these terms mean.

     Sorry for the very long explanation, but I really need help with this.  So let's say that the first set of data I want to acquire is at zero delay, such that the pulses are generated at every trigger event just like how I have my VI now; then for the next set of data I want the pulses to generate 0.000178 seconds after the trigger level; then for the third data set I want the pulses to generate  0.000356 seconds after the trigger level; and so on...how should I go about doing this?  Thank you so much!

0 Kudos
Message 1 of 3
(3,108 Views)
Solution
Accepted by topic author P00rColl3geBoi

Hello!

 

Thank you for posting to the NI Forums! I think the main issue here is that you are not sampling fast enough to catch all of your high's.So, you currently have your high's set at 0.000089 sec. You will need to significantly increase your sampling rate in order to catch all of these. Somthing around 25k should do the trick.

 

As far as using the Counter Out Pulse Time, you are totally on the right track. I think using that delay will do the job.

 

Hope this helps! Let me know!

Regards,
Margaret Barrett
National Instruments
Applications Engineer
Digital Multimeters and LCR Meters
Message 2 of 3
(3,060 Views)
Thanks Margaret, I got it working.  It was a combination of the sampling rate you mentioned, as well as the fact that I needed to set the initial delay and low time to equal or greater than 2/(counter timebase rate), the rate for my unit is 80Mhz, so my initial delay and low time had to be equal or greater than that, therefore I cannot set a delay of 0.  This brings me to another question, I understand that if I wanted a "zero delay," I would have to actually set my delay/low time value to 25*10^-9.  But for the case when I have, for example, a 2 second delay, would that be an actual 2+25*10^-9 second delay?  Or does that 25*10^9 only factor in for my 0 second delay situation?
0 Kudos
Message 3 of 3
(3,049 Views)