Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

suppressing generated pulses using a digital signal

I've been advised to re-post this question here - hopefully this is a simple problem.
 
I'm using counters.vi (below) to generate a single pulse, with a specified delay, every time an input pulse is received. This works fine.
 
I would like to make the pulse output conditional on an additional TTL signal. This signal is high / low for seconds at a time.
 
Is there a simple way to incorporate a digital channel into this vi? I'm using a M-series USB 6259 board for input/output.
 
Thanks in advance for your help.


Message Edited by luke_m on 07-30-2008 03:34 AM
0 Kudos
Message 1 of 9
(4,905 Views)
Hey luke_m,

Can you give more details on what exactly you mean by making "the pulse output conditional on an additional TTL signal"? Are you wanting to output on a digital line using the same start trigger as PFI0? This is easily implemented as you can specify PFI0 as the start trigger for your digital task. There are several examples of this in the LabVIEW shipping examples found in Help » Find Examples.

Or are you wanting to trigger off multiple lines? If so, this is not possible in hardware. You could monitor two digital lines in software and then start your Counter Output task when both lines are detected high. There would be some delay between when the lines go high and when the counter task starts because it is software timed. In order to do this as hardware timed you would need some external circuitry or an external FPGA.

I hope this helps and let me know if you have additional questions.
Regards,

Chris Delvizis
National Instruments
0 Kudos
Message 2 of 9
(4,885 Views)

Hi Chris

Thanks for your reply.  My issue sounds like the second example you gave, but I will explain my application in the hope there is a workable solution.

I'm trying to control a pulsed laser. An external pulsed signal, at approximately 50 Hz, is used to fire the laser. This trigger needs to be delayed by 100s of microseconds to control the power. I can successfully fire one pulse for every incident pulse at a set delay using the .vi I attached, by running this external trigger into PFI 1.

I would like to fire the laser only when required by an external laser marking program. This program supplies a TTL digital signal. Marking runs take a few seconds, and this signal may switch twice a second. I can use this as my external trigger into PFI 1, and I get a continuous pulse train, which stops pulsing when the TTL signal goes low.

I would like to fire a pulse a set delay after the incident pulse, only when the TTL is high. Can I do this on a USB-6259?

 

Thanks

Luke

0 Kudos
Message 3 of 9
(4,877 Views)
Hey luke_m,

It looks like you used the following example for your starting point:

Creating a Delayed, Retriggerable and Finite Pulse Generator
http://digital.ni.com/public.nsf/allkb/204538A044431C9B86257377004EB952?OpenDocument

From my understanding, you simply want to trigger this example off of your TTL signal. Since the TTL pulse is only occurring at once or twice a second this should give the trigger enough time to rearm and be waiting for the next trigger. It should be as simple as wiring your TTL signal to the PFI line since this line accepts a 5V TTL signal.

Please let me know if I am still misunderstanding and let me know if you have more questions.
Regards,

Chris Delvizis
National Instruments
0 Kudos
Message 4 of 9
(4,858 Views)

Chris

 

That is the example vi I used.

I'm using the 50 Hz pulsed (laser) signal as my trigger. Every time the laser signal goes high, I generate one pulse a set time interval later. This interval needs to be controlled precisely as it determines laser power. This part works - if I supply the laser signal to the PFI line, I get a perfectly delayed single pulse out for every input pulse.

I would like to gate this output with the TTL (marking) signal. The marking signal is high when writing and low when moving the laser to a new start point - I don't want the laser to fire during this time. If I feed the marking signal in as the trigger source, I only get one pulse when the laser begins marking. If I feed the marking signal into the trigger property node, with the laser signal into the trigger source, I get continuous pulses out that are uncorrelated with the laser signal.  It's crucial that the time interval between the laser and output pulses are maintained.

Can I gate the output? Or is this a case of trying to trigger off multiple lines as you mentioned before?

Thanks for your help

Luke

 

0 Kudos
Message 5 of 9
(4,848 Views)
Hey luke_m,

Now I understand. Rather than triggering off of each rising edge, you want to continually trigger while the TTL marking signal is high and not trigger while it is low. The reason you are getting continuous pulses after the initial trigger is because you are using a Start Trigger. This will start the task on the first rising edge it receives. To effectively gate the signal we can use a Pause Trigger. This will pause the task whenever the signal is low or high, whichever you specify.

To implement this just replace the start trigger with the pause trigger. The example you are using actually already use one pause trigger on the first counter. You will be adding a second pause trigger. Also, you will have to add in a DAQmx Timing VI to configure the second task as continuous else you will get errors.

I believe this pause trigger will do the trick and we won't need any external circuitry. Give this a shot and let me know if you have anymore questions.
Regards,

Chris Delvizis
National Instruments
0 Kudos
Message 6 of 9
(4,842 Views)
Hi Chris
 
I've been playing around with your suggestions for a few days, and am unsure whether I'm missing something. I've attached an image of my (non-functioning) program as it stands.

 
My problem is in the lower line (beginning with ctr1). I have replaced the start.retriggerable with a pause trigger, using the TTL (PFI8) as the trigger source. I have include a DAQmx timing vi as suggested. However, if I use sample clock mode as shown, I get an error message saying Hardware Timed single point mode is the only sample mode supported for Counter timing. Making this switch generates a second error telling me single or continuous sampling is the only sample type available with this timing.
 
If I switch to implicit timing, the program now runs. However, I now have no way of including the signal from PFI0 that should control the timing of the output pulses. While the TTL signal is high, I get a continuous train of pulses uncorrelated to the signal on PFI0
 
My aim is this:
If the signal on PFI8 is high, I want to output one pulse exactly 600 μs after every input pulse on PFI0
If the signal on PFI8 is low, no output at all.
 
Thanks for your help.
 
Luke
0 Kudos
Message 7 of 9
(4,813 Views)
Hey luke_m,

I apologize, I previously must have misunderstood your application again. I assumed that the 50 Hz signal and the TTL marking signal were the same. Since both signals are triggering ctr1 you will not be able to do this in hardware without some sort of external FPGA (the multiple line problem we discussed).

However, this can be accomplished in software and may work for you application because of the slow rate of the marking signal. We can get up to 1ms accuracy in software so this should be enough accuracy if the TTL marking signal is running at 50 Hz or lower. To implement this we would input the TTL marking signal on a digital line using a DAQmx Digital Input task and in software use a case structure to start the task counter tasks if the line goes high and stop the counter tasks if the line goes low. This may cause around a 1ms delay, but everything else should be as accurate as before. You can see an example to get you started by going to the NI Example Finder in LabVIEW at Help » Find Examples » Hardware Input and Output » DAQmx » Digital Measurements » Read Dig Chan.vi.

I am sorry about misleading you with the pause triggers, but I was not clear on your application. I hope that this solution can work for you.
Regards,

Chris Delvizis
National Instruments
0 Kudos
Message 8 of 9
(4,796 Views)

Hi Chris

Thanks for that last post. I've used the example you've given, and with a bit of tweaking got it working nicely.

Thanks for all your help with this issue - it's very much appreciated!

Luke

0 Kudos
Message 9 of 9
(4,779 Views)