Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Use digital edge to stop pulse train continuous generation

Solved!
Go to solution

Hi,

 

I need to generate a pulse train for a period of time. However, this period of time is variable, and because of that I can't

use the finite number of samples.

The pulse train must be output based on the state of the digital I/O. When the I/O line goes high, the pulse train must be output,

and when it goes low the pulse train needs to be stopped.

 

I'm using a USB-6212, but one of the available counters is already being used for pulse width measurement. I tryed to make a

logical AND with the pulse train and the enable line, but because of vi execution time this solution is modifying the pulse train

frequency, which is not acceptable.

 

Thanks in Advance,

Mariana.

0 Kudos
Message 1 of 6
(7,124 Views)

Hi Mariana,

 

You can use a pause trigger to control when the pulse train is output, based on whether an external digital signal is high or low. DAQmx ships with examples demonstrating this. Here is the LabVIEW version: Gen Dig Pulse Train-Continous-Pause Trigger.vi

 

Brad

---
Brad Keryan
NI R&D
Message 2 of 6
(7,118 Views)

Hi Brad,

 

I saw the examples with the pause task vi involved. My problem is that I need two triggers: one that tells me when to output the pulse train and another to

stop it. Those triggers are actually both rising (start trigger) and falling (stop trigger) edges of a digital input.

 

I tried to modify the example you provided by adding the start edge trigger, but labview did not accepted it.

 

Regards,

Mariana.

0 Kudos
Message 3 of 6
(7,111 Views)
Solution
Accepted by topic author rodmar

Hi Mariana,

 

Your previous message mentioned "the I/O line" (singular) and "the enable line" (singular), not "the I/O lines" (plural). Are both edges on the same I/O line? Or are they on separate I/O lines (e.g. rising on PFI0, falling on PFI1)? Could you clarify your requirements?

 

If the rising and falling edges both come from the same I/O line, then a pause trigger seems to do what you want: cause the counter to generate pulses while the I/O line is high, and cause the counter to stop while the I/O line is low. However, if you start the task while the I/O line is high, it will immediately start outputting pulses. If you want it to wait until the first rising edge of the I/O line before generating any pulses, you can use an "arm start" trigger (which is right below "pause trigger" in the property node). When the "arm start" trigger arrives, the counter will be armed, and from then on, the task will use the pause trigger to determine when to generate pulses. Using pause and start triggers in the same counter task returns error -200146, "Pause and start triggers cannot both be active in this task," but using pause and "arm start" triggers in the same counter task should be okay.

 

If you want rising edges from PFI0 to start the counter and falling edges from PFI1 to stop the counter, that's more complicated and will require additional thought (and possibly additional hardware).

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 4 of 6
(7,107 Views)

Hi Brad,

 

Both rising and falling edges are from the same line. I'll try your suggestion.

 

Thanks a lot,

Mariana.

0 Kudos
Message 5 of 6
(7,094 Views)

Hi Brad,

 

The vi worked when I inserted the ArmStart property node, thank ou very much!!

 

My problem now is that sometimes, when paused, the pulse generator pin stays in high state, and I need it to always go to low state when the task is paused. There is no property for that which I could find, do you have any idea??

 

Regards,

Mariana.

0 Kudos
Message 6 of 6
(7,086 Views)